bunny_cdn 1.0.1 → 1.0.2

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: 4f31fb22c751f42cf3a8f0defb48f38770f3fcf193df3e04aea9a07020430e98
4
- data.tar.gz: 4b718c142d937d37493f840dee878f2146bb011fe4fa29e5823867ebc57aa697
3
+ metadata.gz: fb108e1f12583c1483cfe2e9ac3bab53c90ec98e6d1933c203c3329e28418a54
4
+ data.tar.gz: 0b599355d1ae6a01b0b207f83301a4345087b43a58478a3bf907987cddf34d7d
5
5
  SHA512:
6
- metadata.gz: '0865bd458753c5a6f56fdeb8c3026a6cde533d4fad7ffc05e870e1155e96d53c909b424d10f038b9baecc7675f6cba2c0cf524eb84cf4e8528f3353ffd052271'
7
- data.tar.gz: 6befd9bd430ae0554e4fcddeaa76c6f7f6a03609c074af47b855145bda08407b1cd8769523ff8f7617a51fe45f18d2dbefc54ccc3cb1b187fd2826423ddb4267
6
+ metadata.gz: 478a0a610de23c75baa518c53bfcf98d3e4cb2d9218575f84f8c76fb366e1d7dd1a76e5908f9997f3802625c50b547b575ebf37e098bdb8d6d2b31538485dd3d
7
+ data.tar.gz: 5d4ec5ef659b411e6fa63981086393208a0db17aac2ad59495301d5d54ec8ed7b476a1581def4948637b9c0a968ca114873db5be97ff35d5df132faece510f2d
@@ -1,6 +1,8 @@
1
1
  module BunnyCdn
2
2
  class Pullzone
3
3
 
4
+ RestClient.log = STDOUT # enables RestClient logging
5
+
4
6
  BASE_URL = 'https://bunnycdn.com/api/pullzone'
5
7
 
6
8
  def self.apiKey
@@ -1,5 +1,7 @@
1
1
  module BunnyCdn
2
2
  class Storage
3
+
4
+ RestClient.log = STDOUT # enables RestClient logging
3
5
 
4
6
  BASE_URL = 'https://storage.bunnycdn.com'
5
7
 
@@ -18,12 +20,20 @@ module BunnyCdn
18
20
  end
19
21
 
20
22
  def self.getZoneFiles(path= '')
21
- response = RestClient.get("#{BASE_URL}/#{storageZone}/#{path}", headers)
23
+ begin
24
+ response = RestClient.get("#{BASE_URL}/#{storageZone}/#{path}", headers)
25
+ rescue RestClient::ExceptionWithResponse => exception
26
+ return exception
27
+ end
22
28
  return response.body
23
29
  end
24
30
 
25
31
  def self.getFile(path= '', file)
26
- response = RestClient.get("#{BASE_URL}/#{storageZone}/#{path}/#{file}", headers)
32
+ begin
33
+ response = RestClient.get("#{BASE_URL}/#{storageZone}/#{path}/#{file}", headers)
34
+ rescue RestClient::ExceptionWithResponse => exception
35
+ return exception
36
+ end
27
37
  return response.body
28
38
  end
29
39
 
@@ -33,12 +43,20 @@ module BunnyCdn
33
43
  :accessKey => apiKey,
34
44
  :checksum => ''
35
45
  }
36
- response = RestClient.put("#{BASE_URL}/#{storageZone}/#{path}/#{fileName}", File.read(file), headers)
46
+ begin
47
+ response = RestClient.put("#{BASE_URL}/#{storageZone}/#{path}/#{fileName}", File.read(file), headers)
48
+ rescue RestClient::ExceptionWithResponse => exception
49
+ return exception
50
+ end
37
51
  return response.body
38
52
  end
39
53
 
40
54
  def self.deleteFile(path= '', file)
41
- response = RestClient.delete("#{BASE_URL}/#{storageZone}/#{path}/#{file}", headers)
55
+ begin
56
+ response = RestClient.delete("#{BASE_URL}/#{storageZone}/#{path}/#{file}", headers)
57
+ rescue RestClient::ExceptionWithResponse => exception
58
+ return exception
59
+ end
42
60
  return response.body
43
61
  end
44
62
 
@@ -1,3 +1,3 @@
1
1
  module BunnyCdn
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
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.1
4
+ version: 1.0.2
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-09 00:00:00.000000000 Z
11
+ date: 2020-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client