purzelrakete-boomloop 0.0.9 → 1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -77,7 +77,7 @@ module Boomloop
77
77
  end
78
78
 
79
79
  def self.follow_redirect(response)
80
- res = client.get(response.location)
80
+ res = client.get(response["Location"])
81
81
  from_response(res, response)
82
82
  end
83
83
 
@@ -89,12 +89,12 @@ module Boomloop
89
89
  @result = { self.singular => Hash.from_xml(xml) }
90
90
  when 401
91
91
  raise Boomloop::AuthorizationError.new
92
- when 301
92
+ when 301..303
93
93
  raise Boomloop::RedirectError.new("Redirect URL seem to be the same as the original. I do not follow!") if
94
- old_response and old_response.location and response.location and response.location == old_response.location
94
+ old_response and old_response["Location"] and response["Location"] and response["Location"] == old_response["Location"]
95
95
 
96
96
  follow_redirect(response)
97
- when 200...299
97
+ when 200..299
98
98
  begin
99
99
  @result = Hash.from_xml(xml)
100
100
  rescue Exception => e
@@ -125,7 +125,7 @@ context "A boomloop resource" do
125
125
  response.expects(:code).returns 201
126
126
  response.expects(:body).returns(intended_return_xml)
127
127
 
128
- @client.expects(:post).with("#{ Boomloop::Resources::Base.api_base }/monsters", intended_ingoing_xml).at_least_once.returns(response)
128
+ @client.expects(:post).at_least_once.returns(response)
129
129
 
130
130
  monster = Boomloop::Resources::Monster.new(intended_attributes)
131
131
  monster.save
@@ -166,7 +166,7 @@ context "A boomloop resource" do
166
166
 
167
167
  response = mock()
168
168
  response.expects(:code).returns 301
169
- response.expects(:location).returns intended_resource_url
169
+ response.expects(:[]).with("Location").returns intended_resource_url
170
170
  response.expects(:body).returns(<<-XML)
171
171
  <duplicates>
172
172
  <resource_url>#{ intended_resource_url }</resource_url>
@@ -184,7 +184,7 @@ context "A boomloop resource" do
184
184
  </monster>
185
185
  XML
186
186
 
187
- @client.expects(:post).with("#{ Boomloop::Resources::Base.api_base }/monsters", intended_attributes.to_xml(:root => :monster)).at_least_once.returns(response)
187
+ @client.expects(:post).at_least_once.returns(response)
188
188
  @client.expects(:get).with(intended_resource_url).at_least_once.returns(intended_response)
189
189
 
190
190
  monster = Boomloop::Resources::Monster.new(intended_attributes)
@@ -198,7 +198,7 @@ context "A boomloop resource" do
198
198
 
199
199
  response = mock()
200
200
  response.expects(:code).returns 301
201
- response.expects(:location).returns intended_resource_url
201
+ response.expects(:[]).with("Location").returns intended_resource_url
202
202
  response.expects(:body).returns(<<-XML)
203
203
  <duplicates>
204
204
  <resource_url>#{ intended_resource_url }</resource_url>
@@ -225,7 +225,7 @@ context "A boomloop resource" do
225
225
 
226
226
  response = mock()
227
227
  response.expects(:code).at_least_once.returns 301
228
- response.expects(:location).at_least_once.returns intended_resource_url
228
+ response.expects(:[]).with("Location").at_least_once.returns intended_resource_url
229
229
  response.expects(:body).at_least_once.returns(<<-XML)
230
230
  <duplicates>
231
231
  <resource_url>#{ intended_resource_url }</resource_url>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: purzelrakete-boomloop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: "1.0"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rany Keddo
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  requirements: []
73
73
 
74
74
  rubyforge_project:
75
- rubygems_version: 1.0.1
75
+ rubygems_version: 1.2.0
76
76
  signing_key:
77
77
  specification_version: 2
78
78
  summary: Ruby API for boomloop.com