quickbooks-ruby 0.4.0 → 0.4.1

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
  SHA1:
3
- metadata.gz: cd738a2e9e6bfa63ccf460226aa60dfe3688713d
4
- data.tar.gz: e91dc8fc720d196c8075fe706667ec8c6c657e24
3
+ metadata.gz: 290a453c26a079aa3c95a0e752c0cc46f82c870e
4
+ data.tar.gz: b16bf38076576f964387a338a2713265f586490b
5
5
  SHA512:
6
- metadata.gz: c466d28cb539140345cddc3a39bd11678b659c2150d98b6fcf8b8e04640fae6ab028f00de73bc17512a38af3f0baa03715973dc32463c2d475a9348b9a3ada63
7
- data.tar.gz: e2dca1296eedcbf25578ec27e6eae67fd95ec1c382147cc5d554b7a44ddce2aa914be370c51391ad62cb71ddadfc04906e08084cf07f48a3518cfb854cbc8990
6
+ metadata.gz: 04222df97af7cd63abbcd8a111a8b61f646de2f1f1ac21efc8ececf488426b5843b51409fe5107d9819e5dee09c0fcb3d3a2139230394d53f71a65d8e5c0987f
7
+ data.tar.gz: 3df19ee4ed82c414f069a6f572e71fa94e87e28b85fabb3cceeb4ddd62ea0b3543f2cd65046d1ce87c6a40e7f6a09480b3efa1e20101dbacd95f95f6943fda2d
@@ -10,9 +10,10 @@ module Quickbooks
10
10
  XML_COLLECTION_NODE = "Item"
11
11
  XML_NODE = "Item"
12
12
  REST_RESOURCE = 'item'
13
+ MINORVERSION = 4
13
14
 
14
15
  INVENTORY_TYPE = 'Inventory'
15
- NON_INVENTORY_TYPE = 'Non Inventory'
16
+ NON_INVENTORY_TYPE = 'NonInventory'
16
17
  SERVICE_TYPE = 'Service'
17
18
  ITEM_TYPES = [INVENTORY_TYPE, NON_INVENTORY_TYPE, SERVICE_TYPE]
18
19
 
@@ -49,6 +49,10 @@ module Quickbooks
49
49
  self.class::HTTP_CONTENT_TYPE == "application/json"
50
50
  end
51
51
 
52
+ def is_pdf?
53
+ self.class::HTTP_CONTENT_TYPE == "application/pdf"
54
+ end
55
+
52
56
  def default_model_query
53
57
  "SELECT * FROM #{self.class.name.split("::").last}"
54
58
  end
@@ -174,6 +178,20 @@ module Quickbooks
174
178
  do_http(:get, url, {}, headers)
175
179
  end
176
180
 
181
+ def do_http_raw_get(url, params = {}, headers = {})
182
+ url = add_query_string_to_url(url, params)
183
+ unless headers.has_key?('Content-Type')
184
+ headers['Content-Type'] = self.class::HTTP_CONTENT_TYPE
185
+ end
186
+ unless headers.has_key?('Accept')
187
+ headers['Accept'] = self.class::HTTP_ACCEPT
188
+ end
189
+ unless headers.has_key?('Accept-Encoding')
190
+ headers['Accept-Encoding'] = HTTP_ACCEPT_ENCODING
191
+ end
192
+ @oauth.get(url, headers)
193
+ end
194
+
177
195
  def do_http_file_upload(uploadIO, url, metadata = nil)
178
196
  headers = {
179
197
  'Content-Type' => 'multipart/form-data'
@@ -17,6 +17,12 @@ module Quickbooks
17
17
  end
18
18
  end
19
19
 
20
+ def pdf(invoice)
21
+ url = "#{url_for_resource(model::REST_RESOURCE)}/#{invoice.id}/pdf"
22
+ response = do_http_raw_get(url, {}, {'Accept' => 'application/pdf'})
23
+ response.plain_body
24
+ end
25
+
20
26
  private
21
27
 
22
28
  def model
@@ -7,6 +7,16 @@ 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
+ def url_for_query(query = nil, start_position = 1, max_results = 20)
16
+ url = super(query, start_position, max_results)
17
+ "#{url}&minorversion=#{Quickbooks::Model::Item::MINORVERSION}"
18
+ end
19
+
10
20
  private
11
21
 
12
22
  def model
@@ -6,6 +6,12 @@ module Quickbooks
6
6
  delete_by_query_string(sales_receipt)
7
7
  end
8
8
 
9
+ def pdf(sales_receipt)
10
+ url = "#{url_for_resource(model::REST_RESOURCE)}/#{sales_receipt.id}/pdf"
11
+ response = do_http_raw_get(url, {}, {'Accept' => 'application/pdf'})
12
+ response.plain_body
13
+ end
14
+
9
15
  private
10
16
 
11
17
  def model
@@ -1,5 +1,5 @@
1
1
  module Quickbooks
2
2
 
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.1"
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: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Caughlan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-01 00:00:00.000000000 Z
11
+ date: 2015-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth
@@ -42,42 +42,42 @@ dependencies:
42
42
  name: nokogiri
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: activemodel
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: multipart-post
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
@@ -112,14 +112,14 @@ dependencies:
112
112
  name: rr
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ~>
116
116
  - !ruby/object:Gem::Version
117
117
  version: 1.0.2
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
124
  version: 1.0.2
125
125
  - !ruby/object:Gem::Dependency
@@ -184,7 +184,6 @@ executables: []
184
184
  extensions: []
185
185
  extra_rdoc_files: []
186
186
  files:
187
- - lib/quickbooks-ruby.rb
188
187
  - lib/quickbooks/model/access_token_response.rb
189
188
  - lib/quickbooks/model/account.rb
190
189
  - lib/quickbooks/model/account_based_expense_line_detail.rb
@@ -332,6 +331,7 @@ files:
332
331
  - lib/quickbooks/util/name_entity.rb
333
332
  - lib/quickbooks/util/query_builder.rb
334
333
  - lib/quickbooks/version.rb
334
+ - lib/quickbooks-ruby.rb
335
335
  homepage: http://github.com/ruckus/quickbooks-ruby
336
336
  licenses:
337
337
  - MIT
@@ -342,17 +342,17 @@ require_paths:
342
342
  - lib
343
343
  required_ruby_version: !ruby/object:Gem::Requirement
344
344
  requirements:
345
- - - ">="
345
+ - - '>='
346
346
  - !ruby/object:Gem::Version
347
347
  version: '0'
348
348
  required_rubygems_version: !ruby/object:Gem::Requirement
349
349
  requirements:
350
- - - ">="
350
+ - - '>='
351
351
  - !ruby/object:Gem::Version
352
352
  version: '0'
353
353
  requirements: []
354
354
  rubyforge_project:
355
- rubygems_version: 2.4.6
355
+ rubygems_version: 2.0.6
356
356
  signing_key:
357
357
  specification_version: 4
358
358
  summary: REST API to Quickbooks Online