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 +4 -4
- data/README.md +3 -0
- data/bunny_cdn.gemspec +2 -2
- data/lib/bunny_cdn/configuration.rb +2 -1
- data/lib/bunny_cdn/storage.rb +16 -7
- data/lib/bunny_cdn/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bf754f9171d7ac48ac64209f2822859d5d2e29818930a6697c2b8f883f66440e
|
|
4
|
+
data.tar.gz: 19b3e2827b72883c333fd5b32d57227adf78c2e5f58bbfe9ac3fe1fd6eb10621
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 11c8f7f14557a6430502d4771f593ecea2872b348d2ea300609ad5b250bf838659d812aa7198725ab98be932984908198d432b60e324ab8a4f3a664e40013584
|
|
7
|
+
data.tar.gz: 255661ca9dc602fa9c319742446d0894b970cd654b30e97cb23bc85e95218058c3d9eff5599de1275bc681c3e8ac3e40e345478aa6fc093f287d32d203ca84fc
|
data/README.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
[](https://badge.fury.io/rb/bunny_cdn)
|
|
1
2
|
[](https://app.codeship.com/projects/390509)
|
|
3
|
+
[](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
|
```
|
data/bunny_cdn.gemspec
CHANGED
|
@@ -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
|
-
|
|
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", "
|
|
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
|
data/lib/bunny_cdn/storage.rb
CHANGED
|
@@ -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("#{
|
|
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("#{
|
|
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("#{
|
|
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("#{
|
|
65
|
+
response = RestClient.delete("#{set_region_url}/#{storageZone}/#{path}/#{file}", headers)
|
|
57
66
|
rescue RestClient::ExceptionWithResponse => exception
|
|
58
67
|
return exception
|
|
59
68
|
end
|
data/lib/bunny_cdn/version.rb
CHANGED
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
|
|
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-
|
|
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:
|
|
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:
|
|
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:
|