quickbooks-ruby 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/quickbooks-ruby.rb +1 -0
- data/lib/quickbooks/service/base_service.rb +12 -3
- data/lib/quickbooks/service/service_crud.rb +2 -2
- data/lib/quickbooks/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 370814f06f30b4295a57aa192b80f1e5595f2add
|
4
|
+
data.tar.gz: 979ea9f309103e35965164416c43f9fbf012c936
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e10973a8df8caf229df653080bd515d69efe0e03b94e9e348ac5bb7f31006e5a8676506dabf6c7612cdc955ab88f4e0780ab3fd754a8c1d0cd5c68dd5a3a759
|
7
|
+
data.tar.gz: 28fd0719eab709d93f1d3269995d3b65d6762eabe04a004034e119582d1f454bc3453c8a30a232166a8729403b59da3f8884a1c36b0486ec69a3da98599f28a5
|
data/lib/quickbooks-ruby.rb
CHANGED
@@ -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 = {}
|
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
|
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,
|
19
|
+
def fetch_by_id(id, params = {})
|
20
20
|
url = "#{url_for_resource(model.resource_for_singular)}/#{id}"
|
21
|
-
fetch_object(model, url,
|
21
|
+
fetch_object(model, url, params)
|
22
22
|
end
|
23
23
|
|
24
24
|
def create(entity, options = {})
|
data/lib/quickbooks/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2014-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth
|