cloudapp_api 0.2.2 → 0.3.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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.3.0
data/cloudapp_api.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cloudapp_api}
8
- s.version = "0.2.2"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aaron Russell"]
12
- s.date = %q{2011-05-03}
12
+ s.date = %q{2011-05-08}
13
13
  s.description = %q{A simple Ruby wrapper for the CloudApp API. Uses HTTParty with a simple ActiveResource-like interface.}
14
14
  s.email = %q{aaron@gc4.co.uk}
15
15
  s.extra_rdoc_files = [
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
  "lib/cloudapp/gift_card.rb",
34
34
  "lib/cloudapp/httparty.rb",
35
35
  "lib/cloudapp/multipart.rb",
36
+ "lib/cloudapp/response_error.rb",
36
37
  "lib/cloudapp_api.rb",
37
38
  "spec/cloudapp_account_spec.rb",
38
39
  "spec/cloudapp_api_spec.rb",
@@ -40,6 +41,7 @@ Gem::Specification.new do |s|
40
41
  "spec/cloudapp_drop_spec.rb",
41
42
  "spec/cloudapp_gift_card_spec.rb",
42
43
  "spec/cloudapp_item_spec.rb",
44
+ "spec/cloudapp_response_error_spec.rb",
43
45
  "spec/fakeweb_helper.rb",
44
46
  "spec/spec_helper.rb",
45
47
  "spec/stubs/account/create",
@@ -54,12 +56,18 @@ Gem::Specification.new do |s|
54
56
  "spec/stubs/drop/show",
55
57
  "spec/stubs/drop/show-private",
56
58
  "spec/stubs/drop/update",
59
+ "spec/stubs/error/400",
60
+ "spec/stubs/error/401",
61
+ "spec/stubs/error/404-find",
62
+ "spec/stubs/error/404-update",
63
+ "spec/stubs/error/422-bookmark",
64
+ "spec/stubs/error/422-bookmarks",
57
65
  "spec/stubs/gift_card/redeem",
58
66
  "spec/stubs/gift_card/show"
59
67
  ]
60
68
  s.homepage = %q{http://github.com/aaronrussell/cloud_app}
61
69
  s.require_paths = ["lib"]
62
- s.rubygems_version = %q{1.7.2}
70
+ s.rubygems_version = %q{1.3.7}
63
71
  s.summary = %q{A simple Ruby wrapper for the CloudApp API. Uses HTTParty with a simple ActiveResource-like interface.}
64
72
  s.test_files = [
65
73
  "spec/cloudapp_account_spec.rb",
@@ -68,11 +76,13 @@ Gem::Specification.new do |s|
68
76
  "spec/cloudapp_drop_spec.rb",
69
77
  "spec/cloudapp_gift_card_spec.rb",
70
78
  "spec/cloudapp_item_spec.rb",
79
+ "spec/cloudapp_response_error_spec.rb",
71
80
  "spec/fakeweb_helper.rb",
72
81
  "spec/spec_helper.rb"
73
82
  ]
74
83
 
75
84
  if s.respond_to? :specification_version then
85
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
76
86
  s.specification_version = 3
77
87
 
78
88
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
@@ -58,7 +58,7 @@ module CloudApp
58
58
  # @return [CloudApp::Account]
59
59
  def self.find
60
60
  res = get "/account", :digest_auth => @@auth
61
- res.ok? ? Account.new(res) : raise(GenericError)
61
+ res.ok? ? Account.new(res) : bad_response(res)
62
62
  end
63
63
 
64
64
  # Create a CloudApp account.
@@ -70,7 +70,7 @@ module CloudApp
70
70
  # @return [CloudApp::Account]
71
71
  def self.create(opts = {})
72
72
  res = post "/register", :body => {:user => opts}
73
- res.ok? ? Account.new(res) : raise(GenericError)
73
+ res.ok? ? Account.new(res) : bad_response(res)
74
74
  end
75
75
 
76
76
  # Modify the authenticated accounts details. Can change the default security of newly
@@ -91,7 +91,7 @@ module CloudApp
91
91
  # @return [CloudApp::Account]
92
92
  def self.update(opts = {})
93
93
  res = put "/account", {:body => {:user => opts}, :digest_auth => @@auth}
94
- res.ok? ? Account.new(res) : raise(GenericError)
94
+ res.ok? ? Account.new(res) : bad_response(res)
95
95
  end
96
96
 
97
97
  # Dispatch an email containing a link to reset the account's password.
@@ -101,7 +101,7 @@ module CloudApp
101
101
  # @return [Boolean]
102
102
  def self.reset(opts = {})
103
103
  res = post "/reset", :body => {:user => opts}
104
- res.ok? ? true : raise(GenericError)
104
+ res.ok? ? true : bad_response(res)
105
105
  end
106
106
 
107
107
  # Get the total number of drops created and total views for all drops.
@@ -111,7 +111,7 @@ module CloudApp
111
111
  # @return [Hash]
112
112
  def self.stats
113
113
  res = get "/account/stats", :digest_auth => @@auth
114
- res.ok? ? res.symbolize_keys! : raise(GenericError)
114
+ res.ok? ? res.symbolize_keys! : bad_response(res)
115
115
  end
116
116
 
117
117
  attr_reader :id, :email, :domain, :domain_home_page, :private_items,
data/lib/cloudapp/base.rb CHANGED
@@ -17,6 +17,9 @@ module CloudApp
17
17
  headers HEADERS
18
18
  format :json
19
19
 
20
+ # Define empty auth hash
21
+ @@auth = {}
22
+
20
23
  # Sets the authentication credentials in a class variable.
21
24
  #
22
25
  # @param [String] email cl.ly email
@@ -26,6 +29,16 @@ module CloudApp
26
29
  @@auth = {:username => email, :password => password}
27
30
  end
28
31
 
32
+ # Examines a bad response and raises an approriate exception
33
+ #
34
+ # @param [HTTParty::Response] response
35
+ def self.bad_response(response)
36
+ if response.class == HTTParty::Response
37
+ raise ResponseError, response
38
+ end
39
+ raise StandardError, "Unkown error"
40
+ end
41
+
29
42
  attr_reader :data
30
43
 
31
44
  # Create a new CloudApp::Base object.
@@ -134,7 +134,7 @@ module CloudApp
134
134
  # @return [CloudApp::Drop]
135
135
  def rename(id, name = "")
136
136
  drop = Drop.find(id)
137
- drop.class == Drop ? drop.update(:name => name) : drop
137
+ drop.update(:name => name)
138
138
  end
139
139
 
140
140
  # Modify a drop with a private URL to have a public URL or vice versa.
@@ -148,7 +148,7 @@ module CloudApp
148
148
  # @return [CloudApp::Drop]
149
149
  def privacy(id, privacy = false)
150
150
  drop = Drop.find(id)
151
- drop.class == Drop ? drop.update(:private => privacy) : drop
151
+ drop.update(:private => privacy)
152
152
  end
153
153
 
154
154
  # Send the drop to the trash.
@@ -161,7 +161,7 @@ module CloudApp
161
161
  # @return [CloudApp::Drop]
162
162
  def delete(id)
163
163
  drop = Drop.find(id)
164
- drop.class == Drop ? drop.delete : drop
164
+ drop.delete
165
165
  end
166
166
 
167
167
  # Recover a deleted drop from the trash.
@@ -174,7 +174,7 @@ module CloudApp
174
174
  # @return [CloudApp::Drop]
175
175
  def recover(id)
176
176
  drop = Drop.find(id)
177
- drop.class == Drop ? drop.recover : drop
177
+ drop.recover
178
178
  end
179
179
 
180
180
  end
data/lib/cloudapp/drop.rb CHANGED
@@ -61,7 +61,7 @@ module CloudApp
61
61
  # @return [CloudApp::Drop]
62
62
  def self.find(id)
63
63
  res = get "http://cl.ly/#{id}"
64
- res.ok? ? Drop.new(res) : raise(GenericError)
64
+ res.ok? ? Drop.new(res) : bad_response(res)
65
65
  end
66
66
 
67
67
  # Page through your drops.
@@ -76,7 +76,7 @@ module CloudApp
76
76
  # @return [Array[CloudApp::Drop]]
77
77
  def self.all(opts = {})
78
78
  res = get "/items", {:query => (opts.empty? ? nil : opts), :digest_auth => @@auth}
79
- res.ok? ? res.collect{|i| Drop.new(i)} : raise(GenericError)
79
+ res.ok? ? res.collect{|i| Drop.new(i)} : bad_response(res)
80
80
  end
81
81
 
82
82
  # Create a new drop. Multiple bookmarks can be created at once by
@@ -104,13 +104,13 @@ module CloudApp
104
104
  res = post "/items", {:body => {:items => opts}, :digest_auth => @@auth}
105
105
  when :upload
106
106
  r = get "/items/new", {:query => ({:item => {:private => opts[:private]}} if opts.has_key?(:private)), :digest_auth => @@auth}
107
- return r unless r.ok?
107
+ return bad_response(res) unless r.ok?
108
108
  res = post r['url'], Multipart.new(r['params'].merge!(:file => File.new(opts[:file]))).payload.merge!(:digest_auth => @@auth)
109
109
  else
110
110
  # TODO raise an error
111
111
  return false
112
112
  end
113
- res.ok? ? (res.is_a?(Array) ? res.collect{|i| Drop.new(i)} : Drop.new(res)) : raise(GenericError)
113
+ res.ok? ? (res.is_a?(Array) ? res.collect{|i| Drop.new(i)} : Drop.new(res)) : bad_response(res)
114
114
  end
115
115
 
116
116
  # Modify a drop. Can currently modify it's name or security setting by passing parameters.
@@ -124,7 +124,7 @@ module CloudApp
124
124
  # @return [CloudApp::Drop]
125
125
  def self.update(href, opts = {})
126
126
  res = put href, {:body => {:item => opts}, :digest_auth => @@auth}
127
- res.ok? ? Drop.new(res) : res
127
+ res.ok? ? Drop.new(res) : bad_response(res)
128
128
  end
129
129
 
130
130
  # Send a drop to the trash.
@@ -136,7 +136,7 @@ module CloudApp
136
136
  def self.delete(href)
137
137
  # Use delete on the Base class to avoid recursion
138
138
  res = Base.delete href, :digest_auth => @@auth
139
- res.ok? ? Drop.new(res) : raise(GenericError)
139
+ res.ok? ? Drop.new(res) : bad_response(res)
140
140
  end
141
141
 
142
142
  # Recover a drop from the trash.
@@ -147,7 +147,7 @@ module CloudApp
147
147
  # @return [CloudApp::Drop]
148
148
  def self.recover(href)
149
149
  res = put href, {:body => {:deleted => true, :item => {:deleted_at => nil}}, :digest_auth => @@auth}
150
- res.ok? ? Drop.new(res) : raise(GenericError)
150
+ res.ok? ? Drop.new(res) : bad_response(res)
151
151
  end
152
152
 
153
153
  attr_reader :href, :name, :private, :url, :content_url, :item_type, :view_counter,
@@ -25,7 +25,7 @@ module CloudApp
25
25
  # @return [CloudApp::GiftCard]
26
26
  def self.find(code)
27
27
  res = get "/gift_cards/#{code}", :digest_auth => @@auth
28
- res.ok? ? GiftCard.new(res) : raise(GenericError)
28
+ res.ok? ? GiftCard.new(res) : bad_response(res)
29
29
  end
30
30
 
31
31
  # Apply a gift card to the authenticated account.
@@ -36,7 +36,7 @@ module CloudApp
36
36
  # @return [CloudApp::GiftCard]
37
37
  def self.redeem(code)
38
38
  res = put "/gift_cards/#{code}", {:body => {}, :digest_auth => @@auth}
39
- res.ok? ? GiftCard.new(res) : raise(GenericError)
39
+ res.ok? ? GiftCard.new(res) : bad_response(res)
40
40
  end
41
41
 
42
42
  attr_reader :id, :code, :plan, :months, :href,
@@ -0,0 +1,40 @@
1
+ module CloudApp
2
+
3
+ # Error raised on a bad response
4
+ class ResponseError < StandardError
5
+
6
+ attr_reader :response, :code, :errors
7
+
8
+ # Instantiate an instance of CloudApp::ResponseError
9
+ #
10
+ # Only used internally
11
+ #
12
+ # @param [HTTParty::Response] res
13
+ # @return [CloudApp::ResponseError]
14
+ def initialize(res)
15
+ @response = res.response
16
+ @code = res.code
17
+ @errors = parse_errors(res.parsed_response)
18
+ end
19
+
20
+ # Returns error code and message
21
+ #
22
+ # @return [String]
23
+ def to_s
24
+ "#{code.to_s} #{response.msg}".strip
25
+ end
26
+
27
+ private
28
+
29
+ def parse_errors(errors)
30
+ return case errors
31
+ when Hash: errors.collect{|k,v| "#{k}: #{v}"}
32
+ when String: [errors]
33
+ when Array: errors
34
+ else []
35
+ end
36
+ end
37
+
38
+ end
39
+
40
+ end
data/lib/cloudapp_api.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require "httparty"
2
2
 
3
- ["base", "drop", "account", "gift_card", "client", "multipart", "httparty", "core_ext"].each do |inc|
3
+ ["base", "drop", "account", "gift_card", "client", "multipart", "httparty", "core_ext", "response_error"].each do |inc|
4
4
  require File.join(File.dirname(__FILE__), "cloudapp", inc)
5
5
  end
6
6
 
@@ -10,7 +10,7 @@ end
10
10
  module CloudApp
11
11
 
12
12
  # Version number
13
- VERSION = "0.2.2"
13
+ VERSION = "0.3.0"
14
14
 
15
15
  # Sets the authentication credentials in a class variable
16
16
  #
@@ -20,10 +20,5 @@ module CloudApp
20
20
  def CloudApp.authenticate(email, password)
21
21
  Base.authenticate(email, password)
22
22
  end
23
-
24
- # Temporary generic error raised on all bad requests
25
- #
26
- # #TODO - implement MUCH better error handling
27
- class GenericError < StandardError; end
28
-
23
+
29
24
  end
@@ -0,0 +1,133 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe CloudApp::ResponseError, "when not logged in" do
4
+
5
+ before(:each) do
6
+ fake_it_all_with_errors
7
+ @error = lambda { CloudApp::Drop.all }
8
+ end
9
+
10
+ it "should raise a 401" do
11
+ @error.should raise_error(CloudApp::ResponseError, "401 Unauthorized")
12
+ end
13
+
14
+ it "should return a code and error messages" do
15
+ @error.should raise_error{|e|
16
+ e.code.should == 401
17
+ e.errors[0].should == "HTTP Digest: Access denied."
18
+ }
19
+ end
20
+
21
+ end
22
+
23
+
24
+ describe CloudApp::ResponseError, "when item doesn't exist" do
25
+
26
+ before(:each) do
27
+ fake_it_all_with_errors
28
+ @error = lambda { CloudApp::Drop.find "12345" }
29
+ end
30
+
31
+ it "should raise a 404" do
32
+ @error.should raise_error(CloudApp::ResponseError, "404 Not Found")
33
+ end
34
+
35
+ it "should return a code and error messages" do
36
+ @error.should raise_error{|e|
37
+ e.code.should == 404
38
+ e.errors[0].should == "<h1>Not Found</h1>"
39
+ }
40
+ end
41
+
42
+ end
43
+
44
+
45
+ # This test will currently fail. CloudApp shouldn't return a HTML response.
46
+ # In fairness it shouldn't really return a 404 either.
47
+ describe CloudApp::ResponseError, "when updating someone elses item" do
48
+
49
+ before(:each) do
50
+ fake_it_all_with_errors
51
+ @error = lambda { CloudApp::Drop.update "http://my.cl.ly/items/12345" }
52
+ end
53
+
54
+ it "should raise a 404" do
55
+ @error.should raise_error(CloudApp::ResponseError, "404 Not Found")
56
+ end
57
+
58
+ it "should return a code and error messages" do
59
+ @error.should raise_error{|e|
60
+ e.code.should == 404
61
+ }
62
+ end
63
+
64
+ end
65
+
66
+
67
+ # This test will currently fail. CloudApp shouldn't return a HTML response.
68
+ describe "when recovering an unrecoverable item" do
69
+
70
+ before(:each) do
71
+ fake_it_all_with_errors
72
+ @error = lambda { CloudApp::Drop.recover "http://my.cl.ly/items/12345" }
73
+ end
74
+
75
+ it "should raise a 404" do
76
+ @error.should raise_error(CloudApp::ResponseError, "404 Not Found")
77
+ end
78
+
79
+ it "should return a code and error messages" do
80
+ @error.should raise_error{|e|
81
+ e.code.should == 404
82
+ }
83
+ end
84
+
85
+ end
86
+
87
+
88
+ describe CloudApp::ResponseError, "badly formatted bookmark" do
89
+
90
+ before(:each) do
91
+ fake_it_all_with_errors
92
+ FakeWeb.register_uri :post, 'http://my.cl.ly/items', :response => stub_file(File.join('error', '422-bookmark'))
93
+ CloudApp.authenticate "testuser@test.com", "password"
94
+ @error = lambda { CloudApp::Drop.create :bookmark }
95
+ end
96
+
97
+ it "should raise a 422" do
98
+ @error.should raise_error(CloudApp::ResponseError, "422")
99
+ end
100
+
101
+ it "should return an array of error messages" do
102
+ @error.should raise_error{|e|
103
+ e.errors.should be_a_kind_of(Array)
104
+ e.errors[0].should == "URL can't be blank"
105
+ }
106
+ end
107
+
108
+ end
109
+
110
+
111
+ describe CloudApp::ResponseError, "badly formatted bookmarks" do
112
+
113
+ before(:each) do
114
+ fake_it_all_with_errors
115
+ FakeWeb.register_uri :post, 'http://my.cl.ly/items', :response => stub_file(File.join('error', '422-bookmarks'))
116
+ CloudApp.authenticate "testuser@test.com", "password"
117
+ @error = lambda { CloudApp::Drop.create :bookmarks, [{}] }
118
+ end
119
+
120
+ it "should raise a 422" do
121
+ @error.should raise_error(CloudApp::ResponseError, "422")
122
+ end
123
+
124
+ it "should return a nested array of error messages" do
125
+ @error.should raise_error{|e|
126
+ e.errors.should be_a_kind_of(Array)
127
+ e.errors[0].should be_a_kind_of(Array)
128
+ e.errors[0][0].should == "URL can't be blank"
129
+ }
130
+ end
131
+
132
+ end
133
+
@@ -16,8 +16,8 @@ def fake_it_all
16
16
  :get => {
17
17
  %r{http://cl.ly/\w+} => File.join('drop', 'show'),
18
18
  'http://my.cl.ly/items' => File.join('drop', 'index'),
19
- 'http://my.cl.ly/items/new' => File.join('drop', 'new-private'),
20
- 'http://my.cl.ly/items/new?item[private]=true' => File.join('drop', 'new'),
19
+ 'http://my.cl.ly/items/new' => File.join('drop', 'new'),
20
+ 'http://my.cl.ly/items/new?item[private]=true' => File.join('drop', 'new-private'),
21
21
  'http://my.cl.ly/items/s3' => File.join('drop', 'show'),
22
22
  'http://my.cl.ly/items/s3?item[private]=true' => File.join('drop', 'show-private'),
23
23
  'http://my.cl.ly/account' => File.join('account', 'show'),
@@ -45,4 +45,23 @@ def fake_it_all
45
45
  FakeWeb.register_uri(method, url, :response => stub_file(response))
46
46
  end
47
47
  end
48
- end
48
+ end
49
+
50
+ def fake_it_all_with_errors
51
+ FakeWeb.clean_registry
52
+ FakeWeb.register_uri :head, %r{http://(my.|f.)?cl.ly(/items)?}, :status => ["200", "OK"]
53
+ {
54
+ :get => {
55
+ 'http://my.cl.ly/items' => File.join('error', '401'),
56
+ %r{http://cl.ly/\w+} => File.join('error', '404-find'),
57
+ 'http://my.cl.ly/items/new' => File.join('drop', 'new')
58
+ },
59
+ :put => {
60
+ %r{http://my.cl.ly/items/\d+} => File.join('error', '404-update')
61
+ }
62
+ }.each do |method, requests|
63
+ requests.each do |url, response|
64
+ FakeWeb.register_uri(method, url, :response => stub_file(response))
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,6 @@
1
+ HTTP/1.1 400 Bad Request
2
+ Status: 400
3
+ Content-Type: application/xml
4
+
5
+ <?xml version="1.0" encoding="UTF-8"?>
6
+ <Error><Code>MalformedPOSTRequest</Code><Message>The body of your POST request is not well-formed multipart/form-data.</Message><RequestId>1BD4C1A789889BA4</RequestId><HostId>9i/ZNBBvYD+KKoHBRUU6/9uqu/0XvFkNmvBiiLhn/hEZXOes/xVRrHim//JC9mmi</HostId></Error>
@@ -0,0 +1,5 @@
1
+ HTTP/1.1 401 Unauthorized
2
+ Status: 401
3
+ Content-Type: application/json; charset=utf-8
4
+
5
+ { HTTP Digest: "Access denied." }
@@ -0,0 +1,5 @@
1
+ HTTP/1.1 404 Not Found
2
+ Status: 404
3
+ Content-Type: text/html; charset=utf-8
4
+
5
+ <h1>Not Found</h1>
@@ -0,0 +1,30 @@
1
+ HTTP/1.1 404 Not Found
2
+ Status: 404
3
+ Content-Type: text/html; charset=utf-8
4
+
5
+ <!DOCTYPE html>
6
+ <html>
7
+ <head>
8
+ <title>The page you were looking for doesn't exist (404)</title>
9
+ <style type="text/css">
10
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
11
+ div.dialog {
12
+ width: 25em;
13
+ padding: 0 4em;
14
+ margin: 4em auto 0 auto;
15
+ border: 1px solid #ccc;
16
+ border-right-color: #999;
17
+ border-bottom-color: #999;
18
+ }
19
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
20
+ </style>
21
+ </head>
22
+
23
+ <body>
24
+ <!-- This file lives in public/404.html -->
25
+ <div class="dialog">
26
+ <h1>The page you were looking for doesn't exist.</h1>
27
+ <p>You may have mistyped the address or the page may have moved.</p>
28
+ </div>
29
+ </body>
30
+ </html>
@@ -0,0 +1,5 @@
1
+ HTTP/1.1 422
2
+ Status: 422
3
+ Content-Type: application/json; charset=utf-8
4
+
5
+ ["URL can't be blank"]
@@ -0,0 +1,5 @@
1
+ HTTP/1.1 422
2
+ Status: 422
3
+ Content-Type: application/json; charset=utf-8
4
+
5
+ [["URL can't be blank"]]
metadata CHANGED
@@ -2,12 +2,12 @@
2
2
  name: cloudapp_api
3
3
  version: !ruby/object:Gem::Version
4
4
  hash: 19
5
- prerelease:
5
+ prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 2
9
- - 2
10
- version: 0.2.2
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Aaron Russell
@@ -15,10 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-03 00:00:00 Z
18
+ date: 2011-05-08 00:00:00 +01:00
19
+ default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ requirement: &id001 !ruby/object:Gem::Requirement
22
23
  none: false
23
24
  requirements:
24
25
  - - ">="
@@ -29,12 +30,12 @@ dependencies:
29
30
  - 6
30
31
  - 0
31
32
  version: 0.6.0
33
+ type: :runtime
32
34
  name: httparty
33
35
  prerelease: false
34
- type: :runtime
35
- requirement: *id001
36
+ version_requirements: *id001
36
37
  - !ruby/object:Gem::Dependency
37
- version_requirements: &id002 !ruby/object:Gem::Requirement
38
+ requirement: &id002 !ruby/object:Gem::Requirement
38
39
  none: false
39
40
  requirements:
40
41
  - - ">="
@@ -43,12 +44,12 @@ dependencies:
43
44
  segments:
44
45
  - 0
45
46
  version: "0"
47
+ type: :runtime
46
48
  name: mime-types
47
49
  prerelease: false
48
- type: :runtime
49
- requirement: *id002
50
+ version_requirements: *id002
50
51
  - !ruby/object:Gem::Dependency
51
- version_requirements: &id003 !ruby/object:Gem::Requirement
52
+ requirement: &id003 !ruby/object:Gem::Requirement
52
53
  none: false
53
54
  requirements:
54
55
  - - ~>
@@ -59,12 +60,12 @@ dependencies:
59
60
  - 1
60
61
  - 0
61
62
  version: 2.1.0
63
+ type: :development
62
64
  name: rspec
63
65
  prerelease: false
64
- type: :development
65
- requirement: *id003
66
+ version_requirements: *id003
66
67
  - !ruby/object:Gem::Dependency
67
- version_requirements: &id004 !ruby/object:Gem::Requirement
68
+ requirement: &id004 !ruby/object:Gem::Requirement
68
69
  none: false
69
70
  requirements:
70
71
  - - ">="
@@ -73,12 +74,12 @@ dependencies:
73
74
  segments:
74
75
  - 0
75
76
  version: "0"
77
+ type: :development
76
78
  name: fakeweb
77
79
  prerelease: false
78
- type: :development
79
- requirement: *id004
80
+ version_requirements: *id004
80
81
  - !ruby/object:Gem::Dependency
81
- version_requirements: &id005 !ruby/object:Gem::Requirement
82
+ requirement: &id005 !ruby/object:Gem::Requirement
82
83
  none: false
83
84
  requirements:
84
85
  - - ~>
@@ -89,12 +90,12 @@ dependencies:
89
90
  - 6
90
91
  - 0
91
92
  version: 0.6.0
93
+ type: :development
92
94
  name: yard
93
95
  prerelease: false
94
- type: :development
95
- requirement: *id005
96
+ version_requirements: *id005
96
97
  - !ruby/object:Gem::Dependency
97
- version_requirements: &id006 !ruby/object:Gem::Requirement
98
+ requirement: &id006 !ruby/object:Gem::Requirement
98
99
  none: false
99
100
  requirements:
100
101
  - - ">="
@@ -103,12 +104,12 @@ dependencies:
103
104
  segments:
104
105
  - 0
105
106
  version: "0"
107
+ type: :development
106
108
  name: bluecloth
107
109
  prerelease: false
108
- type: :development
109
- requirement: *id006
110
+ version_requirements: *id006
110
111
  - !ruby/object:Gem::Dependency
111
- version_requirements: &id007 !ruby/object:Gem::Requirement
112
+ requirement: &id007 !ruby/object:Gem::Requirement
112
113
  none: false
113
114
  requirements:
114
115
  - - ">="
@@ -117,12 +118,12 @@ dependencies:
117
118
  segments:
118
119
  - 0
119
120
  version: "0"
121
+ type: :development
120
122
  name: cucumber
121
123
  prerelease: false
122
- type: :development
123
- requirement: *id007
124
+ version_requirements: *id007
124
125
  - !ruby/object:Gem::Dependency
125
- version_requirements: &id008 !ruby/object:Gem::Requirement
126
+ requirement: &id008 !ruby/object:Gem::Requirement
126
127
  none: false
127
128
  requirements:
128
129
  - - ~>
@@ -133,12 +134,12 @@ dependencies:
133
134
  - 0
134
135
  - 0
135
136
  version: 1.0.0
137
+ type: :development
136
138
  name: bundler
137
139
  prerelease: false
138
- type: :development
139
- requirement: *id008
140
+ version_requirements: *id008
140
141
  - !ruby/object:Gem::Dependency
141
- version_requirements: &id009 !ruby/object:Gem::Requirement
142
+ requirement: &id009 !ruby/object:Gem::Requirement
142
143
  none: false
143
144
  requirements:
144
145
  - - ~>
@@ -149,12 +150,12 @@ dependencies:
149
150
  - 5
150
151
  - 1
151
152
  version: 1.5.1
153
+ type: :development
152
154
  name: jeweler
153
155
  prerelease: false
154
- type: :development
155
- requirement: *id009
156
+ version_requirements: *id009
156
157
  - !ruby/object:Gem::Dependency
157
- version_requirements: &id010 !ruby/object:Gem::Requirement
158
+ requirement: &id010 !ruby/object:Gem::Requirement
158
159
  none: false
159
160
  requirements:
160
161
  - - ">="
@@ -163,12 +164,12 @@ dependencies:
163
164
  segments:
164
165
  - 0
165
166
  version: "0"
167
+ type: :development
166
168
  name: rcov
167
169
  prerelease: false
168
- type: :development
169
- requirement: *id010
170
+ version_requirements: *id010
170
171
  - !ruby/object:Gem::Dependency
171
- version_requirements: &id011 !ruby/object:Gem::Requirement
172
+ requirement: &id011 !ruby/object:Gem::Requirement
172
173
  none: false
173
174
  requirements:
174
175
  - - ">="
@@ -179,12 +180,12 @@ dependencies:
179
180
  - 6
180
181
  - 0
181
182
  version: 0.6.0
183
+ type: :runtime
182
184
  name: httparty
183
185
  prerelease: false
184
- type: :runtime
185
- requirement: *id011
186
+ version_requirements: *id011
186
187
  - !ruby/object:Gem::Dependency
187
- version_requirements: &id012 !ruby/object:Gem::Requirement
188
+ requirement: &id012 !ruby/object:Gem::Requirement
188
189
  none: false
189
190
  requirements:
190
191
  - - ~>
@@ -195,12 +196,12 @@ dependencies:
195
196
  - 1
196
197
  - 0
197
198
  version: 2.1.0
199
+ type: :development
198
200
  name: rspec
199
201
  prerelease: false
200
- type: :development
201
- requirement: *id012
202
+ version_requirements: *id012
202
203
  - !ruby/object:Gem::Dependency
203
- version_requirements: &id013 !ruby/object:Gem::Requirement
204
+ requirement: &id013 !ruby/object:Gem::Requirement
204
205
  none: false
205
206
  requirements:
206
207
  - - ~>
@@ -211,10 +212,10 @@ dependencies:
211
212
  - 6
212
213
  - 0
213
214
  version: 0.6.0
215
+ type: :development
214
216
  name: yard
215
217
  prerelease: false
216
- type: :development
217
- requirement: *id013
218
+ version_requirements: *id013
218
219
  description: A simple Ruby wrapper for the CloudApp API. Uses HTTParty with a simple ActiveResource-like interface.
219
220
  email: aaron@gc4.co.uk
220
221
  executables: []
@@ -241,6 +242,7 @@ files:
241
242
  - lib/cloudapp/gift_card.rb
242
243
  - lib/cloudapp/httparty.rb
243
244
  - lib/cloudapp/multipart.rb
245
+ - lib/cloudapp/response_error.rb
244
246
  - lib/cloudapp_api.rb
245
247
  - spec/cloudapp_account_spec.rb
246
248
  - spec/cloudapp_api_spec.rb
@@ -248,6 +250,7 @@ files:
248
250
  - spec/cloudapp_drop_spec.rb
249
251
  - spec/cloudapp_gift_card_spec.rb
250
252
  - spec/cloudapp_item_spec.rb
253
+ - spec/cloudapp_response_error_spec.rb
251
254
  - spec/fakeweb_helper.rb
252
255
  - spec/spec_helper.rb
253
256
  - spec/stubs/account/create
@@ -262,8 +265,15 @@ files:
262
265
  - spec/stubs/drop/show
263
266
  - spec/stubs/drop/show-private
264
267
  - spec/stubs/drop/update
268
+ - spec/stubs/error/400
269
+ - spec/stubs/error/401
270
+ - spec/stubs/error/404-find
271
+ - spec/stubs/error/404-update
272
+ - spec/stubs/error/422-bookmark
273
+ - spec/stubs/error/422-bookmarks
265
274
  - spec/stubs/gift_card/redeem
266
275
  - spec/stubs/gift_card/show
276
+ has_rdoc: true
267
277
  homepage: http://github.com/aaronrussell/cloud_app
268
278
  licenses: []
269
279
 
@@ -293,7 +303,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
293
303
  requirements: []
294
304
 
295
305
  rubyforge_project:
296
- rubygems_version: 1.7.2
306
+ rubygems_version: 1.3.7
297
307
  signing_key:
298
308
  specification_version: 3
299
309
  summary: A simple Ruby wrapper for the CloudApp API. Uses HTTParty with a simple ActiveResource-like interface.
@@ -304,5 +314,6 @@ test_files:
304
314
  - spec/cloudapp_drop_spec.rb
305
315
  - spec/cloudapp_gift_card_spec.rb
306
316
  - spec/cloudapp_item_spec.rb
317
+ - spec/cloudapp_response_error_spec.rb
307
318
  - spec/fakeweb_helper.rb
308
319
  - spec/spec_helper.rb