quickbooks-ruby 1.0.10 → 1.0.15

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: a187ff994f94701f0af739a2e2512ffe8e743da2cd5d010bf8052310878b9975
4
- data.tar.gz: d6ada45be6703b4b208ba7c0d61be2eb99809273ea3be2ff3d96adec15dc49d3
3
+ metadata.gz: 34c5ae36bb0924e9eab8bac65c7ac8ef5236161edb322d80ec2207462dbe201b
4
+ data.tar.gz: 981540d32d1f1475c64eb245e2db55cf8deecd90d8c833f0e6ca49d088918ac1
5
5
  SHA512:
6
- metadata.gz: b844255a399c96a721ab04ad83afcf6793f981d54abb080a577abef4103aa96ed41df4549e8310e68746743b00c27def3816539cceb739b639d4dfce594f62ee
7
- data.tar.gz: cd6e5821e956088e9bd4aa8afed320de6537be673edde3643dc688186d0ae59623f01a7a1e52ca7321341e9dbb6191cef3f50b634064c3266a29d20b7ae85605
6
+ metadata.gz: 6772f883351ea430a82da2766bbc1650eeacb2dbe10dac132af7963b62032f0b41d544ecc999a982562c5bc496b25b32be959aa6e06f49cef9c301926be22c09
7
+ data.tar.gz: 4d0e431683ebd48a4a5fd5c643896fcde01626bf46a4767af08481d7bca47eaac01132ac3deffd747f603ac3f2f6d9d39c53b3531f454bc9503c28fce32b9714
@@ -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'
@@ -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.")
@@ -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,7 +38,7 @@ 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
+ next value if value.to_s.match(/^\d+$|^\d+\.\d+$|^-\d+$|^-\d+\.\d+$|^\.\d+$/).nil?
42
42
  BigDecimal(value)
43
43
  end
44
44
  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
@@ -23,7 +23,8 @@ module Quickbooks
23
23
  def disconnect
24
24
  conn = Faraday.new
25
25
  conn.basic_auth oauth.client.id, oauth.client.secret
26
- response = conn.post(DISCONNECT_URL, token: oauth.refresh_token || oauth.token)
26
+ url = "#{DISCONNECT_URL}?minorversion=#{Quickbooks.minorversion}"
27
+ response = conn.post(url, token: oauth.refresh_token || oauth.token)
27
28
 
28
29
  if response.success?
29
30
  Quickbooks::Model::AccessTokenResponse.new(error_code: "0")
@@ -83,7 +83,7 @@ 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)}&minorversion=#{Quickbooks.minorversion}"
86
+ "#{url_for_base}/query?query=#{CGI.escape(query)}"
87
87
  end
88
88
 
89
89
  private
@@ -229,6 +229,8 @@ module Quickbooks
229
229
  body['file_metadata_0'] = param_part
230
230
  end
231
231
 
232
+ url = add_query_string_to_url(url, {})
233
+
232
234
  do_http(:upload, url, body, headers)
233
235
  end
234
236
 
@@ -292,7 +294,9 @@ module Quickbooks
292
294
  @oauth.post_with_multipart(url, headers: headers, body: body, raise_errors: false)
293
295
  end
294
296
 
295
- def add_query_string_to_url(url, params)
297
+ def add_query_string_to_url(url, params = {})
298
+ params ||= {}
299
+ params['minorversion'] = Quickbooks.minorversion
296
300
  if params.is_a?(Hash) && !params.empty?
297
301
  keyvalues = params.collect { |k| "#{k.first}=#{k.last}" }.join("&")
298
302
  delim = url.index("?") != nil ? "&" : "?"
@@ -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
@@ -8,7 +8,7 @@ module Quickbooks
8
8
 
9
9
  def create(entity, options = {})
10
10
  raise Quickbooks::InvalidModelException.new(entity.errors.full_messages.join(',')) unless entity.valid?
11
- response = do_http(:post, url_for_resource(model.resource_for_singular), entity.to_json, options)
11
+ response = do_http_post(url_for_resource(model.resource_for_singular), entity.to_json, options)
12
12
  if response.code.to_i == 200
13
13
  JSON.parse(response.plain_body)
14
14
  else
@@ -1,5 +1,5 @@
1
1
  module Quickbooks
2
2
 
3
- VERSION = "1.0.10"
3
+ VERSION = "1.0.15"
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.10
4
+ version: 1.0.15
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-11 00:00:00.000000000 Z
11
+ date: 2021-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -98,44 +98,44 @@ dependencies:
98
98
  name: simplecov
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 0.7.1
103
+ version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 0.7.1
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rr
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 1.0.2
117
+ version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 1.0.2
124
+ version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rspec
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
- version: '3.9'
131
+ version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
- version: '3.9'
138
+ version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: webmock
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -154,16 +154,16 @@ dependencies:
154
154
  name: dotenv
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - '='
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
- version: 2.2.1
159
+ version: '0'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - '='
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
- version: 2.2.1
166
+ version: '0'
167
167
  description: QBO V3 REST API to Quickbooks Online
168
168
  email: toolbag@gmail.com
169
169
  executables: []
@@ -249,6 +249,7 @@ files:
249
249
  - lib/quickbooks/model/physical_address.rb
250
250
  - lib/quickbooks/model/preferences.rb
251
251
  - lib/quickbooks/model/purchase.rb
252
+ - lib/quickbooks/model/purchase_change.rb
252
253
  - lib/quickbooks/model/purchase_line_item.rb
253
254
  - lib/quickbooks/model/purchase_order.rb
254
255
  - lib/quickbooks/model/purchase_tax_rate_list.rb
@@ -313,6 +314,7 @@ files:
313
314
  - lib/quickbooks/service/payment_method.rb
314
315
  - lib/quickbooks/service/preferences.rb
315
316
  - lib/quickbooks/service/purchase.rb
317
+ - lib/quickbooks/service/purchase_change.rb
316
318
  - lib/quickbooks/service/purchase_order.rb
317
319
  - lib/quickbooks/service/refund_receipt.rb
318
320
  - lib/quickbooks/service/refund_receipt_change.rb
@@ -345,7 +347,7 @@ homepage: http://github.com/ruckus/quickbooks-ruby
345
347
  licenses:
346
348
  - MIT
347
349
  metadata: {}
348
- post_install_message:
350
+ post_install_message:
349
351
  rdoc_options: []
350
352
  require_paths:
351
353
  - lib
@@ -360,9 +362,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
360
362
  - !ruby/object:Gem::Version
361
363
  version: '0'
362
364
  requirements: []
363
- rubyforge_project:
364
- rubygems_version: 2.7.8
365
- signing_key:
365
+ rubyforge_project:
366
+ rubygems_version: 2.7.6.2
367
+ signing_key:
366
368
  specification_version: 4
367
369
  summary: REST API to Quickbooks Online
368
370
  test_files: []