quickbooks-ruby 1.0.8 → 1.0.9
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 +9 -0
- data/lib/quickbooks/model/account.rb +0 -1
- data/lib/quickbooks/model/customer.rb +0 -2
- data/lib/quickbooks/model/invoice.rb +0 -1
- data/lib/quickbooks/model/item.rb +0 -1
- data/lib/quickbooks/model/preferences.rb +0 -1
- data/lib/quickbooks/model/purchase_order.rb +0 -1
- data/lib/quickbooks/service/account.rb +0 -5
- data/lib/quickbooks/service/base_service.rb +1 -1
- data/lib/quickbooks/service/customer.rb +1 -11
- data/lib/quickbooks/service/invoice.rb +1 -10
- data/lib/quickbooks/service/item.rb +1 -11
- data/lib/quickbooks/service/preferences.rb +0 -5
- data/lib/quickbooks/util/query_builder.rb +6 -5
- data/lib/quickbooks/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 375f9daba794fd0b93b4fde2b81e668f480a6957b44f17cdfb040ca184a1678b
|
4
|
+
data.tar.gz: aca82b6f6dbdd8efd18b649cfb37360588a7d08f5834cac395f0714f62454d9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd4e12e405534be10ff030540645495c396f5f0d9238e261880584cf13418ce6642a7e8a59a0b1d7d0f5be97fdf50aee9f0f7339fc14b2ef593d610545c1b92b
|
7
|
+
data.tar.gz: 9c424fa4c473994139630bc131a1c58905e09aa16fae6b6dec2df9a17b8efdef1a55046518b9d5d0a7ffe532c281dbb81fdf16ee04cde39893ced168467b56f4
|
data/lib/quickbooks-ruby.rb
CHANGED
@@ -191,6 +191,7 @@ Faraday::Middleware.register_middleware :gzip => lambda { Gzip }
|
|
191
191
|
module Quickbooks
|
192
192
|
@@sandbox_mode = false
|
193
193
|
@@logger = nil
|
194
|
+
@@minorversion = 47
|
194
195
|
|
195
196
|
class << self
|
196
197
|
def sandbox_mode
|
@@ -201,6 +202,14 @@ module Quickbooks
|
|
201
202
|
@@sandbox_mode = sandbox_mode
|
202
203
|
end
|
203
204
|
|
205
|
+
def minorversion=(v)
|
206
|
+
@@minorversion = v
|
207
|
+
end
|
208
|
+
|
209
|
+
def minorversion
|
210
|
+
@@minorversion
|
211
|
+
end
|
212
|
+
|
204
213
|
def logger
|
205
214
|
@@logger ||= ::Logger.new($stdout) # TODO: replace with a real log file
|
206
215
|
end
|
@@ -7,11 +7,6 @@ module Quickbooks
|
|
7
7
|
update(account, :sparse => true)
|
8
8
|
end
|
9
9
|
|
10
|
-
def url_for_query(query = nil, start_position = 1, max_results = 20, options = {})
|
11
|
-
url = super(query, start_position, max_results, options)
|
12
|
-
"#{url}&minorversion=#{Quickbooks::Model::Account::MINORVERSION}"
|
13
|
-
end
|
14
|
-
|
15
10
|
private
|
16
11
|
|
17
12
|
def model
|
@@ -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)}"
|
86
|
+
"#{url_for_base}/query?query=#{CGI.escape(query)}&minorversion=#{Quickbooks.minorversion}"
|
87
87
|
end
|
88
88
|
|
89
89
|
private
|
@@ -7,21 +7,11 @@ module Quickbooks
|
|
7
7
|
update(customer, :sparse => true)
|
8
8
|
end
|
9
9
|
|
10
|
-
def url_for_resource(resource)
|
11
|
-
url = super(resource)
|
12
|
-
"#{url}?minorversion=#{Quickbooks::Model::Customer::MINORVERSION}"
|
13
|
-
end
|
14
|
-
|
15
10
|
def fetch_by_id(id, params = {})
|
16
|
-
url = "#{url_for_base}/customer/#{id}
|
11
|
+
url = "#{url_for_base}/customer/#{id}"
|
17
12
|
fetch_object(model, url, params)
|
18
13
|
end
|
19
14
|
|
20
|
-
def url_for_query(query = nil, start_position = 1, max_results = 20, options = {})
|
21
|
-
url = super(query, start_position, max_results, options)
|
22
|
-
"#{url}&minorversion=#{Quickbooks::Model::Customer::MINORVERSION}"
|
23
|
-
end
|
24
|
-
|
25
15
|
private
|
26
16
|
|
27
17
|
def model
|
@@ -6,20 +6,11 @@ module Quickbooks
|
|
6
6
|
delete_by_query_string(invoice)
|
7
7
|
end
|
8
8
|
|
9
|
-
def url_for_resource(resource)
|
10
|
-
url = super(resource)
|
11
|
-
end
|
12
|
-
|
13
9
|
def fetch_by_id(id, params = {})
|
14
|
-
url = "#{url_for_base}/invoice/#{id}
|
10
|
+
url = "#{url_for_base}/invoice/#{id}"
|
15
11
|
fetch_object(model, url, params)
|
16
12
|
end
|
17
13
|
|
18
|
-
def url_for_query(query = nil, start_position = 1, max_results = 20, options = {})
|
19
|
-
url = super(query, start_position, max_results, options)
|
20
|
-
"#{url}&minorversion=#{Quickbooks::Model::Invoice::MINORVERSION}"
|
21
|
-
end
|
22
|
-
|
23
14
|
def send(invoice, email_address=nil)
|
24
15
|
query = email_address.present? ? "?sendTo=#{email_address}" : ""
|
25
16
|
url = "#{url_for_resource(model::REST_RESOURCE)}/#{invoice.id}/send#{query}"
|
@@ -7,21 +7,11 @@ module Quickbooks
|
|
7
7
|
update(item, :sparse => true)
|
8
8
|
end
|
9
9
|
|
10
|
-
def url_for_resource(resource)
|
11
|
-
url = super(resource)
|
12
|
-
"#{url}?minorversion=#{Quickbooks::Model::Item::MINORVERSION}"
|
13
|
-
end
|
14
|
-
|
15
10
|
def fetch_by_id(id, params = {})
|
16
|
-
url = "#{url_for_base}/item/#{id}
|
11
|
+
url = "#{url_for_base}/item/#{id}"
|
17
12
|
fetch_object(model, url, params)
|
18
13
|
end
|
19
14
|
|
20
|
-
def url_for_query(query = nil, start_position = 1, max_results = 20, options = {})
|
21
|
-
url = super(query, start_position, max_results, options)
|
22
|
-
"#{url}&minorversion=#{Quickbooks::Model::Item::MINORVERSION}"
|
23
|
-
end
|
24
|
-
|
25
15
|
private
|
26
16
|
|
27
17
|
def model
|
@@ -2,11 +2,6 @@ module Quickbooks
|
|
2
2
|
module Service
|
3
3
|
class Preferences < BaseService
|
4
4
|
|
5
|
-
def url_for_query(query = nil, start_position = 1, max_results = 20, options = {})
|
6
|
-
url = super(query, start_position, max_results, options)
|
7
|
-
"#{url}&minorversion=#{Quickbooks::Model::Preferences::MINORVERSION}"
|
8
|
-
end
|
9
|
-
|
10
5
|
private
|
11
6
|
|
12
7
|
def model
|
@@ -10,26 +10,27 @@ module Quickbooks
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def clause(field, operator, value)
|
13
|
+
# replace with an escaped backslash
|
14
|
+
escape_single_quotes = -> field { field.to_s.gsub("'", "\\\\'") }
|
15
|
+
|
13
16
|
value = case value
|
14
17
|
when DateTime, Time
|
15
18
|
value.iso8601
|
16
19
|
when Date
|
17
20
|
value.strftime('%Y-%m-%d')
|
18
21
|
when Array
|
19
|
-
value = value.map
|
22
|
+
value = value.map(&escape_single_quotes)
|
20
23
|
else
|
21
|
-
|
22
|
-
value = value.gsub("'", "\\\\'")
|
24
|
+
value = escape_single_quotes.call(value)
|
23
25
|
end
|
24
26
|
|
25
27
|
if operator.downcase == 'in' && value.is_a?(Array)
|
26
|
-
value = value.map{|v| "#{VALUE_QUOTE}#{v}#{VALUE_QUOTE}"}
|
28
|
+
value = value.map { |v| "#{VALUE_QUOTE}#{v}#{VALUE_QUOTE}" }
|
27
29
|
"#{field} #{operator} (#{value.join(', ')})"
|
28
30
|
else
|
29
31
|
"#{field} #{operator} #{VALUE_QUOTE}#{value}#{VALUE_QUOTE}"
|
30
32
|
end
|
31
33
|
end
|
32
|
-
|
33
34
|
end
|
34
35
|
end
|
35
36
|
end
|
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Caughlan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth2
|