bunny_cdn 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb108e1f12583c1483cfe2e9ac3bab53c90ec98e6d1933c203c3329e28418a54
4
- data.tar.gz: 0b599355d1ae6a01b0b207f83301a4345087b43a58478a3bf907987cddf34d7d
3
+ metadata.gz: bf754f9171d7ac48ac64209f2822859d5d2e29818930a6697c2b8f883f66440e
4
+ data.tar.gz: 19b3e2827b72883c333fd5b32d57227adf78c2e5f58bbfe9ac3fe1fd6eb10621
5
5
  SHA512:
6
- metadata.gz: 478a0a610de23c75baa518c53bfcf98d3e4cb2d9218575f84f8c76fb366e1d7dd1a76e5908f9997f3802625c50b547b575ebf37e098bdb8d6d2b31538485dd3d
7
- data.tar.gz: 5d4ec5ef659b411e6fa63981086393208a0db17aac2ad59495301d5d54ec8ed7b476a1581def4948637b9c0a968ca114873db5be97ff35d5df132faece510f2d
6
+ metadata.gz: 11c8f7f14557a6430502d4771f593ecea2872b348d2ea300609ad5b250bf838659d812aa7198725ab98be932984908198d432b60e324ab8a4f3a664e40013584
7
+ data.tar.gz: 255661ca9dc602fa9c319742446d0894b970cd654b30e97cb23bc85e95218058c3d9eff5599de1275bc681c3e8ac3e40e345478aa6fc093f287d32d203ca84fc
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
+ [![Gem Version](https://badge.fury.io/rb/bunny_cdn.svg)](https://badge.fury.io/rb/bunny_cdn)
1
2
  [![Codeship Status for brandon-meeks/bunny_cdn](https://app.codeship.com/projects/7f94a660-529a-0138-70bd-36e3badc0e07/status?branch=master)](https://app.codeship.com/projects/390509)
3
+ [![Maintainability](https://api.codeclimate.com/v1/badges/2cc8e5b9529c32d7473f/maintainability)](https://codeclimate.com/github/brandon-meeks/bunny_cdn/maintainability)
2
4
 
3
5
  # BunnyCdn
4
6
 
@@ -32,6 +34,7 @@ Create the initializer `config/initializers/bunny_cdn.rb` and set the configurat
32
34
  BunnyCdn.configure do |config|
33
35
  config.apiKey = # The API key for your BunnyCDN account
34
36
  config.storageZone = # The storage zone you want to work with
37
+ config.region = # the region of the storage zone. Options are 'eu' for Falkenstein, 'ny' for New York, or 'sg' for Asia
35
38
  config.accessKey = # The password for your storage zone
36
39
  end
37
40
  ```
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
 
18
18
  spec.metadata["homepage_uri"] = spec.homepage
19
19
  spec.metadata["source_code_uri"] = "https://github.com/brandon-meeks/bunny_cdn_gem"
20
- # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
20
+ spec.metadata["changelog_uri"] = "https://github.com/brandon-meeks/bunny_cdn/releases"
21
21
 
22
22
  # Specify which files should be added to the gem when it is released.
23
23
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency 'json', '~> 2.3'
33
33
 
34
34
  spec.add_development_dependency "bundler", "~> 2.0"
35
- spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "rake", ">= 12.3.3"
36
36
  spec.add_development_dependency "rspec", "~> 3.0"
37
37
  spec.add_development_dependency "webmock", '~> 3.8', '>= 3.8.3'
38
38
 
@@ -1,9 +1,10 @@
1
1
  module BunnyCdn
2
2
  class Configuration
3
- attr_accessor :storageZone, :accessKey, :apiKey
3
+ attr_accessor :storageZone, :region, :accessKey, :apiKey
4
4
 
5
5
  def initialize
6
6
  @storageZone = nil
7
+ @region = nil # Options are: eu, ny or sg (Asia)
7
8
  @accessKey = nil
8
9
  @apiKey = nil
9
10
  end
@@ -3,12 +3,21 @@ module BunnyCdn
3
3
 
4
4
  RestClient.log = STDOUT # enables RestClient logging
5
5
 
6
- BASE_URL = 'https://storage.bunnycdn.com'
7
-
8
6
  def self.storageZone
9
7
  BunnyCdn.configuration.storageZone
10
8
  end
11
-
9
+ # Sets the proper URL based on the region set in configuration
10
+ def self.set_region_url
11
+ case BunnyCdn.configuration.region
12
+ when nil || 'eu'
13
+ 'https://storage.bunnycdn.com'
14
+ when 'ny'
15
+ 'https://ny.storage.bunnycdn.com'
16
+ when 'sg'
17
+ 'https://sg.storage.bunnycdn.com'
18
+ end
19
+ end
20
+
12
21
  def self.apiKey
13
22
  BunnyCdn.configuration.accessKey
14
23
  end
@@ -21,7 +30,7 @@ module BunnyCdn
21
30
 
22
31
  def self.getZoneFiles(path= '')
23
32
  begin
24
- response = RestClient.get("#{BASE_URL}/#{storageZone}/#{path}", headers)
33
+ response = RestClient.get("#{set_region_url}/#{storageZone}/#{path}", headers)
25
34
  rescue RestClient::ExceptionWithResponse => exception
26
35
  return exception
27
36
  end
@@ -30,7 +39,7 @@ module BunnyCdn
30
39
 
31
40
  def self.getFile(path= '', file)
32
41
  begin
33
- response = RestClient.get("#{BASE_URL}/#{storageZone}/#{path}/#{file}", headers)
42
+ response = RestClient.get("#{set_region_url}/#{storageZone}/#{path}/#{file}", headers)
34
43
  rescue RestClient::ExceptionWithResponse => exception
35
44
  return exception
36
45
  end
@@ -44,7 +53,7 @@ module BunnyCdn
44
53
  :checksum => ''
45
54
  }
46
55
  begin
47
- response = RestClient.put("#{BASE_URL}/#{storageZone}/#{path}/#{fileName}", File.read(file), headers)
56
+ response = RestClient.put("#{set_region_url}/#{storageZone}/#{path}/#{fileName}", File.read(file), headers)
48
57
  rescue RestClient::ExceptionWithResponse => exception
49
58
  return exception
50
59
  end
@@ -53,7 +62,7 @@ module BunnyCdn
53
62
 
54
63
  def self.deleteFile(path= '', file)
55
64
  begin
56
- response = RestClient.delete("#{BASE_URL}/#{storageZone}/#{path}/#{file}", headers)
65
+ response = RestClient.delete("#{set_region_url}/#{storageZone}/#{path}/#{file}", headers)
57
66
  rescue RestClient::ExceptionWithResponse => exception
58
67
  return exception
59
68
  end
@@ -1,3 +1,3 @@
1
1
  module BunnyCdn
2
- VERSION = "1.0.2"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bunny_cdn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Meeks
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-12 00:00:00.000000000 Z
11
+ date: 2020-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: 12.3.3
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: 12.3.3
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -128,6 +128,7 @@ licenses:
128
128
  metadata:
129
129
  homepage_uri: https://github.com/brandon-meeks/bunny_cdn_gem
130
130
  source_code_uri: https://github.com/brandon-meeks/bunny_cdn_gem
131
+ changelog_uri: https://github.com/brandon-meeks/bunny_cdn/releases
131
132
  post_install_message:
132
133
  rdoc_options: []
133
134
  require_paths: