quickbooks-ruby 0.1.6 → 0.1.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da1eed0bda8ea24f1208cadd17ae3a71d9bb5ad3
4
- data.tar.gz: f722fa73671873c979a30272ebfc34099d454431
3
+ metadata.gz: 370814f06f30b4295a57aa192b80f1e5595f2add
4
+ data.tar.gz: 979ea9f309103e35965164416c43f9fbf012c936
5
5
  SHA512:
6
- metadata.gz: 501c32416df4feab6f5bda98a7228cd43be3a6a49b5ce9571078e023e976cd05bd4e402e53f372fc85adcb909c9b7ba6429fd32f144b8deaad55cbad7c6b1b7a
7
- data.tar.gz: ace357f52b45d67c50483742e9b6499a4f58a8de92fc089075c6fb3685c7b9306f8e9006365ed4fdf93981a700c3ab0fecb7bdeee9ec51cb50f4d10c191f3afc
6
+ metadata.gz: 1e10973a8df8caf229df653080bd515d69efe0e03b94e9e348ac5bb7f31006e5a8676506dabf6c7612cdc955ab88f4e0780ab3fd754a8c1d0cd5c68dd5a3a759
7
+ data.tar.gz: 28fd0719eab709d93f1d3269995d3b65d6762eabe04a004034e119582d1f454bc3453c8a30a232166a8729403b59da3f8884a1c36b0486ec69a3da98599f28a5
@@ -162,6 +162,7 @@ module Quickbooks
162
162
  class InvalidModelException < StandardError; end
163
163
 
164
164
  class AuthorizationFailure < StandardError; end
165
+ class Forbidden < StandardError; end
165
166
 
166
167
  class ServiceUnavailable < StandardError; end
167
168
  class MissingRealmError < StandardError; end
@@ -68,7 +68,7 @@ module Quickbooks
68
68
 
69
69
  # A single object response is the same as a collection response except
70
70
  # it just has a single main element
71
- def fetch_object(model, url, params = {}, options = {})
71
+ def fetch_object(model, url, params = {})
72
72
  raise ArgumentError, "missing model to instantiate" if model.nil?
73
73
  response = do_http_get(url, params)
74
74
  collection = parse_collection(response, model)
@@ -186,6 +186,7 @@ module Quickbooks
186
186
  end
187
187
 
188
188
  def do_http_get(url, params = {}, headers = {}) # throws IntuitRequestException
189
+ url = add_query_string_to_url(url, params)
189
190
  do_http(:get, url, {}, headers)
190
191
  end
191
192
 
@@ -246,11 +247,13 @@ module Quickbooks
246
247
  end
247
248
  when 302
248
249
  raise "Unhandled HTTP Redirect"
249
- when 401, 403
250
+ when 401
250
251
  raise Quickbooks::AuthorizationFailure
252
+ when 403
253
+ raise Quickbooks::Forbidden
251
254
  when 400, 500
252
255
  parse_and_raise_exception(options)
253
- when 503
256
+ when 503, 504
254
257
  raise Quickbooks::ServiceUnavailable
255
258
  else
256
259
  raise "HTTP Error Code: #{status}, Msg: #{response.plain_body}"
@@ -269,6 +272,8 @@ module Quickbooks
269
272
 
270
273
  def response_is_error?
271
274
  @last_response_xml.xpath("//xmlns:IntuitResponse/xmlns:Fault")[0] != nil
275
+ rescue Nokogiri::XML::XPath::SyntaxError => exception
276
+ true
272
277
  end
273
278
 
274
279
  def parse_intuit_error
@@ -288,6 +293,10 @@ module Quickbooks
288
293
  end
289
294
  end
290
295
 
296
+ error
297
+ rescue Nokogiri::XML::XPath::SyntaxError => exception
298
+ error[:detail] = @last_response_xml.to_s
299
+
291
300
  error
292
301
  end
293
302
 
@@ -16,9 +16,9 @@ module Quickbooks
16
16
  end until results.count < per_page
17
17
  end
18
18
 
19
- def fetch_by_id(id, options = {})
19
+ def fetch_by_id(id, params = {})
20
20
  url = "#{url_for_resource(model.resource_for_singular)}/#{id}"
21
- fetch_object(model, url, options)
21
+ fetch_object(model, url, params)
22
22
  end
23
23
 
24
24
  def create(entity, options = {})
@@ -1,5 +1,5 @@
1
1
  module Quickbooks
2
2
 
3
- VERSION = "0.1.6"
3
+ VERSION = "0.1.7"
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quickbooks-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Caughlan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-23 00:00:00.000000000 Z
11
+ date: 2014-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth