quickeebooks 0.1.20 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Y2ExZWExMTliNjAzMWQ2YThiNmM5NGMyZDNjYTBhNzZkMWRjZjU5OQ==
4
+ YzMyNzQ0MWM2MjBkZTBhMWQ3YmYzNWE0ODIyYjIxMWUzMGQ2NDViNg==
5
5
  data.tar.gz: !binary |-
6
- MDYxNjk0ZWU3NjFhOTIyNWQxNjkwYWQxOTA4ZGJiZWFlMzdmMTg3NA==
6
+ ZmM0NTI4NWUxODExODVjZWY5NTAwZjAwNmU3ZmNhNjQxM2E1MDFkMQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OTNjZGVmYmYyYjJjOWVmMmQ3NjQwMjgwZmZlZThkYjc3Yjg1YjM2M2ZlNDQ1
10
- MWRkMTRlOTMzNDk3ZWUyYTFkMjRkYmJhNTkxOTU5OWJjOTBjMzlmMmE4NGU1
11
- YjYzZDhjM2I3NjM1MTU1N2JiNWMwZmIwNzc1Y2NiMzE4MDA0YzI=
9
+ ODQ5NWZhNjBlZmY1M2RkMzdmM2YxODlkMmZkMDdmM2VlYWE3M2FkMGVlNDA5
10
+ NWFkZmRlZDVhN2E3ZmEzNDM5MTBkMmQyMTA2ZWU1NjIzYjA3NDYyZTFmMzhj
11
+ Y2NmYWRlYzU0ODcwMDQ5YWY5OTYwYjM0ZmZmNGQ3MTZmMzlmZGM=
12
12
  data.tar.gz: !binary |-
13
- N2RiNTMyYmIzN2QxYTc5MWQ2NzBkNTNjNGE5ZGY2NTc3MzllNDE3MDc5NDhm
14
- NjE4MGU0ZTlhNzFiMjBkYzM2ZDNhOTVkOWFiZTA0NjJjYzM3NjZmMWM4ZGY0
15
- ZDdjN2U1YjMwMGQxMGVmZTliY2UwNmZmYzMwMWI1NDc3YTE1N2I=
13
+ M2M5OWQ1NTViYzJhN2MzZjZlNzdkYjc4MmFmOTE0MzdiZTcyY2ZlMzQwZWI4
14
+ NTlhMjA2ZDE1NzM5ODkxMTU2YTE1MGUxYjU2N2M0NTIwZGMwZjk2OWE2YzNj
15
+ YzE3Mzg2ODlhMWYwYjNhOTg3ZGVkYjUyNzE4NDI4MDVjMDBmOWI=
@@ -8,10 +8,10 @@ module Quickeebooks
8
8
  module Model
9
9
  class Account < Quickeebooks::Online::Model::IntuitType
10
10
  include ActiveModel::Validations
11
-
11
+
12
12
  REST_RESOURCE = "account"
13
13
  XML_NODE = "Account"
14
-
14
+
15
15
  xml_convention :camelcase
16
16
  xml_accessor :id, :from => 'Id', :as => Quickeebooks::Online::Model::Id
17
17
  xml_accessor :sync_token, :from => 'SyncToken', :as => Integer
@@ -31,7 +31,6 @@ module Quickeebooks
31
31
  def to_xml_ns(options = {})
32
32
  to_xml_inject_ns('Account', options)
33
33
  end
34
-
35
34
 
36
35
  def valid_for_update?
37
36
  if sync_token.nil?
@@ -46,9 +45,9 @@ module Quickeebooks
46
45
  return false if(id.nil? || sync_token.nil?)
47
46
  id.to_i > 0 && !sync_token.to_s.empty? && sync_token.to_i >= 0
48
47
  end
49
-
48
+
50
49
  end
51
50
  end
52
-
51
+
53
52
  end
54
53
  end
@@ -5,15 +5,22 @@ module Quickeebooks
5
5
  module Model
6
6
  class SalesReceiptHeader < Quickeebooks::Online::Model::IntuitType
7
7
  xml_name 'Header'
8
- xml_accessor :doc_number, :from => 'DocNumber'
9
- xml_accessor :txn_date, :from => 'TxnDate', :as => Quickeebooks::Common::DateTime
10
- xml_accessor :msg, :from => 'Msg'
11
- xml_accessor :note, :from => 'Note'
12
- xml_accessor :status, :from => 'Status'
13
- xml_accessor :customer_id, :from => 'CustomerId', :as => Quickeebooks::Online::Model::Id
14
- xml_accessor :customer_name, :from => 'CustomerName'
15
- xml_accessor :subtotal_amount, :from => 'SubTotalAmt', :as => Float
16
- xml_accessor :total_amount, :from => 'TotalAmt', :as => Float
8
+ xml_accessor :doc_number, :from => 'DocNumber'
9
+ xml_accessor :txn_date, :from => 'TxnDate', :as => Quickeebooks::Common::DateTime
10
+ xml_accessor :msg, :from => 'Msg'
11
+ xml_accessor :note, :from => 'Note'
12
+ xml_accessor :status, :from => 'Status'
13
+ xml_accessor :customer_id, :from => 'CustomerId', :as => Quickeebooks::Online::Model::Id
14
+ xml_accessor :customer_name, :from => 'CustomerName'
15
+ xml_accessor :subtotal_amount, :from => 'SubTotalAmt', :as => Float
16
+ xml_accessor :total_amount, :from => 'TotalAmt', :as => Float
17
+ xml_accessor :deposit_to_account_name, :from => 'DepositToAccountName'
18
+ xml_accessor :deposit_to_account_id, :from => 'DepositToAccountId', :as => Quickeebooks::Online::Model::Id
19
+ xml_accessor :shipping_address, :from => 'ShipAddr', :as => Quickeebooks::Online::Model::Address
20
+ xml_accessor :ship_method_id, :from => 'ShipMethodId', :as => Quickeebooks::Online::Model::Id
21
+ xml_accessor :ship_method_name, :from => 'ShipMethodName'
22
+ xml_accessor :payment_method_id, :from => "PaymentMethodId", :as => Quickeebooks::Online::Model::Id
23
+ xml_accessor :payment_method_name, :from => "PaymentMethodName"
17
24
  end
18
25
  end
19
26
  end
@@ -1,5 +1,5 @@
1
1
  module Quickeebooks
2
2
 
3
- VERSION = "0.1.20"
3
+ VERSION = "0.1.21"
4
4
 
5
5
  end
@@ -19,6 +19,7 @@ module Quickeebooks
19
19
  xml_accessor :meta_data, :from => 'MetaData', :as => Quickeebooks::Windows::Model::MetaData
20
20
  xml_accessor :external_key, :as => Quickeebooks::Windows::Model::ExternalKey
21
21
  xml_accessor :synchronized
22
+ xml_accessor :sync_token, :from => 'SyncToken', :as => Integer
22
23
  xml_accessor :header, :from => 'Header', :as => Quickeebooks::Windows::Model::SalesReceiptHeader
23
24
  xml_accessor :line_items, :from => 'Line', :as => [Quickeebooks::Windows::Model::SalesReceiptLineItem]
24
25
  xml_accessor :tax_line, :from => 'TaxLine', :as => Quickeebooks::Windows::Model::TaxLine
@@ -10,7 +10,20 @@ module Quickeebooks
10
10
  fetch_collection(Quickeebooks::Windows::Model::Account, nil, filters, page, per_page, sort, options)
11
11
  end
12
12
 
13
+ def create(account)
14
+ # XML is a wrapped 'object' where the type is specified as an attribute
15
+ # <Object xsi:type="Account">
16
+ xml_node = account.to_xml(:name => 'Object')
17
+ xml_node.set_attribute('xsi:type', 'Account')
18
+
19
+ xml = Quickeebooks::Shared::Service::OperationNode.new.add do |content|
20
+ content << "<ExternalRealmId>#{self.realm_id}</ExternalRealmId>#{xml_node}"
21
+ end
22
+
23
+ perform_write(Quickeebooks::Windows::Model::Account, xml)
24
+ end
25
+
13
26
  end
14
27
  end
15
28
  end
16
- end
29
+ end
@@ -13,9 +13,14 @@ module Quickeebooks
13
13
  fetch_collection(Quickeebooks::Windows::Model::SalesReceipt, nil, filters, page, per_page, sort, options)
14
14
  end
15
15
 
16
+ def fetch_by_id(id, idDomain = 'QB', options = {})
17
+ url = "#{url_for_resource(Quickeebooks::Windows::Model::SalesReceipt::REST_RESOURCE)}/#{id}"
18
+ fetch_object(Quickeebooks::Windows::Model::SalesReceipt, url, {:idDomain => idDomain})
19
+ end
20
+
16
21
  def create(sales_receipt)
17
22
  raise InvalidModelException unless sales_receipt.valid_for_create?
18
-
23
+
19
24
  # XML is a wrapped 'object' where the type is specified as an attribute
20
25
  # <Object xsi:type="Invoice">
21
26
  xml_node = sales_receipt.to_xml(:name => 'Object')
@@ -26,8 +31,26 @@ module Quickeebooks
26
31
  perform_write(Quickeebooks::Windows::Model::SalesReceipt, xml)
27
32
  end
28
33
 
34
+ def update(sales_receipt)
35
+ # XML is a wrapped 'object' where the type is specified as an attribute
36
+ # <Object xsi:type="Invoice">
37
+
38
+ # Intuit requires that some fields are unset / do not exist.
39
+ sales_receipt.meta_data = nil
40
+ sales_receipt.external_key = nil
41
+
42
+ xml_node = sales_receipt.to_xml(:name => 'Object')
43
+ xml_node.set_attribute('xsi:type', 'SalesReceipt')
44
+
45
+ xml = Quickeebooks::Shared::Service::OperationNode.new.mod do |content|
46
+ content << "<ExternalRealmId>#{self.realm_id}</ExternalRealmId> #{xml_node}"
47
+ end
48
+
49
+ perform_write(Quickeebooks::Windows::Model::SalesReceipt, xml)
50
+ end
51
+
29
52
  end
30
53
  end
31
-
54
+
32
55
  end
33
- end
56
+ end
@@ -8,8 +8,22 @@ module Quickeebooks
8
8
  def list(filters = [], page = 1, per_page = 20, sort = nil, options = {})
9
9
  fetch_collection(Quickeebooks::Windows::Model::ShipMethod, nil, filters, page, per_page, sort, options)
10
10
  end
11
+
12
+ def create(ship_method)
13
+
14
+ # XML is a wrapped 'object' where the type is specified as an attribute
15
+ # <Object xsi:type="Invoice">
16
+ xml_node = ship_method.to_xml(:name => 'Object')
17
+ xml_node.set_attribute('xsi:type', 'ShipMethod')
18
+
19
+ xml = Quickeebooks::Shared::Service::OperationNode.new.add do |content|
20
+ content << "<ExternalRealmId>#{self.realm_id}</ExternalRealmId>#{xml_node}"
21
+ end
22
+
23
+ perform_write(Quickeebooks::Windows::Model::ShipMethod, xml)
24
+ end
11
25
 
12
26
  end
13
27
  end
14
28
  end
15
- end
29
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quickeebooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20
4
+ version: 0.1.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Caughlan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-02 00:00:00.000000000 Z
11
+ date: 2013-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: roxml