dropbox-api 0.4.6 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb19d89bb55d2823fc5c6602c663f4b7e5c30ba4
4
- data.tar.gz: 1c0de62cfc0bd909339244ae28e93183c31b0b8b
3
+ metadata.gz: 67d2acacbfe6b8559b4bddf86a9bd40e8796e04f
4
+ data.tar.gz: 6bd03e50167e8f564d5188678f8946d05f6d890b
5
5
  SHA512:
6
- metadata.gz: 012efcbfecf3485c7d8f71cb56a158c19bebd478430b7423d65bc68a07525fb32c198f92e6acd7a2193aa003b6bd82cf9e1189c890160e408945e501cd354e08
7
- data.tar.gz: a93b3a07bf3641994f516cfa5bbb59f0df63d6f833fde00ddce74b21b061ef2d9d1b1de6358b408f1f56f7b0daedfbe96ebd8e8702ac69ec11193e82d587c775
6
+ metadata.gz: 21e782df03cb7f9cb737c65ca9c3d4eb67c68a43dc5ea5cfe4e914246768e98effc0d50b13a45e4f3c2835095170802395f3d52956c4ce20d5e7905ac3185256
7
+ data.tar.gz: dccaa17df6f91df90a853720b788ace2e15de9fb50d7b1040f258774f12a8bc7c73a9f2ffc7b6b406688acaa2d6a0e1c453abf2761ed795ed58fa0944c5000f1
@@ -14,9 +14,9 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.rubyforge_project = "dropbox-api"
16
16
 
17
- s.add_dependency 'multi_json', '~> 1.7.9'
17
+ s.add_dependency 'multi_json', '~> 1.10'
18
18
  s.add_dependency 'oauth', '~> 0.4.7'
19
- s.add_dependency 'hashie', '~> 2.0.5'
19
+ s.add_dependency 'hashie', '~> 3.4.0'
20
20
 
21
21
  s.add_development_dependency 'rspec','2.14.1'
22
22
  s.add_development_dependency 'rake', '10.1.0'
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.add_development_dependency 'yajl-ruby', '~> 1.2.0'
25
25
 
26
26
  if RUBY_VERSION < "1.9"
27
- s.add_development_dependency 'ruby-debug19'
27
+ s.add_development_dependency 'ruby-debug19'
28
28
  end
29
29
 
30
30
  s.files = `git ls-files`.split("\n")
@@ -31,10 +31,7 @@ module Dropbox
31
31
  when 300..399
32
32
  raise Dropbox::API::Error::Redirect.new("#{status} - Redirect Error")
33
33
  when 503
34
- parsed = MultiJson.decode(response.body)
35
- header_parse = MultiJson.decode(response.headers)
36
- error_message = "#{parsed["error"]}. Retry after: #{header_parse['Retry-After']}"
37
- raise Dropbox::API::Error.new("503 - #{error_message}")
34
+ handle_503 response
38
35
  when 507
39
36
  raise Dropbox::API::Error::StorageQuota.new("507 - Dropbox storage quota exceeded.")
40
37
  when 500..502, 504..506, 508..599
@@ -45,7 +42,16 @@ module Dropbox
45
42
  end
46
43
  end
47
44
 
48
-
45
+ def handle_503(response)
46
+ if response.is_a? Net::HTTPServiceUnavailable
47
+ raise Dropbox::API::Error.new("503 - #{response.message}")
48
+ else
49
+ parsed = MultiJson.decode(response.body)
50
+ header_parse = MultiJson.decode(response.headers)
51
+ error_message = "#{parsed["error"]}. Retry after: #{header_parse['Retry-After']}"
52
+ raise Dropbox::API::Error.new("503 - #{error_message}")
53
+ end
54
+ end
49
55
 
50
56
  def get_raw(endpoint, path, data = {}, headers = {})
51
57
  query = Dropbox::API::Util.query(data)
@@ -1,5 +1,5 @@
1
1
  module Dropbox
2
2
  module API
3
- VERSION = "0.4.6"
3
+ VERSION = "0.4.7"
4
4
  end
5
5
  end
@@ -85,6 +85,14 @@ describe Dropbox::API::Connection do
85
85
  end.should raise_error(Dropbox::API::Error, '503 - rate limited. Retry after: 50')
86
86
  end
87
87
 
88
+ it "raises a Dropbox::API::Error when the response is a 503 Service Unavailable" do
89
+ message = 'we are down'
90
+ response = Net::HTTPServiceUnavailable.new('1.1', 503, message)
91
+ lambda do
92
+ @connection.request { response }
93
+ end.should raise_error(Dropbox::API::Error, "503 - #{message}")
94
+ end
95
+
88
96
  it "raises a Dropbox::API::Error::StorageQuota when the response is a 507" do
89
97
  response = double :code => 507, :body => '{ "error": "quote limit" }'
90
98
  lambda do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dropbox-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Bunsch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-04 00:00:00.000000000 Z
11
+ date: 2015-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.7.9
19
+ version: '1.10'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.7.9
26
+ version: '1.10'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: oauth
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 2.0.5
47
+ version: 3.4.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 2.0.5
54
+ version: 3.4.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -187,3 +187,4 @@ test_files:
187
187
  - spec/spec_helper.rb
188
188
  - spec/support/config.rb
189
189
  - spec/support/jpeg.rb
190
+ has_rdoc: