quickbooks-ruby 1.0.22 → 1.0.24

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
  SHA256:
3
- metadata.gz: c0585f4ea094b51b56185bb41a2561c8ac7d23f447a52e58859e2ba9729ba6c1
4
- data.tar.gz: 8162ad28904da7934146e3870c068d5cec80bd396209c5247746d19646a452fa
3
+ metadata.gz: 4d1813766ca37fe161babf9afc01d1ee20eabb6e52a65dbc5f9d5d535a1ab0e6
4
+ data.tar.gz: 75e3fa238c73483049a1f5ea0e87b51d71d9a800d5199c7c27fd3f07069a6092
5
5
  SHA512:
6
- metadata.gz: f4cedaedd4ae5acd80f31469a60698a8bbee57e13be5646baaa726268b0e11dc864814ec204dee9d98da8043b6cf5838f8c305b7e08e81cde593574979ef36f6
7
- data.tar.gz: 8ba452ae4365df500e8408ac7079759d18e90799ba3c5a2d580f7e566c34bb9ddded4cec6d460e4377a05e105a185e7aa3848f8fd98b9c395f96e338b54ad14c
6
+ metadata.gz: 526fb65758bd681ff76f3b63fe078af62479e1568b185131fd08b0a5ddd72e6ce635cf7bf705ee466a41b4f60060c1fe171ccece7e6148ba33d59b785a4b5493
7
+ data.tar.gz: 390e88df2ac26d751fb85b6d888cf28227b6d2a706984ea70a5a9aaec0fa2fa003eff9ae11fe53d79a423a03a952a6d6b5d7bf211126a48fc22a52632822716a
@@ -19,7 +19,7 @@ module Quickbooks
19
19
  PREFERENCE_SECTIONS = {
20
20
  :accounting_info => %w(TrackDepartments DepartmentTerminology ClassTrackingPerTxnLine? ClassTrackingPerTxn? CustomerTerminology),
21
21
  :product_and_services => %w(ForSales? ForPurchase? QuantityWithPriceAndRate? QuantityOnHand?),
22
- :vendor_and_purchase => %w(TrackingByCustomer? BillableExpenseTracking? DefaultTerms? DefaultMarkup? POCustomField),
22
+ :vendor_and_purchases => %w(TrackingByCustomer? BillableExpenseTracking? DefaultTerms? DefaultMarkup? POCustomField),
23
23
  :time_tracking => %w(UseServices? BillCustomers? ShowBillRateToAll WorkWeekStartDate MarkTimeEntiresBillable?),
24
24
  :tax => %w(UsingSalesTax? PartnerTaxEnabled?),
25
25
  :currency => %w(MultiCurrencyEnabled? HomeCurrency),
@@ -83,7 +83,11 @@ module Quickbooks
83
83
  query ||= default_model_query
84
84
  query = "#{query} STARTPOSITION #{start_position} MAXRESULTS #{max_results}"
85
85
 
86
- "#{url_for_base}/query?query=#{CGI.escape(query)}"
86
+ URI("#{url_for_base}/query").tap do |uri|
87
+ params = Faraday::Utils::ParamsHash.new
88
+ params.update(options.merge(query: query))
89
+ uri.query = params.to_query
90
+ end.to_s
87
91
  end
88
92
 
89
93
  private
@@ -116,7 +120,7 @@ module Quickbooks
116
120
  start_position = ((page - 1) * per_page) + 1 # page=2, per_page=10 then we want to start at 11
117
121
  max_results = per_page
118
122
 
119
- response = do_http_get(url_for_query(query, start_position, max_results))
123
+ response = do_http_get(url_for_query(query, start_position, max_results, options.except(:page, :per_page)))
120
124
 
121
125
  parse_collection(response, model)
122
126
  end
@@ -429,8 +433,6 @@ module Quickbooks
429
433
  begin
430
434
  @last_response_xml.xpath("//xmlns:IntuitResponse/xmlns:Fault")[0] != nil
431
435
  rescue Nokogiri::XML::XPath::SyntaxError => exception
432
- #puts @last_response_xml.to_xml.to_s
433
- #puts "WTF: #{exception.inspect}:#{exception.backtrace.join("\n")}"
434
436
  true
435
437
  end
436
438
  end
@@ -439,20 +441,20 @@ module Quickbooks
439
441
  error = {:message => "", :detail => "", :type => nil, :code => 0, :intuit_tid => @last_response_intuit_tid}
440
442
  fault = @last_response_xml.xpath("//xmlns:IntuitResponse/xmlns:Fault")[0]
441
443
  if fault
442
- error[:type] = fault.attributes['type'].value
444
+ error[:type] = fault.attributes['type'].try(:value)
443
445
 
444
446
  error_element = fault.xpath("//xmlns:Error")[0]
445
447
  if error_element
446
448
  code_attr = error_element.attributes['code']
447
449
  if code_attr
448
- error[:code] = code_attr.value
450
+ error[:code] = code_attr.try(:value)
449
451
  end
450
452
  element_attr = error_element.attributes['element']
451
453
  if element_attr
452
- error[:element] = code_attr.value
454
+ error[:element] = code_attr.try(:value)
453
455
  end
454
- error[:message] = error_element.xpath("//xmlns:Message").text
455
- error[:detail] = error_element.xpath("//xmlns:Detail").text
456
+ error[:message] = error_element.xpath("//xmlns:Message").try(:text)
457
+ error[:detail] = error_element.xpath("//xmlns:Detail").try(:text)
456
458
  end
457
459
  end
458
460
 
@@ -2,7 +2,7 @@ module Quickbooks
2
2
  module Service
3
3
  class ChangeService < BaseService
4
4
 
5
- def url_for_query(query = nil, start_position = 1, max_results = 20)
5
+ def url_for_query(query = nil, start_position = 1, max_results = 20, options = {})
6
6
  q = entity
7
7
  q = "#{q}&#{query}" if query.present?
8
8
 
@@ -6,6 +6,12 @@ module Quickbooks
6
6
  delete_by_query_string(refund_receipt)
7
7
  end
8
8
 
9
+ def pdf(refund_receipt)
10
+ url = "#{url_for_resource(model::REST_RESOURCE)}/#{refund_receipt.id}/pdf"
11
+ response = do_http_raw_get(url, {}, {'Accept' => 'application/pdf'})
12
+ response.plain_body
13
+ end
14
+
9
15
  private
10
16
 
11
17
  def model
@@ -1,5 +1,5 @@
1
1
  module Quickbooks
2
2
 
3
- VERSION = "1.0.22"
3
+ VERSION = "1.0.24"
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: 1.0.22
4
+ version: 1.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Caughlan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-12 00:00:00.000000000 Z
11
+ date: 2025-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -390,7 +390,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
390
390
  - !ruby/object:Gem::Version
391
391
  version: '0'
392
392
  requirements: []
393
- rubygems_version: 3.0.3.1
393
+ rubygems_version: 3.1.6
394
394
  signing_key:
395
395
  specification_version: 4
396
396
  summary: REST API to Quickbooks Online