lib/bumeran.rb in bumeran-0.3.1 vs lib/bumeran.rb in bumeran-0.3.2
- old
+ new
@@ -35,10 +35,15 @@
@@access_token_updated_at = nil
mattr_accessor :options
@@options = nil
+ mattr_accessor :last_request
+ mattr_accessor :last_response
+ @@last_request = nil
+ @@last_response = nil
+
@@areas = {}
@@subareas = {}
@@paises = {}
@@zonas = {}
@@localidades = {}
@@ -595,10 +600,12 @@
json.each{|object| hash[object["id"]] ? hash[object["id"]].merge!(object) : hash[object["id"]] = object}
return hash
end
def self.parse_response(response)
+ Bumeran.last_response = response
+ Bumeran.last_request = response.request
case response.code
when 200..201
# "All good!"
return response.body
when 401
@@ -612,9 +619,11 @@
else
raise "Error #{response.code}, unkown response: #{response.request.path}, #{response.body}"
end
end
def self.parse_response_to_json(response)
+ Bumeran.last_response = response
+ Bumeran.last_request = response.request
case response.code
when 200..201
# "All good!"
return JSON.parse(response.body)
when 401