quickbooks-ruby 1.0.15 → 1.0.19
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 +4 -4
- data/lib/quickbooks/model/account_based_expense_line_detail.rb +1 -0
- data/lib/quickbooks/model/bill_line_item.rb +2 -0
- data/lib/quickbooks/model/customer.rb +1 -0
- data/lib/quickbooks/model/item_based_expense_line_detail.rb +1 -0
- data/lib/quickbooks/model/report.rb +12 -1
- data/lib/quickbooks/model/sales_item_line_detail.rb +1 -0
- data/lib/quickbooks/model/transaction_tax_detail.rb +1 -1
- data/lib/quickbooks/service/access_token.rb +8 -4
- data/lib/quickbooks/service/base_service.rb +1 -1
- data/lib/quickbooks/service/service_crud.rb +4 -1
- data/lib/quickbooks/util/query_builder.rb +4 -0
- data/lib/quickbooks/version.rb +1 -1
- data/lib/quickbooks-ruby.rb +9 -0
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 148ff447b167aedd01e7a5c6659b2f35c596b3fbc5bdcfe31848fcdb6a9b25fd
|
4
|
+
data.tar.gz: a7e0951c0bc2abf8b7af00768316811624ea9d5affe32063507d76cf178576ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83f4e3f6f299c3abb17836c7121179f4e2d39b96028e3734a3a59fbc9251464223d62dcee929b0c8963d35bba0bfb53445e1142e77d979f869c74f7d271bf360
|
7
|
+
data.tar.gz: f2b3327d90e9402edb469bce97d7a4da8c84b4b4b86b07d45f363faff8684b001f60c5085c5bcc1149820b419d42205c74babd0c4149a1819adb9d3345f017de
|
@@ -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
|
|
@@ -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
|
@@ -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
|
@@ -38,9 +38,20 @@ module Quickbooks
|
|
38
38
|
value = el.attr('value')
|
39
39
|
|
40
40
|
next nil if value.blank?
|
41
|
-
|
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
|
@@ -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
|
-
|
25
|
-
|
23
|
+
connection = Faraday.new(headers: { 'Content-Type' => 'application/json' }) do |f|
|
24
|
+
f.adapter(::Quickbooks.http_adapter)
|
25
|
+
f.basic_auth(oauth.client.id, oauth.client.secret)
|
26
|
+
end
|
27
|
+
|
26
28
|
url = "#{DISCONNECT_URL}?minorversion=#{Quickbooks.minorversion}"
|
27
|
-
response =
|
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")
|
@@ -33,7 +33,10 @@ module Quickbooks
|
|
33
33
|
if field.class == Symbol
|
34
34
|
field = field.to_s.camelcase
|
35
35
|
end
|
36
|
-
|
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
|
|
@@ -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
|
data/lib/quickbooks/version.rb
CHANGED
data/lib/quickbooks-ruby.rb
CHANGED
@@ -194,6 +194,7 @@ module Quickbooks
|
|
194
194
|
@@sandbox_mode = false
|
195
195
|
@@logger = nil
|
196
196
|
@@minorversion = 47
|
197
|
+
@@http_adapter = :net_http
|
197
198
|
|
198
199
|
class << self
|
199
200
|
def sandbox_mode
|
@@ -220,6 +221,14 @@ module Quickbooks
|
|
220
221
|
@@logger = logger
|
221
222
|
end
|
222
223
|
|
224
|
+
def http_adapter
|
225
|
+
@@http_adapter
|
226
|
+
end
|
227
|
+
|
228
|
+
def http_adapter=(adapter)
|
229
|
+
@@http_adapter = adapter
|
230
|
+
end
|
231
|
+
|
223
232
|
# set logging on or off
|
224
233
|
attr_writer :log, :log_xml_pretty_print
|
225
234
|
|
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.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Caughlan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth2
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '4.
|
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.
|
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
|