quickbooks-ruby 0.1.0 → 0.1.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: c209381ed6c5ab416d8309663cc7b817d2293041
4
- data.tar.gz: 55cfad062e91adc4ac310f5e973459b6e79b3411
3
+ metadata.gz: e9f08f2bfe36efcbc4e438d7772eab4c46bc63f6
4
+ data.tar.gz: 1ca22e4d49058187e2181ce1ced6daeddddf7a60
5
5
  SHA512:
6
- metadata.gz: 96188250ed19a769b847b852f23464db1dfc7f4705b8d2ffeb026f883f1e6ef895c24726173e13923a8c88a3661abf528e4cf3eea6bf31bcb18c7c8382beaa42
7
- data.tar.gz: 5676acfca87d298abe8676bb1da1fde1783f8d318a7ce330e13504ce999f452019a9e9a013fbfb78f8311f327f2d292d6b291a3a1ac0ed9fc9ce11e132930c7e
6
+ metadata.gz: ee1e2883870be85a1767f5903a8f3b2e078aa8c394be50efb215af98e839276dd77a3ee3d0fc07bb3be152f03604f0a691003390ffee6303fde804883f5a90c8
7
+ data.tar.gz: 043b4a0f98ff875d583c1f5684877ccd4c68e048a7a8803b02052374eff235bf5a7271ca66c537ea0e14ae9f7f81b6a0592b20a209896ab4bfde2846f693512d
@@ -66,6 +66,9 @@ require 'quickbooks/model/tax_rate'
66
66
  require 'quickbooks/model/tax_rate_detail'
67
67
  require 'quickbooks/model/sales_tax_rate_list'
68
68
  require 'quickbooks/model/tax_code'
69
+ require 'quickbooks/model/fault'
70
+ require 'quickbooks/model/batch_request'
71
+ require 'quickbooks/model/batch_response'
69
72
 
70
73
  #== Services
71
74
  require 'quickbooks/service/service_crud'
@@ -92,6 +95,7 @@ require 'quickbooks/service/vendor_credit'
92
95
  require 'quickbooks/service/estimate'
93
96
  require 'quickbooks/service/tax_rate'
94
97
  require 'quickbooks/service/tax_code'
98
+ require 'quickbooks/service/batch'
95
99
 
96
100
  module Quickbooks
97
101
  @@logger = nil
@@ -0,0 +1,31 @@
1
+ class Quickbooks::Model::BatchRequest < Quickbooks::Model::BaseModel
2
+ class BatchItemRequest
3
+ include ROXML
4
+ XML_NODE = "BatchItemRequest"
5
+ xml_name XML_NODE
6
+
7
+ xml_accessor :operation, :from => "@operation"
8
+ xml_accessor :bId, :from => "@bId"
9
+ [:Item, :Account, :Invoice, :Customer, :Bill, :SalesReceipt].each do |model|
10
+ xml_accessor model.to_s.underscore, from: model.to_s, as: "Quickbooks::Model::#{model.to_s}".constantize
11
+ end
12
+ end
13
+
14
+ XML_COLLECTION_NODE = "IntuitBatchRequest"
15
+ XML_NODE = "IntuitBatchRequest"
16
+ REST_RESOURCE = 'batch'
17
+ xml_name XML_NODE
18
+ xml_accessor :request_items, from: "BatchItemRequest", as: [Quickbooks::Model::BatchRequest::BatchItemRequest]
19
+
20
+ def initialize
21
+ self.request_items = []
22
+ end
23
+
24
+ def add(batch_item_id, batch_item, operation)
25
+ bir = Quickbooks::Model::BatchRequest::BatchItemRequest.new
26
+ bir.operation = operation
27
+ bir.bId = batch_item_id
28
+ bir.send("#{batch_item.class::XML_NODE.underscore}=", batch_item)
29
+ self.request_items << bir
30
+ end
31
+ end
@@ -0,0 +1,19 @@
1
+ class Quickbooks::Model::BatchResponse < Quickbooks::Model::BaseModel
2
+ class BatchItemResponse
3
+ include ROXML
4
+ xml_name "BatchItemResponse"
5
+
6
+ xml_accessor :bId, :from => "@bId"
7
+ xml_accessor :fault, :from => 'Fault', :as => Quickbooks::Model::Fault
8
+ [:Item, :Account, :Invoice, :Customer, :Bill, :SalesReceipt].each do |model|
9
+ xml_accessor model.to_s.underscore, from: model.to_s, as: "Quickbooks::Model::#{model.to_s}".constantize
10
+ end
11
+
12
+ def fault?
13
+ fault
14
+ end
15
+ end
16
+
17
+ xml_name "IntuitResponse"
18
+ xml_accessor :response_items, :from => :BatchItemResponse, as: [Quickbooks::Model::BatchResponse::BatchItemResponse]
19
+ end
@@ -4,6 +4,10 @@ module Quickbooks
4
4
  xml_accessor :id, :from => 'Id', :as => Integer
5
5
  xml_accessor :name, :from => 'Name'
6
6
  xml_accessor :type, :from => 'Type'
7
+ xml_accessor :string_value, :from => 'StringValue'
8
+ xml_accessor :boolean_value, :from => 'BooleanValue'
9
+ xml_accessor :date_value, :from => 'DateValue', :as => Date
10
+ xml_accessor :number_value, :from => 'NumberValue', :as => Integer
7
11
  end
8
12
  end
9
13
  end
@@ -0,0 +1,14 @@
1
+ module Quickbooks
2
+ module Model
3
+ class Fault < BaseModel
4
+ class Error
5
+ include ROXML
6
+ xml_name 'Error'
7
+ xml_accessor :code, :from => "@code"
8
+ xml_accessor :message, :from => "Message"
9
+ end
10
+
11
+ xml_accessor :errors, :as => [Quickbooks::Model::Fault::Error]
12
+ end
13
+ end
14
+ end
@@ -29,7 +29,6 @@ module Quickbooks
29
29
 
30
30
  # read-only
31
31
  xml_accessor :fully_qualified_name, :from => 'FullyQualifiedName'
32
-
33
32
  xml_accessor :taxable?, :from => 'Taxable'
34
33
  xml_accessor :sales_tax_included?, :from => 'SalesTaxIncluded'
35
34
  xml_accessor :unit_price, :from => 'UnitPrice', :as => BigDecimal, :to_xml => to_xml_big_decimal
@@ -6,6 +6,7 @@ module Quickbooks
6
6
  xml_accessor :total_tax, :from => 'TotalTax', :as => BigDecimal, :to_xml => :to_f.to_proc
7
7
  xml_accessor :lines, :from => 'TaxLine', :as => [TaxLine]
8
8
 
9
+ reference_setters :txn_tax_code_ref
9
10
  end
10
11
  end
11
12
  end
@@ -0,0 +1,11 @@
1
+ module Quickbooks
2
+ module Service
3
+ class Batch < BaseService
4
+
5
+ def make_request(entity, options = {})
6
+ response = do_http_post(url_for_resource('batch'), valid_xml_document(entity.to_xml_ns))
7
+ Quickbooks::Model::BatchResponse.from_xml(response.plain_body)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,5 +1,5 @@
1
1
  module Quickbooks
2
2
 
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.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.1.0
4
+ version: 0.1.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: 2014-02-27 00:00:00.000000000 Z
11
+ date: 2014-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth
@@ -164,7 +164,7 @@ dependencies:
164
164
  - - '='
165
165
  - !ruby/object:Gem::Version
166
166
  version: 3.0.0
167
- description: REST API to Quickbooks Online via Intuit Data Services v3
167
+ description: QBO V3 REST API to Quickbooks Online
168
168
  email: toolbag@gmail.com
169
169
  executables: []
170
170
  extensions: []
@@ -175,6 +175,8 @@ files:
175
175
  - lib/quickbooks/model/account_based_expense_line_detail.rb
176
176
  - lib/quickbooks/model/base_model.rb
177
177
  - lib/quickbooks/model/base_reference.rb
178
+ - lib/quickbooks/model/batch_request.rb
179
+ - lib/quickbooks/model/batch_response.rb
178
180
  - lib/quickbooks/model/bill.rb
179
181
  - lib/quickbooks/model/bill_line_item.rb
180
182
  - lib/quickbooks/model/bill_payment.rb
@@ -191,6 +193,7 @@ files:
191
193
  - lib/quickbooks/model/email_address.rb
192
194
  - lib/quickbooks/model/employee.rb
193
195
  - lib/quickbooks/model/estimate.rb
196
+ - lib/quickbooks/model/fault.rb
194
197
  - lib/quickbooks/model/group_line_detail.rb
195
198
  - lib/quickbooks/model/invoice.rb
196
199
  - lib/quickbooks/model/invoice_line_item.rb
@@ -227,6 +230,7 @@ files:
227
230
  - lib/quickbooks/service/access_token.rb
228
231
  - lib/quickbooks/service/account.rb
229
232
  - lib/quickbooks/service/base_service.rb
233
+ - lib/quickbooks/service/batch.rb
230
234
  - lib/quickbooks/service/bill.rb
231
235
  - lib/quickbooks/service/bill_payment.rb
232
236
  - lib/quickbooks/service/company_info.rb
@@ -276,5 +280,5 @@ rubyforge_project:
276
280
  rubygems_version: 2.0.6
277
281
  signing_key:
278
282
  specification_version: 4
279
- summary: REST API to Quickbooks Online via Intuit Data Services v3
283
+ summary: REST API to Quickbooks Online
280
284
  test_files: []