quickbooks-ruby 1.0.11 → 2.0

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: 59f6b50352335b6f8142b4b2e6ab4f3057104998119ff634f436bbf64e5009d4
4
- data.tar.gz: c6b0639561b040957fcef550fc6e117d0f3327f522c3ec8fc87edb622ef23523
3
+ metadata.gz: cc115bc7b925447fecb75976b448e66406441c9fd56208e964ac34844fdcd37a
4
+ data.tar.gz: fd1ca0b526c14cdadda7a1e276c3dcedb9b8c68e7c76be0aa074df30c63e0382
5
5
  SHA512:
6
- metadata.gz: e27ca054b8ad9281542eebcfa83fdcc6ec7a3855b7afc54fe2bb62d0981de4b1ef840b6e77ba11c164f6092263d6aa3e752b7fe0e3fc79baa747cc559a0e07cc
7
- data.tar.gz: 0b354dd455d03cf7625f9ac0fd8cae75e928aa52bc3e5edaf2ca5a4bea5b148cef9ef0122430c360bc1e14b6130cc57e30b84caaac7c13dd2293bac8fa0ba23d
6
+ metadata.gz: ce9c6d1732ab2d6ffd2a9ea57c2dad7f091867bb9af828a8bb25140f79a7d739cccd4f59d9b45665ec500d50241e2fbd65c833f4f307d71ba84543cdaec71725
7
+ data.tar.gz: 9bd4d94b4270280b142d93c3ee9bff0b579d4009fc5afe9a217404d201df6e74ea6db8a7fc5b33e48f16e919ea6716bd77f5aeb4e362421db659d1d9f8ac0bf4
@@ -7,6 +7,7 @@ module Quickbooks
7
7
  xml_accessor :billable_status, :from => 'BillableStatus'
8
8
  xml_accessor :tax_amount, :from => 'UnitPrice', :as => BigDecimal, :to_xml => to_xml_big_decimal
9
9
  xml_accessor :tax_code_ref, :from => 'TaxCodeRef', :as => BaseReference
10
+ xml_accessor :tax_inclusive_amount, from: 'TaxInclusiveAmt', to_xml: Proc.new { |val| val.to_f }
10
11
 
11
12
  reference_setters :customer_ref, :class_ref, :account_ref, :tax_code_ref
12
13
 
@@ -31,6 +31,7 @@ module Quickbooks
31
31
  xml_accessor :due_date, :from => 'DueDate', :as => Date
32
32
  xml_accessor :remit_to_address, :from => 'RemitToAddr', :as => PhysicalAddress
33
33
  xml_accessor :ship_address, :from => 'ShipAddr', :as => PhysicalAddress
34
+ xml_accessor :mailing_address, :from => 'VendorAddr', :as => PhysicalAddress
34
35
  xml_accessor :exchange_rate, :from => 'ExchangeRate', :as => BigDecimal, :to_xml => to_xml_big_decimal
35
36
  xml_accessor :balance, :from => 'Balance', :as => BigDecimal, :to_xml => to_xml_big_decimal
36
37
 
@@ -12,6 +12,8 @@ module Quickbooks
12
12
  xml_accessor :amount, :from => 'Amount', :as => BigDecimal, :to_xml => to_xml_big_decimal
13
13
  xml_accessor :detail_type, :from => 'DetailType'
14
14
 
15
+ xml_accessor :linked_transactions, :from => 'LinkedTxn', :as => [LinkedTransaction]
16
+
15
17
  #== Various detail types
16
18
  xml_accessor :account_based_expense_line_detail, :from => 'AccountBasedExpenseLineDetail', :as => AccountBasedExpenseLineDetail
17
19
  xml_accessor :item_based_expense_line_detail, :from => 'ItemBasedExpenseLineDetail', :as => ItemBasedExpenseLineDetail
@@ -56,6 +56,7 @@ module Quickbooks
56
56
  xml_accessor :tax_exemption_reason_id, :from => 'TaxExemptionReasonId'
57
57
  xml_accessor :primary_tax_identifier, :from => 'PrimaryTaxIdentifier'
58
58
  xml_accessor :customer_type_ref, :from => 'CustomerTypeRef', :as => BaseReference
59
+ xml_accessor :isproject?, :from => 'IsProject'
59
60
 
60
61
  #== Validations
61
62
  validate :names_cannot_contain_invalid_characters
@@ -36,6 +36,7 @@ module Quickbooks
36
36
  xml_accessor :customer_memo, :from => 'CustomerMemo'
37
37
  xml_accessor :billing_address, :from => 'BillAddr', :as => PhysicalAddress
38
38
  xml_accessor :shipping_address, :from => 'ShipAddr', :as => PhysicalAddress
39
+ xml_accessor :ship_from_address, :from => 'ShipFromAddr', :as => PhysicalAddress
39
40
  xml_accessor :class_ref, :from => 'ClassRef', :as => BaseReference
40
41
  xml_accessor :sales_term_ref, :from => 'SalesTermRef', :as => BaseReference
41
42
  xml_accessor :due_date, :from => 'DueDate', :as => Date
@@ -59,6 +60,7 @@ module Quickbooks
59
60
  xml_accessor :allow_online_credit_card_payment?, :from => 'AllowOnlineCreditCardPayment'
60
61
  xml_accessor :allow_online_ach_payment?, :from => 'AllowOnlineACHPayment'
61
62
  xml_accessor :deposit_to_account_ref, :from => 'DepositToAccountRef', :as => BaseReference
63
+ xml_accessor :bill_email_cc, :from => 'BillEmailCc', :as => EmailAddress
62
64
 
63
65
 
64
66
  reference_setters
@@ -87,6 +89,9 @@ module Quickbooks
87
89
  self.bill_email = EmailAddress.new(email_address_string)
88
90
  end
89
91
 
92
+ def billing_email_cc_address=(email_address_string)
93
+ self.bill_email_cc = EmailAddress.new(email_address_string)
94
+ end
90
95
 
91
96
  def wants_billing_email_sent!
92
97
  self.email_status = EMAIL_STATUS_NEED_TO_SEND
@@ -96,7 +101,6 @@ module Quickbooks
96
101
  email_status == EMAIL_STATUS_NEED_TO_SEND
97
102
  end
98
103
 
99
-
100
104
  def existence_of_customer_ref
101
105
  if customer_ref.nil? || (customer_ref && customer_ref.value == 0)
102
106
  errors.add(:customer_ref, "CustomerRef is required and must be a non-zero value.")
@@ -13,6 +13,7 @@ module Quickbooks
13
13
  xml_accessor :tax_code_ref, :from => 'TaxCodeRef', :as => BaseReference
14
14
  xml_accessor :customer_ref, :from => 'CustomerRef', :as => BaseReference
15
15
  xml_accessor :billable_status, :from => 'BillableStatus'
16
+ xml_accessor :tax_inclusive_amount, from: 'TaxInclusiveAmt', to_xml: Proc.new { |val| val.to_f }
16
17
 
17
18
  reference_setters :item_ref, :class_ref, :price_level_ref, :customer_ref, :tax_code_ref
18
19
  end
@@ -0,0 +1,7 @@
1
+ module Quickbooks
2
+ module Model
3
+ class PurchaseChange < ChangeModel
4
+ XML_NODE = "Purchase"
5
+ end
6
+ end
7
+ end
@@ -24,10 +24,11 @@ module Quickbooks
24
24
  xml_accessor :attachable_ref, :from => 'AttachableRef', :as => BaseReference
25
25
  xml_accessor :vendor_ref, :from => 'VendorRef', :as => BaseReference
26
26
  xml_accessor :ap_account_ref, :from => 'APAccountRef', :as => BaseReference
27
+ xml_accessor :po_email, from: "POEmail", as: EmailAddress
27
28
  xml_accessor :class_ref, :from => 'ClassRef', :as => BaseReference
28
29
  xml_accessor :sales_term_ref, :from => 'SalesTermRef', :as => BaseReference
29
30
 
30
- xml_accessor :total, :from => 'TotalAmt', :as => BigDecimal, :to_xml => Proc.new { |val| val.to_f }
31
+ xml_accessor :total, :from => 'TotalAmt', :as => BigDecimal, :to_xml => to_xml_big_decimal
31
32
  xml_accessor :due_date, :from => 'DueDate', :as => Date
32
33
  xml_accessor :vendor_address, :from => 'VendorAddr', :as => PhysicalAddress
33
34
  xml_accessor :ship_address, :from => 'ShipAddr', :as => PhysicalAddress
@@ -38,9 +38,20 @@ module Quickbooks
38
38
  value = el.attr('value')
39
39
 
40
40
  next nil if value.blank?
41
- next value if value.to_s.match(/^\d+$|^\d+\.\d+$|^-\d+|^-\d+\.\d+$|^\.\d+$/).nil?
41
+
42
+ parse_row_value(value)
43
+ end
44
+ end
45
+
46
+ def parse_row_value(value)
47
+ # does it look like a number?
48
+ if value =~ /\A\-?[0-9\.]+\Z/
42
49
  BigDecimal(value)
50
+ else
51
+ value
43
52
  end
53
+ rescue ArgumentError
54
+ value
44
55
  end
45
56
 
46
57
  end
@@ -9,6 +9,7 @@ module Quickbooks
9
9
  xml_accessor :quantity, :from => 'Qty', :as => BigDecimal, :to_xml => Proc.new { |val| val.to_f }
10
10
  xml_accessor :tax_code_ref, :from => 'TaxCodeRef', :as => BaseReference
11
11
  xml_accessor :service_date, :from => 'ServiceDate', :as => Date
12
+ xml_accessor :tax_inclusive_amount, from: 'TaxInclusiveAmt', to_xml: Proc.new { |val| val.to_f }
12
13
 
13
14
  reference_setters :item_ref, :class_ref, :price_level_ref, :tax_code_ref
14
15
  end
@@ -1,9 +1,9 @@
1
1
  module Quickbooks
2
2
  module Model
3
3
  class TransactionTaxDetail < BaseModel
4
-
5
4
  xml_accessor :txn_tax_code_ref, :from => 'TxnTaxCodeRef', :as => BaseReference
6
5
  xml_accessor :total_tax, :from => 'TotalTax', :as => BigDecimal, :to_xml => to_xml_big_decimal
6
+ xml_accessor :total_tax_specified, :from => 'TotalTaxSpecified'
7
7
  xml_accessor :lines, :from => 'TaxLine', :as => [TaxLine]
8
8
 
9
9
  reference_setters :txn_tax_code_ref
@@ -41,6 +41,7 @@ module Quickbooks
41
41
  xml_accessor :account_number, :from => 'AcctNum'
42
42
  xml_accessor :is_1099?, :from => 'Vendor1099'
43
43
  xml_accessor :currency_ref, :from => 'CurrencyRef', :as => BaseReference
44
+ xml_accessor :bill_rate, from: "BillRate", as: BigDecimal, to_xml: to_xml_big_decimal
44
45
 
45
46
  #== Validations
46
47
  validate :names_cannot_contain_invalid_characters
@@ -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
 
@@ -1,7 +1,6 @@
1
1
  module Quickbooks
2
2
  module Service
3
3
  class AccessToken < BaseService
4
-
5
4
  RENEW_URL = "https://appcenter.intuit.com/api/v1/connection/reconnect"
6
5
  DISCONNECT_URL = "https://developer.api.intuit.com/v2/oauth2/tokens/revoke"
7
6
 
@@ -21,10 +20,15 @@ module Quickbooks
21
20
 
22
21
  # https://developer.intuit.com/docs/0025_quickbooksapi/0053_auth_auth/oauth_management_api#Disconnect
23
22
  def disconnect
24
- conn = Faraday.new
25
- conn.basic_auth oauth.client.id, oauth.client.secret
23
+ connection = Faraday.new(headers: { 'Content-Type' => 'application/json' }) do |f|
24
+ f.adapter(::Quickbooks.http_adapter)
25
+ f.request(:authorization, :basic, oauth.client.id, oauth.client.secret)
26
+ end
27
+
26
28
  url = "#{DISCONNECT_URL}?minorversion=#{Quickbooks.minorversion}"
27
- response = conn.post(url, token: oauth.refresh_token || oauth.token)
29
+ response = connection.post(url) do |request|
30
+ request.body = JSON.generate({ token: oauth.refresh_token || oauth.token })
31
+ end
28
32
 
29
33
  if response.success?
30
34
  Quickbooks::Model::AccessTokenResponse.new(error_code: "0")
@@ -49,12 +49,11 @@ module Quickbooks
49
49
  # [OAuth2] The default Faraday connection does not have gzip or multipart support.
50
50
  # We need to reset the existing connection and build a new one.
51
51
  def rebuild_connection!
52
- @oauth.client.connection = nil
53
- @oauth.client.connection.build do |builder|
54
- builder.use :gzip
55
- builder.request :multipart
56
- builder.request :url_encoded
57
- builder.adapter :net_http
52
+ @oauth.client.connection = Faraday.new do |f|
53
+ f.request :multipart
54
+ f.request :gzip
55
+ f.request :url_encoded
56
+ f.adapter ::Quickbooks.http_adapter
58
57
  end
59
58
  end
60
59
 
@@ -248,11 +247,7 @@ module Quickbooks
248
247
  headers['Accept-Encoding'] = HTTP_ACCEPT_ENCODING
249
248
  end
250
249
 
251
- log "------ QUICKBOOKS-RUBY REQUEST ------"
252
- log "METHOD = #{method}"
253
- log "RESOURCE = #{url}"
254
- log_request_body(body)
255
- log "REQUEST HEADERS = #{headers.inspect}"
250
+ log_request(method, url, body, headers)
256
251
 
257
252
  request_info = RequestInfo.new(url, headers, body, method)
258
253
  before_request.call(request_info) if before_request
@@ -273,12 +268,8 @@ module Quickbooks
273
268
  after_request.call(request_info, raw_response.body) if after_request
274
269
 
275
270
  response = Quickbooks::Service::Responses::OAuthHttpResponse.wrap(raw_response)
276
- log "------ QUICKBOOKS-RUBY RESPONSE ------"
277
- log "RESPONSE CODE = #{response.code}"
278
- log_response_body(response)
279
- if response.respond_to?(:headers)
280
- log "RESPONSE HEADERS = #{response.headers}"
281
- end
271
+ log_response(response)
272
+
282
273
  check_response(response, request: body)
283
274
  end
284
275
 
@@ -354,28 +345,29 @@ module Quickbooks
354
345
  end
355
346
  end
356
347
 
357
- def log_response_body(response)
358
- log "RESPONSE BODY:"
359
- if is_json?
360
- log ">>>>#{response.plain_body.inspect}"
361
- elsif is_pdf?
362
- log("BODY is a PDF : not dumping")
363
- else
364
- log(log_xml(response.plain_body))
365
- end
348
+ def log_request(method, url, body, headers)
349
+ messages = []
350
+ messages << "------ QUICKBOOKS-RUBY REQUEST ------"
351
+ messages << "METHOD = #{method}"
352
+ messages << "RESOURCE = #{url}"
353
+ messages.concat(request_body_messages(body))
354
+ messages << "REQUEST HEADERS = #{headers.inspect}"
355
+
356
+ log_multiple(messages)
366
357
  end
367
358
 
368
- def log_request_body(body)
369
- log "REQUEST BODY:"
359
+ def request_body_messages(body)
360
+ messages = []
361
+ messages << "REQUEST BODY:"
370
362
  if is_json?
371
- log(body.inspect)
363
+ messages << body.inspect
372
364
  elsif is_pdf?
373
- log("BODY is a PDF : not dumping")
365
+ messages << "BODY is a PDF : not dumping"
374
366
  else
375
367
  #multipart request for uploads arrive here in a Hash with UploadIO vals
376
368
  if body.is_a?(Hash)
377
369
  body.each do |k,v|
378
- log('BODY PART:')
370
+ messages << 'BODY PART:'
379
371
  val_content = v.inspect
380
372
  if v.is_a?(UploadIO)
381
373
  if v.content_type == 'application/xml'
@@ -384,12 +376,37 @@ module Quickbooks
384
376
  end
385
377
  end
386
378
  end
387
- log("#{k}: #{val_content}")
379
+ messages << "#{k}: #{val_content}"
388
380
  end
389
381
  else
390
- log(log_xml(body))
382
+ messages << log_xml(body)
391
383
  end
392
384
  end
385
+ messages
386
+ end
387
+
388
+ def log_response(response)
389
+ messages = []
390
+ messages << "------ QUICKBOOKS-RUBY RESPONSE ------"
391
+ messages << "RESPONSE CODE = #{response.code}"
392
+ messages.concat(response_body_messages(response))
393
+ messages << "RESPONSE HEADERS = #{response.headers}" if response.respond_to?(:headers)
394
+
395
+ log_multiple(messages)
396
+ end
397
+
398
+ def response_body_messages(response)
399
+ messages = []
400
+ messages << "RESPONSE BODY:"
401
+ if is_json?
402
+ messages << ">>>>#{response.plain_body.inspect}"
403
+ elsif is_pdf?
404
+ messages << "BODY is a PDF : not dumping"
405
+ else
406
+ messages << log_xml(response.plain_body)
407
+ end
408
+
409
+ messages
393
410
  end
394
411
 
395
412
  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
@@ -0,0 +1,16 @@
1
+ module Quickbooks
2
+ module Service
3
+ class PurchaseChange < ChangeService
4
+
5
+ private
6
+
7
+ def entity
8
+ "Purchase"
9
+ end
10
+
11
+ def model
12
+ Quickbooks::Model::PurchaseChange
13
+ end
14
+ end
15
+ end
16
+ end
@@ -7,13 +7,19 @@ module Quickbooks
7
7
  end
8
8
 
9
9
  def fetch_by_id(id, params = {})
10
- url = "#{url_for_base}/purchaseorder/#{id}?minorversion=#{Quickbooks::Model::PurchaseOrder::MINORVERSION}"
10
+ url = "#{url_for_base}/purchaseorder/#{id}?minorversion=#{Quickbooks.minorversion}"
11
11
  fetch_object(model, url, params)
12
12
  end
13
13
 
14
14
  def url_for_query(query = nil, start_position = 1, max_results = 20, options = {})
15
15
  url = super(query, start_position, max_results, options)
16
- "#{url}&minorversion=#{Quickbooks::Model::PurchaseOrder::MINORVERSION}"
16
+ "#{url}&minorversion=#{Quickbooks.minorversion}"
17
+ end
18
+
19
+ def pdf(purchase_order)
20
+ url = "#{url_for_resource(model::REST_RESOURCE)}/#{purchase_order.id}/pdf"
21
+ response = do_http_raw_get(url, {}, {'Accept' => 'application/pdf'})
22
+ response.plain_body
17
23
  end
18
24
 
19
25
  private
@@ -33,7 +33,10 @@ module Quickbooks
33
33
  if field.class == Symbol
34
34
  field = field.to_s.camelcase
35
35
  end
36
- q = "select * from %s where %s = '%s'" % [model.resource_for_singular, field, selector]
36
+
37
+ clause = Quickbooks::Util::QueryBuilder.new.clause(field, '=', selector)
38
+ q = "select * from %s where %s" % [model.resource_for_singular, clause]
39
+
37
40
  self.query(q, options)
38
41
  end
39
42
 
@@ -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
@@ -20,6 +20,8 @@ module Quickbooks
20
20
  value.strftime('%Y-%m-%d')
21
21
  when Array
22
22
  value = value.map(&escape_single_quotes)
23
+ when true, false
24
+ value
23
25
  else
24
26
  value = escape_single_quotes.call(value)
25
27
  end
@@ -27,6 +29,8 @@ module Quickbooks
27
29
  if operator.downcase == 'in' && value.is_a?(Array)
28
30
  value = value.map { |v| "#{VALUE_QUOTE}#{v}#{VALUE_QUOTE}" }
29
31
  "#{field} #{operator} (#{value.join(', ')})"
32
+ elsif value == true || value == false
33
+ "#{field} #{operator} #{value}"
30
34
  else
31
35
  "#{field} #{operator} #{VALUE_QUOTE}#{value}#{VALUE_QUOTE}"
32
36
  end
@@ -1,5 +1,5 @@
1
1
  module Quickbooks
2
2
 
3
- VERSION = "1.0.11"
3
+ VERSION = "2.0"
4
4
 
5
5
  end
@@ -8,12 +8,13 @@ require 'date'
8
8
  require 'forwardable'
9
9
  require 'oauth2'
10
10
  require 'net/http/post/multipart'
11
+ require 'faraday/multipart'
12
+ require 'faraday/gzip'
11
13
  require 'quickbooks/util/collection'
12
14
  require 'quickbooks/util/logging'
13
15
  require 'quickbooks/util/http_encoding_helper'
14
16
  require 'quickbooks/util/name_entity'
15
17
  require 'quickbooks/util/query_builder'
16
- require 'quickbooks/faraday/middleware/gzip'
17
18
 
18
19
  #== OAuth Responses
19
20
  require 'quickbooks/service/responses/oauth_http_response'
@@ -124,6 +125,7 @@ require 'quickbooks/model/item_change'
124
125
  require 'quickbooks/model/report'
125
126
  require 'quickbooks/model/credit_memo_change'
126
127
  require 'quickbooks/model/payment_change'
128
+ require 'quickbooks/model/purchase_change'
127
129
  require 'quickbooks/model/transfer'
128
130
  require 'quickbooks/model/change_data_capture'
129
131
  require 'quickbooks/model/refund_receipt_change'
@@ -181,17 +183,16 @@ require 'quickbooks/service/item_change'
181
183
  require 'quickbooks/service/reports'
182
184
  require 'quickbooks/service/credit_memo_change'
183
185
  require 'quickbooks/service/payment_change'
186
+ require 'quickbooks/service/purchase_change'
184
187
  require 'quickbooks/service/transfer'
185
188
  require 'quickbooks/service/change_data_capture'
186
189
  require 'quickbooks/service/refund_receipt_change'
187
190
 
188
- # Register Faraday Middleware
189
- Faraday::Middleware.register_middleware :gzip => lambda { Gzip }
190
-
191
191
  module Quickbooks
192
192
  @@sandbox_mode = false
193
193
  @@logger = nil
194
194
  @@minorversion = 47
195
+ @@http_adapter = :net_http
195
196
 
196
197
  class << self
197
198
  def sandbox_mode
@@ -218,14 +219,27 @@ module Quickbooks
218
219
  @@logger = logger
219
220
  end
220
221
 
222
+ def http_adapter
223
+ @@http_adapter
224
+ end
225
+
226
+ def http_adapter=(adapter)
227
+ @@http_adapter = adapter
228
+ end
229
+
221
230
  # set logging on or off
222
- attr_writer :log, :log_xml_pretty_print
231
+ attr_writer :log, :log_xml_pretty_print, :condense_logs
223
232
 
224
233
  # Returns whether to log. Defaults to 'false'.
225
234
  def log?
226
235
  @log ||= false
227
236
  end
228
237
 
238
+ # Returns whether to limit log lines
239
+ def condense_logs?
240
+ @condense_logs ||= false
241
+ end
242
+
229
243
  # pretty printing the xml in the logs is "on" by default
230
244
  def log_xml_pretty_print?
231
245
  defined?(@log_xml_pretty_print) ? @log_xml_pretty_print : true
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quickbooks-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: '2.0'
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: 2020-06-16 00:00:00.000000000 Z
11
+ date: 2022-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - "<"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.4'
19
+ version: '3.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - "<"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.4'
26
+ version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: roxml
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '4.0'
33
+ version: '4.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '4.0'
40
+ version: '4.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activemodel
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '4.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: net-http-persistent
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: nokogiri
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +94,48 @@ dependencies:
80
94
  - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: faraday
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "<"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "<"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: faraday-multipart
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: faraday-gzip
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.1'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.1'
83
139
  - !ruby/object:Gem::Dependency
84
140
  name: rake
85
141
  requirement: !ruby/object:Gem::Requirement
@@ -98,44 +154,44 @@ dependencies:
98
154
  name: simplecov
99
155
  requirement: !ruby/object:Gem::Requirement
100
156
  requirements:
101
- - - '='
157
+ - - ">="
102
158
  - !ruby/object:Gem::Version
103
- version: 0.7.1
159
+ version: '0'
104
160
  type: :development
105
161
  prerelease: false
106
162
  version_requirements: !ruby/object:Gem::Requirement
107
163
  requirements:
108
- - - '='
164
+ - - ">="
109
165
  - !ruby/object:Gem::Version
110
- version: 0.7.1
166
+ version: '0'
111
167
  - !ruby/object:Gem::Dependency
112
168
  name: rr
113
169
  requirement: !ruby/object:Gem::Requirement
114
170
  requirements:
115
- - - "~>"
171
+ - - ">="
116
172
  - !ruby/object:Gem::Version
117
- version: 1.0.2
173
+ version: '0'
118
174
  type: :development
119
175
  prerelease: false
120
176
  version_requirements: !ruby/object:Gem::Requirement
121
177
  requirements:
122
- - - "~>"
178
+ - - ">="
123
179
  - !ruby/object:Gem::Version
124
- version: 1.0.2
180
+ version: '0'
125
181
  - !ruby/object:Gem::Dependency
126
182
  name: rspec
127
183
  requirement: !ruby/object:Gem::Requirement
128
184
  requirements:
129
- - - "~>"
185
+ - - ">="
130
186
  - !ruby/object:Gem::Version
131
- version: '3.9'
187
+ version: '0'
132
188
  type: :development
133
189
  prerelease: false
134
190
  version_requirements: !ruby/object:Gem::Requirement
135
191
  requirements:
136
- - - "~>"
192
+ - - ">="
137
193
  - !ruby/object:Gem::Version
138
- version: '3.9'
194
+ version: '0'
139
195
  - !ruby/object:Gem::Dependency
140
196
  name: webmock
141
197
  requirement: !ruby/object:Gem::Requirement
@@ -154,16 +210,16 @@ dependencies:
154
210
  name: dotenv
155
211
  requirement: !ruby/object:Gem::Requirement
156
212
  requirements:
157
- - - '='
213
+ - - ">="
158
214
  - !ruby/object:Gem::Version
159
- version: 2.2.1
215
+ version: '0'
160
216
  type: :development
161
217
  prerelease: false
162
218
  version_requirements: !ruby/object:Gem::Requirement
163
219
  requirements:
164
- - - '='
220
+ - - ">="
165
221
  - !ruby/object:Gem::Version
166
- version: 2.2.1
222
+ version: '0'
167
223
  description: QBO V3 REST API to Quickbooks Online
168
224
  email: toolbag@gmail.com
169
225
  executables: []
@@ -171,7 +227,6 @@ extensions: []
171
227
  extra_rdoc_files: []
172
228
  files:
173
229
  - lib/quickbooks-ruby.rb
174
- - lib/quickbooks/faraday/middleware/gzip.rb
175
230
  - lib/quickbooks/model/access_token_response.rb
176
231
  - lib/quickbooks/model/account.rb
177
232
  - lib/quickbooks/model/account_based_expense_line_detail.rb
@@ -249,6 +304,7 @@ files:
249
304
  - lib/quickbooks/model/physical_address.rb
250
305
  - lib/quickbooks/model/preferences.rb
251
306
  - lib/quickbooks/model/purchase.rb
307
+ - lib/quickbooks/model/purchase_change.rb
252
308
  - lib/quickbooks/model/purchase_line_item.rb
253
309
  - lib/quickbooks/model/purchase_order.rb
254
310
  - lib/quickbooks/model/purchase_tax_rate_list.rb
@@ -313,6 +369,7 @@ files:
313
369
  - lib/quickbooks/service/payment_method.rb
314
370
  - lib/quickbooks/service/preferences.rb
315
371
  - lib/quickbooks/service/purchase.rb
372
+ - lib/quickbooks/service/purchase_change.rb
316
373
  - lib/quickbooks/service/purchase_order.rb
317
374
  - lib/quickbooks/service/refund_receipt.rb
318
375
  - lib/quickbooks/service/refund_receipt_change.rb
@@ -345,7 +402,7 @@ homepage: http://github.com/ruckus/quickbooks-ruby
345
402
  licenses:
346
403
  - MIT
347
404
  metadata: {}
348
- post_install_message:
405
+ post_install_message:
349
406
  rdoc_options: []
350
407
  require_paths:
351
408
  - lib
@@ -353,16 +410,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
353
410
  requirements:
354
411
  - - ">="
355
412
  - !ruby/object:Gem::Version
356
- version: '0'
413
+ version: '2.6'
357
414
  required_rubygems_version: !ruby/object:Gem::Requirement
358
415
  requirements:
359
416
  - - ">="
360
417
  - !ruby/object:Gem::Version
361
418
  version: '0'
362
419
  requirements: []
363
- rubyforge_project:
364
- rubygems_version: 2.7.8
365
- signing_key:
420
+ rubyforge_project:
421
+ rubygems_version: 2.7.6.2
422
+ signing_key:
366
423
  specification_version: 4
367
424
  summary: REST API to Quickbooks Online
368
425
  test_files: []
@@ -1,74 +0,0 @@
1
- # https://github.com/lostisland/faraday_middleware/blob/master/lib/faraday_middleware/gzip.rb
2
-
3
- require 'faraday'
4
-
5
- # Middleware to automatically decompress response bodies. If the
6
- # "Accept-Encoding" header wasn't set in the request, this sets it to
7
- # "gzip,deflate" and appropriately handles the compressed response from the
8
- # server. This resembles what Ruby 1.9+ does internally in Net::HTTP#get.
9
- #
10
- # This middleware is NOT necessary when these adapters are used:
11
- # - net_http on Ruby 1.9+
12
- # - net_http_persistent on Ruby 2.0+
13
- # - em_http
14
- class Gzip < Faraday::Middleware
15
- dependency 'zlib'
16
-
17
- ACCEPT_ENCODING = 'Accept-Encoding'.freeze
18
- CONTENT_ENCODING = 'Content-Encoding'.freeze
19
- CONTENT_LENGTH = 'Content-Length'.freeze
20
- SUPPORTED_ENCODINGS = 'gzip,deflate,br'.freeze
21
- RUBY_ENCODING = '1.9'.respond_to?(:force_encoding)
22
-
23
- def call(env)
24
- env[:request_headers][ACCEPT_ENCODING] ||= SUPPORTED_ENCODINGS
25
- @app.call(env).on_complete do |response_env|
26
- break if response_env[:response_headers].nil?
27
-
28
- case response_env[:response_headers][CONTENT_ENCODING]
29
- when 'gzip'
30
- reset_body(response_env, &method(:uncompress_gzip))
31
- when 'deflate'
32
- reset_body(response_env, &method(:inflate))
33
- when 'br'
34
- reset_body(response_env, &method(:brotli_inflate))
35
- end
36
- end
37
- end
38
-
39
- def reset_body(env)
40
- env[:body] = yield(env[:body])
41
- env[:response_headers].delete(CONTENT_ENCODING)
42
- env[:response_headers][CONTENT_LENGTH] = env[:body].length
43
- end
44
-
45
- def uncompress_gzip(body)
46
- io = StringIO.new(body)
47
- gzip_reader = if RUBY_ENCODING
48
- Zlib::GzipReader.new(io, :encoding => 'ASCII-8BIT')
49
- else
50
- Zlib::GzipReader.new(io)
51
- end
52
- gzip_reader.read
53
- end
54
-
55
- def inflate(body)
56
- # Inflate as a DEFLATE (RFC 1950+RFC 1951) stream
57
- Zlib::Inflate.inflate(body)
58
- rescue Zlib::DataError
59
- # Fall back to inflating as a "raw" deflate stream which
60
- # Microsoft servers return
61
- inflate = Zlib::Inflate.new(-Zlib::MAX_WBITS)
62
- begin
63
- inflate.inflate(body)
64
- ensure
65
- inflate.close
66
- end
67
- end
68
-
69
- def brotli_inflate(body)
70
- self.class.dependency 'brotli'
71
-
72
- Brotli.inflate(body)
73
- end
74
- end