citygrid_api 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/citygrid_api.gemspec +2 -2
- data/lib/citygrid/api.rb +7 -5
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.14
|
data/citygrid_api.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "citygrid_api"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.14"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Elpizo Choi"]
|
12
|
-
s.date = "2012-05-
|
12
|
+
s.date = "2012-05-18"
|
13
13
|
s.description = "Ruby wrapper for CityGrid APIs"
|
14
14
|
s.email = "fu7iin@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/citygrid/api.rb
CHANGED
@@ -168,11 +168,12 @@ class CityGrid
|
|
168
168
|
# Sanitized request for logs
|
169
169
|
safe_req_options = strip_unsafe_params(http_method, req_options)
|
170
170
|
req_to_output = HTTParty::Request.new http_method, path, safe_req_options
|
171
|
+
req_for_airbrake = { :method => http_method, :path => path, :options => safe_req_options }
|
171
172
|
|
172
173
|
begin
|
173
174
|
response = req.perform
|
174
175
|
rescue => ex
|
175
|
-
raise CityGridExceptions::RequestError.new
|
176
|
+
raise CityGridExceptions::RequestError.new req_for_airbrake, ex
|
176
177
|
ensure
|
177
178
|
if CityGrid.print_curls?
|
178
179
|
if defined?(Rails.logger)
|
@@ -183,15 +184,16 @@ class CityGrid
|
|
183
184
|
end
|
184
185
|
end
|
185
186
|
|
187
|
+
|
186
188
|
begin
|
187
189
|
# catch unparsable responses (html etc)
|
188
190
|
if !response.parsed_response.is_a?(Hash)
|
189
191
|
#pp "[gem] the response was unparsable (response was not a hash)"
|
190
|
-
raise CityGridExceptions::ResponseParseError.new
|
192
|
+
raise CityGridExceptions::ResponseParseError.new req_for_airbrake, response
|
191
193
|
# catch responses not in new response format
|
192
194
|
elsif response["errors"]
|
193
195
|
#pp "[gem] An error in the old response format was caught. Raising a general response error..."
|
194
|
-
raise CityGridExceptions::ResponseError.new
|
196
|
+
raise CityGridExceptions::ResponseError.new req_for_airbrake, response["errors"], response
|
195
197
|
|
196
198
|
# Parse and handle new response codes
|
197
199
|
elsif (response["response"] && response["response"]["code"] != "SUCCESS") &&
|
@@ -202,7 +204,7 @@ class CityGrid
|
|
202
204
|
#pp response
|
203
205
|
#pp "found error code: #{error_code}"
|
204
206
|
#pp "****************************************************************************"
|
205
|
-
raise CityGridExceptions.appropriate_error(error_code).new
|
207
|
+
raise CityGridExceptions.appropriate_error(error_code).new req_for_airbrake, response, response["response"]["message"].to_s #+ " " + CityGridExceptions.print_superclasses(error_code)
|
206
208
|
# if the response is a nested hash/nested hash containing arrays
|
207
209
|
elsif response["totalNumEntries"] && response["response"].nil?
|
208
210
|
#pp "[gem] now parsing a response with multiple entries: #{response}"
|
@@ -215,7 +217,7 @@ class CityGrid
|
|
215
217
|
return CityGrid::API::Response.new response
|
216
218
|
else
|
217
219
|
#pp "[gem] we found an error and it was #{error_code[1]}"
|
218
|
-
raise CityGridExceptions.appropriate_error(error_code[0]).new
|
220
|
+
raise CityGridExceptions.appropriate_error(error_code[0]).new req_for_airbrake, response, error_code[1].to_s + " "# + CityGridExceptions.print_superclasses(error_code[0])
|
219
221
|
end
|
220
222
|
else
|
221
223
|
return CityGrid::API::Response.new response
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: citygrid_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.14
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Elpizo Choi
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-05-
|
13
|
+
date: 2012-05-18 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: httparty
|