quickbooks-ruby 1.0.12 → 1.0.17
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 +11 -0
- data/lib/quickbooks/model/customer.rb +1 -0
- data/lib/quickbooks/model/invoice.rb +5 -1
- data/lib/quickbooks/model/purchase_change.rb +7 -0
- data/lib/quickbooks/model/purchase_order.rb +2 -1
- data/lib/quickbooks/model/report.rb +12 -1
- data/lib/quickbooks/model/vendor.rb +1 -0
- data/lib/quickbooks/service/access_token.rb +8 -4
- data/lib/quickbooks/service/base_service.rb +1 -1
- data/lib/quickbooks/service/purchase_change.rb +16 -0
- data/lib/quickbooks/service/purchase_order.rb +6 -0
- data/lib/quickbooks/version.rb +1 -1
- metadata +39 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d00435e6aa26f37d76b42d6a00c347da7d2933711d227873b6b388edf6eb414a
|
4
|
+
data.tar.gz: 11a9e8052e7d3881d721c8c1ec8fe557d56d0942f96afe6b6ec510b4cfd1517d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5819adb0f281036ad55ef6d259587ceddffc0d9159db04ec34d5ce66ea1cb85b0c3d82afa6309967f94b3c258c168ad113f2db71ece92d07952126896069098f
|
7
|
+
data.tar.gz: fad37ada44e92bc81f437b8e9b3276bcc5dce68c92f7e85e7e4709b554b48b421ebec5fc08ba98a1935d6d8f7c9c24ae3d6f896fdceac65542e82abea56c6aed
|
data/lib/quickbooks-ruby.rb
CHANGED
@@ -124,6 +124,7 @@ require 'quickbooks/model/item_change'
|
|
124
124
|
require 'quickbooks/model/report'
|
125
125
|
require 'quickbooks/model/credit_memo_change'
|
126
126
|
require 'quickbooks/model/payment_change'
|
127
|
+
require 'quickbooks/model/purchase_change'
|
127
128
|
require 'quickbooks/model/transfer'
|
128
129
|
require 'quickbooks/model/change_data_capture'
|
129
130
|
require 'quickbooks/model/refund_receipt_change'
|
@@ -181,6 +182,7 @@ require 'quickbooks/service/item_change'
|
|
181
182
|
require 'quickbooks/service/reports'
|
182
183
|
require 'quickbooks/service/credit_memo_change'
|
183
184
|
require 'quickbooks/service/payment_change'
|
185
|
+
require 'quickbooks/service/purchase_change'
|
184
186
|
require 'quickbooks/service/transfer'
|
185
187
|
require 'quickbooks/service/change_data_capture'
|
186
188
|
require 'quickbooks/service/refund_receipt_change'
|
@@ -192,6 +194,7 @@ module Quickbooks
|
|
192
194
|
@@sandbox_mode = false
|
193
195
|
@@logger = nil
|
194
196
|
@@minorversion = 47
|
197
|
+
@@http_adapter = :net_http
|
195
198
|
|
196
199
|
class << self
|
197
200
|
def sandbox_mode
|
@@ -218,6 +221,14 @@ module Quickbooks
|
|
218
221
|
@@logger = logger
|
219
222
|
end
|
220
223
|
|
224
|
+
def http_adapter
|
225
|
+
@@http_adapter
|
226
|
+
end
|
227
|
+
|
228
|
+
def http_adapter=(adapter)
|
229
|
+
@@http_adapter = adapter
|
230
|
+
end
|
231
|
+
|
221
232
|
# set logging on or off
|
222
233
|
attr_writer :log, :log_xml_pretty_print
|
223
234
|
|
@@ -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.")
|
@@ -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 =>
|
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
|
-
|
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
|
@@ -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
|
@@ -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")
|
@@ -16,6 +16,12 @@ module Quickbooks
|
|
16
16
|
"#{url}&minorversion=#{Quickbooks.minorversion}"
|
17
17
|
end
|
18
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
|
23
|
+
end
|
24
|
+
|
19
25
|
private
|
20
26
|
|
21
27
|
def model
|
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: 1.0.
|
4
|
+
version: 1.0.17
|
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:
|
11
|
+
date: 2021-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth2
|
@@ -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
|
@@ -98,44 +112,44 @@ dependencies:
|
|
98
112
|
name: simplecov
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- -
|
115
|
+
- - ">="
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0
|
117
|
+
version: '0'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- -
|
122
|
+
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0
|
124
|
+
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: rr
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
|
-
- - "
|
129
|
+
- - ">="
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
131
|
+
version: '0'
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
|
-
- - "
|
136
|
+
- - ">="
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
138
|
+
version: '0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: rspec
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
128
142
|
requirements:
|
129
|
-
- - "
|
143
|
+
- - ">="
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
145
|
+
version: '0'
|
132
146
|
type: :development
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
|
-
- - "
|
150
|
+
- - ">="
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
152
|
+
version: '0'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: webmock
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -154,16 +168,16 @@ dependencies:
|
|
154
168
|
name: dotenv
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
156
170
|
requirements:
|
157
|
-
- -
|
171
|
+
- - ">="
|
158
172
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
173
|
+
version: '0'
|
160
174
|
type: :development
|
161
175
|
prerelease: false
|
162
176
|
version_requirements: !ruby/object:Gem::Requirement
|
163
177
|
requirements:
|
164
|
-
- -
|
178
|
+
- - ">="
|
165
179
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
180
|
+
version: '0'
|
167
181
|
description: QBO V3 REST API to Quickbooks Online
|
168
182
|
email: toolbag@gmail.com
|
169
183
|
executables: []
|
@@ -249,6 +263,7 @@ files:
|
|
249
263
|
- lib/quickbooks/model/physical_address.rb
|
250
264
|
- lib/quickbooks/model/preferences.rb
|
251
265
|
- lib/quickbooks/model/purchase.rb
|
266
|
+
- lib/quickbooks/model/purchase_change.rb
|
252
267
|
- lib/quickbooks/model/purchase_line_item.rb
|
253
268
|
- lib/quickbooks/model/purchase_order.rb
|
254
269
|
- lib/quickbooks/model/purchase_tax_rate_list.rb
|
@@ -313,6 +328,7 @@ files:
|
|
313
328
|
- lib/quickbooks/service/payment_method.rb
|
314
329
|
- lib/quickbooks/service/preferences.rb
|
315
330
|
- lib/quickbooks/service/purchase.rb
|
331
|
+
- lib/quickbooks/service/purchase_change.rb
|
316
332
|
- lib/quickbooks/service/purchase_order.rb
|
317
333
|
- lib/quickbooks/service/refund_receipt.rb
|
318
334
|
- lib/quickbooks/service/refund_receipt_change.rb
|
@@ -345,7 +361,7 @@ homepage: http://github.com/ruckus/quickbooks-ruby
|
|
345
361
|
licenses:
|
346
362
|
- MIT
|
347
363
|
metadata: {}
|
348
|
-
post_install_message:
|
364
|
+
post_install_message:
|
349
365
|
rdoc_options: []
|
350
366
|
require_paths:
|
351
367
|
- lib
|
@@ -360,9 +376,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
360
376
|
- !ruby/object:Gem::Version
|
361
377
|
version: '0'
|
362
378
|
requirements: []
|
363
|
-
rubyforge_project:
|
364
|
-
rubygems_version: 2.7.
|
365
|
-
signing_key:
|
379
|
+
rubyforge_project:
|
380
|
+
rubygems_version: 2.7.6.2
|
381
|
+
signing_key:
|
366
382
|
specification_version: 4
|
367
383
|
summary: REST API to Quickbooks Online
|
368
384
|
test_files: []
|