amee 2.0.29 → 2.0.30
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/lib/amee/connection.rb +6 -6
- metadata +2 -2
data/lib/amee/connection.rb
CHANGED
@@ -172,23 +172,23 @@ module AMEE
|
|
172
172
|
response.code == '301' || response.code == '302'
|
173
173
|
end
|
174
174
|
|
175
|
-
def response_ok?(response)
|
175
|
+
def response_ok?(response, request)
|
176
176
|
case response.code
|
177
177
|
when '200', '201'
|
178
178
|
return true
|
179
179
|
when '403'
|
180
|
-
raise AMEE::PermissionDenied.new("You do not have permission to perform the requested operation.
|
180
|
+
raise AMEE::PermissionDenied.new("You do not have permission to perform the requested operation.\nRequest: #{request.method} #{request.path}\n#{request.body}\Response: #{response.body}")
|
181
181
|
when '401'
|
182
182
|
authenticate
|
183
183
|
return false
|
184
184
|
when '400'
|
185
185
|
if response.body.include? "would have resulted in a duplicate resource being created"
|
186
|
-
raise AMEE::DuplicateResource.new("The specified resource already exists. This is most often caused by creating an item that overlaps another in time.
|
186
|
+
raise AMEE::DuplicateResource.new("The specified resource already exists. This is most often caused by creating an item that overlaps another in time.\nRequest: #{request.method} #{request.path}\n#{request.body}\Response: #{response.body}")
|
187
187
|
else
|
188
|
-
raise AMEE::UnknownError.new("An error occurred while talking to AMEE: HTTP response code #{response.code}.
|
188
|
+
raise AMEE::UnknownError.new("An error occurred while talking to AMEE: HTTP response code #{response.code}.\nRequest: #{request.method} #{request.path}\n#{request.body}\Response: #{response.body}")
|
189
189
|
end
|
190
190
|
else
|
191
|
-
raise AMEE::UnknownError.new("An error occurred while talking to AMEE: HTTP response code #{response.code}.
|
191
|
+
raise AMEE::UnknownError.new("An error occurred while talking to AMEE: HTTP response code #{response.code}.\nRequest: #{request.method} #{request.path}\n#{request.body}\Response: #{response.body}")
|
192
192
|
end
|
193
193
|
end
|
194
194
|
|
@@ -198,7 +198,7 @@ module AMEE
|
|
198
198
|
# Do request
|
199
199
|
begin
|
200
200
|
response = send_request(request, format)
|
201
|
-
end while !response_ok?(response)
|
201
|
+
end while !response_ok?(response, request)
|
202
202
|
# Return response
|
203
203
|
return response
|
204
204
|
rescue SocketError
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Smith
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11
|
12
|
+
date: 2009-12-11 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|