quickbooks-ruby 1.0.20 → 1.0.21
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fef9e529bfa1fb897b03273cad08ac6fe1fe45c30667f655a3a44dddaa36d10a
|
4
|
+
data.tar.gz: 5dfe60a549caac7c0ecefd10b9ea3396916bccc440e3011ed804d1e02308cbdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 797e5336baeec1e26e813d9975f1721f187f72cff7abcfd87f01fef579d9669b686af0fd31a3812150365a99388fe69b074d0b6ed8fb5ed3437afc1d4ee49b2e
|
7
|
+
data.tar.gz: 15c7ffea9da64f530709637aec045c3b2d235216a08cf197b86a9597820083810525674781e28e2299508a6b58758a487d7c8b42f0eb25f4ae50c0a3034ed373
|
@@ -28,6 +28,8 @@ module Quickbooks
|
|
28
28
|
|
29
29
|
xml_accessor :currency_ref, :from => 'CurrencyRef', :as => BaseReference
|
30
30
|
xml_accessor :exchange_rate, :from => 'ExchangeRate', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
31
|
+
|
32
|
+
xml_accessor :linked_transactions, :from => 'LinkedTxn', :as => [LinkedTransaction]
|
31
33
|
|
32
34
|
reference_setters
|
33
35
|
|
@@ -248,11 +248,7 @@ module Quickbooks
|
|
248
248
|
headers['Accept-Encoding'] = HTTP_ACCEPT_ENCODING
|
249
249
|
end
|
250
250
|
|
251
|
-
|
252
|
-
log "METHOD = #{method}"
|
253
|
-
log "RESOURCE = #{url}"
|
254
|
-
log_request_body(body)
|
255
|
-
log "REQUEST HEADERS = #{headers.inspect}"
|
251
|
+
log_request(method, url, body, headers)
|
256
252
|
|
257
253
|
request_info = RequestInfo.new(url, headers, body, method)
|
258
254
|
before_request.call(request_info) if before_request
|
@@ -273,12 +269,8 @@ module Quickbooks
|
|
273
269
|
after_request.call(request_info, raw_response.body) if after_request
|
274
270
|
|
275
271
|
response = Quickbooks::Service::Responses::OAuthHttpResponse.wrap(raw_response)
|
276
|
-
|
277
|
-
|
278
|
-
log_response_body(response)
|
279
|
-
if response.respond_to?(:headers)
|
280
|
-
log "RESPONSE HEADERS = #{response.headers}"
|
281
|
-
end
|
272
|
+
log_response(response)
|
273
|
+
|
282
274
|
check_response(response, request: body)
|
283
275
|
end
|
284
276
|
|
@@ -354,28 +346,29 @@ module Quickbooks
|
|
354
346
|
end
|
355
347
|
end
|
356
348
|
|
357
|
-
def
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
349
|
+
def log_request(method, url, body, headers)
|
350
|
+
messages = []
|
351
|
+
messages << "------ QUICKBOOKS-RUBY REQUEST ------"
|
352
|
+
messages << "METHOD = #{method}"
|
353
|
+
messages << "RESOURCE = #{url}"
|
354
|
+
messages.concat(request_body_messages(body))
|
355
|
+
messages << "REQUEST HEADERS = #{headers.inspect}"
|
356
|
+
|
357
|
+
log_multiple(messages)
|
366
358
|
end
|
367
359
|
|
368
|
-
def
|
369
|
-
|
360
|
+
def request_body_messages(body)
|
361
|
+
messages = []
|
362
|
+
messages << "REQUEST BODY:"
|
370
363
|
if is_json?
|
371
|
-
|
364
|
+
messages << body.inspect
|
372
365
|
elsif is_pdf?
|
373
|
-
|
366
|
+
messages << "BODY is a PDF : not dumping"
|
374
367
|
else
|
375
368
|
#multipart request for uploads arrive here in a Hash with UploadIO vals
|
376
369
|
if body.is_a?(Hash)
|
377
370
|
body.each do |k,v|
|
378
|
-
|
371
|
+
messages << 'BODY PART:'
|
379
372
|
val_content = v.inspect
|
380
373
|
if v.is_a?(UploadIO)
|
381
374
|
if v.content_type == 'application/xml'
|
@@ -384,12 +377,37 @@ module Quickbooks
|
|
384
377
|
end
|
385
378
|
end
|
386
379
|
end
|
387
|
-
|
380
|
+
messages << "#{k}: #{val_content}"
|
388
381
|
end
|
389
382
|
else
|
390
|
-
|
383
|
+
messages << log_xml(body)
|
391
384
|
end
|
392
385
|
end
|
386
|
+
messages
|
387
|
+
end
|
388
|
+
|
389
|
+
def log_response(response)
|
390
|
+
messages = []
|
391
|
+
messages << "------ QUICKBOOKS-RUBY RESPONSE ------"
|
392
|
+
messages << "RESPONSE CODE = #{response.code}"
|
393
|
+
messages.concat(response_body_messages(response))
|
394
|
+
messages << "RESPONSE HEADERS = #{response.headers}" if response.respond_to?(:headers)
|
395
|
+
|
396
|
+
log_multiple(messages)
|
397
|
+
end
|
398
|
+
|
399
|
+
def response_body_messages(response)
|
400
|
+
messages = []
|
401
|
+
messages << "RESPONSE BODY:"
|
402
|
+
if is_json?
|
403
|
+
messages << ">>>>#{response.plain_body.inspect}"
|
404
|
+
elsif is_pdf?
|
405
|
+
messages << "BODY is a PDF : not dumping"
|
406
|
+
else
|
407
|
+
messages << log_xml(response.plain_body)
|
408
|
+
end
|
409
|
+
|
410
|
+
messages
|
393
411
|
end
|
394
412
|
|
395
413
|
def parse_and_raise_exception(options = {})
|
@@ -19,6 +19,12 @@ module Quickbooks
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
def pdf(payment)
|
23
|
+
url = "#{url_for_resource(model::REST_RESOURCE)}/#{payment.id}/pdf"
|
24
|
+
response = do_http_raw_get(url, {}, {'Accept' => 'application/pdf'})
|
25
|
+
response.plain_body
|
26
|
+
end
|
27
|
+
|
22
28
|
private
|
23
29
|
|
24
30
|
def model
|
@@ -5,10 +5,22 @@ module Quickbooks
|
|
5
5
|
::Quickbooks.log(msg)
|
6
6
|
end
|
7
7
|
|
8
|
+
def log_multiple(messages)
|
9
|
+
if condense_logs?
|
10
|
+
log(messages.join("\n"))
|
11
|
+
else
|
12
|
+
messages.each(&method(:log))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
8
16
|
def log?
|
9
17
|
::Quickbooks.log?
|
10
18
|
end
|
11
19
|
|
20
|
+
def condense_logs?
|
21
|
+
::Quickbooks.condense_logs?
|
22
|
+
end
|
23
|
+
|
12
24
|
def log_xml(str)
|
13
25
|
if ::Quickbooks.log_xml_pretty_print? && !(str and str.empty?)
|
14
26
|
Nokogiri::XML(str).to_xml
|
data/lib/quickbooks/version.rb
CHANGED
data/lib/quickbooks-ruby.rb
CHANGED
@@ -230,13 +230,18 @@ module Quickbooks
|
|
230
230
|
end
|
231
231
|
|
232
232
|
# set logging on or off
|
233
|
-
attr_writer :log, :log_xml_pretty_print
|
233
|
+
attr_writer :log, :log_xml_pretty_print, :condense_logs
|
234
234
|
|
235
235
|
# Returns whether to log. Defaults to 'false'.
|
236
236
|
def log?
|
237
237
|
@log ||= false
|
238
238
|
end
|
239
239
|
|
240
|
+
# Returns whether to limit log lines
|
241
|
+
def condense_logs?
|
242
|
+
@condense_logs ||= false
|
243
|
+
end
|
244
|
+
|
240
245
|
# pretty printing the xml in the logs is "on" by default
|
241
246
|
def log_xml_pretty_print?
|
242
247
|
defined?(@log_xml_pretty_print) ? @log_xml_pretty_print : true
|
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: 1.0.
|
4
|
+
version: 1.0.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Caughlan
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth2
|
@@ -375,7 +375,7 @@ homepage: http://github.com/ruckus/quickbooks-ruby
|
|
375
375
|
licenses:
|
376
376
|
- MIT
|
377
377
|
metadata: {}
|
378
|
-
post_install_message:
|
378
|
+
post_install_message:
|
379
379
|
rdoc_options: []
|
380
380
|
require_paths:
|
381
381
|
- lib
|
@@ -390,9 +390,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
390
390
|
- !ruby/object:Gem::Version
|
391
391
|
version: '0'
|
392
392
|
requirements: []
|
393
|
-
rubyforge_project:
|
393
|
+
rubyforge_project:
|
394
394
|
rubygems_version: 2.7.6.2
|
395
|
-
signing_key:
|
395
|
+
signing_key:
|
396
396
|
specification_version: 4
|
397
397
|
summary: REST API to Quickbooks Online
|
398
398
|
test_files: []
|