quickbooks-ruby 0.1.5 → 0.1.6

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 333d4d3a664eb7b3b48294bdcd2de31071593403
4
- data.tar.gz: f67d64f084bec1975705b7aaa19148716f82ed37
3
+ metadata.gz: da1eed0bda8ea24f1208cadd17ae3a71d9bb5ad3
4
+ data.tar.gz: f722fa73671873c979a30272ebfc34099d454431
5
5
  SHA512:
6
- metadata.gz: 83df4ff5537f43d8066a62804fe31781a7ab95be145c599fbf0b10ae27faf493d7615c1f53ca7454e60a86ec3a2e1f0aab6f3f0576852e1ca10fecd6872e4d1c
7
- data.tar.gz: 676423da97728dfde65cf08f9750aaf26ec093f32138b2b6be979c651fe51eda8efd26c9cc6cb36b1ad0f2d46cdd75af14dfea739a6669ddcc4316702047037f
6
+ metadata.gz: 501c32416df4feab6f5bda98a7228cd43be3a6a49b5ce9571078e023e976cd05bd4e402e53f372fc85adcb909c9b7ba6429fd32f144b8deaad55cbad7c6b1b7a
7
+ data.tar.gz: ace357f52b45d67c50483742e9b6499a4f58a8de92fc089075c6fb3685c7b9306f8e9006365ed4fdf93981a700c3ab0fecb7bdeee9ec51cb50f4d10c191f3afc
@@ -18,6 +18,7 @@ require 'quickbooks/model/validator'
18
18
  require 'quickbooks/model/base_model'
19
19
  require 'quickbooks/model/base_reference'
20
20
  require 'quickbooks/model/document_numbering'
21
+ require 'quickbooks/model/global_tax_calculation'
21
22
  require 'quickbooks/model/access_token_response'
22
23
  require 'quickbooks/model/meta_data'
23
24
  require 'quickbooks/model/class'
@@ -116,9 +117,19 @@ require 'quickbooks/service/preferences'
116
117
  require 'quickbooks/service/refund_receipt'
117
118
 
118
119
  module Quickbooks
120
+ @@sandbox_mode = false
121
+
119
122
  @@logger = nil
120
123
 
121
124
  class << self
125
+ def sandbox_mode
126
+ @@sandbox_mode
127
+ end
128
+
129
+ def sandbox_mode=(sandbox_mode)
130
+ @@sandbox_mode = sandbox_mode
131
+ end
132
+
122
133
  def logger
123
134
  @@logger ||= ::Logger.new($stdout) # TODO: replace with a real log file
124
135
  end
@@ -4,6 +4,7 @@ module Quickbooks
4
4
  xml_convention :camelcase
5
5
  xml_accessor :name, :from => '@name' # Attribute with name 'name'
6
6
  xml_accessor :value, :from => :content
7
+ xml_accessor :type, :from => '@type' # Attribute with name 'type'
7
8
 
8
9
  def initialize(value = nil)
9
10
  self.value = value
@@ -1,6 +1,8 @@
1
1
  module Quickbooks
2
2
  module Model
3
3
  class Bill < BaseModel
4
+ include GlobalTaxCalculation
5
+
4
6
  XML_COLLECTION_NODE = "Bill"
5
7
  XML_NODE = "Bill"
6
8
  REST_RESOURCE = 'bill'
@@ -2,6 +2,8 @@ module Quickbooks
2
2
  module Model
3
3
  class CreditMemo < BaseModel
4
4
  include DocumentNumbering
5
+ include GlobalTaxCalculation
6
+
5
7
  XML_COLLECTION_NODE = "CreditMemo"
6
8
  XML_NODE = "CreditMemo"
7
9
  REST_RESOURCE = 'creditmemo'
@@ -1,7 +1,7 @@
1
1
  module Quickbooks
2
2
  module Model
3
3
  class CustomField < BaseModel
4
- xml_accessor :id, :from => 'Id', :as => Integer
4
+ xml_accessor :id, :from => 'DefinitionId', :as => Integer
5
5
  xml_accessor :name, :from => 'Name'
6
6
  xml_accessor :type, :from => 'Type'
7
7
  xml_accessor :string_value, :from => 'StringValue'
@@ -10,4 +10,4 @@ module Quickbooks
10
10
  xml_accessor :number_value, :from => 'NumberValue', :as => Integer
11
11
  end
12
12
  end
13
- end
13
+ end
@@ -8,6 +8,7 @@
8
8
  module Quickbooks
9
9
  module Model
10
10
  class Estimate < BaseModel
11
+ include GlobalTaxCalculation
11
12
 
12
13
  #== Constants
13
14
  REST_RESOURCE = 'estimate'
@@ -6,6 +6,7 @@ module Quickbooks
6
6
  xml_name 'Error'
7
7
  xml_accessor :code, :from => "@code"
8
8
  xml_accessor :message, :from => "Message"
9
+ xml_accessor :detail, :from => "Detail"
9
10
  end
10
11
 
11
12
  xml_accessor :errors, :as => [Quickbooks::Model::Fault::Error]
@@ -0,0 +1,13 @@
1
+ module GlobalTaxCalculation
2
+ extend ActiveSupport::Concern
3
+
4
+ TAX_INCLUDED = "TaxIncluded"
5
+ TAX_EXCLUDED = "TaxExcluded"
6
+ NOT_APPLICABLE = "NotApplicable"
7
+ GLOBAL_TAX_CALCULATION = [TAX_INCLUDED, TAX_EXCLUDED, NOT_APPLICABLE]
8
+
9
+ included do
10
+ xml_accessor :global_tax_calculation, :from => 'GlobalTaxCalculation'
11
+ validates_inclusion_of :global_tax_calculation, :in => GLOBAL_TAX_CALCULATION, allow_blank: true
12
+ end
13
+ end
@@ -9,6 +9,8 @@ module Quickbooks
9
9
  module Model
10
10
  class Invoice < BaseModel
11
11
  include DocumentNumbering
12
+ include GlobalTaxCalculation
13
+
12
14
  #== Constants
13
15
  REST_RESOURCE = 'invoice'
14
16
  XML_COLLECTION_NODE = "Invoice"
@@ -23,6 +25,7 @@ module Quickbooks
23
25
  xml_accessor :doc_number, :from => 'DocNumber'
24
26
  xml_accessor :txn_date, :from => 'TxnDate', :as => Date
25
27
  xml_accessor :currency_ref, :from => 'CurrencyRef', :as => BaseReference
28
+ xml_accessor :exchange_rate, :from => 'ExchangeRate', :as => BigDecimal, :to_xml => to_xml_big_decimal
26
29
  xml_accessor :private_note, :from => 'PrivateNote'
27
30
  xml_accessor :linked_transactions, :from => 'LinkedTxn', :as => [LinkedTransaction]
28
31
  xml_accessor :line_items, :from => 'Line', :as => [InvoiceLineItem]
@@ -39,6 +42,7 @@ module Quickbooks
39
42
  xml_accessor :tracking_num, :from => 'TrackingNum'
40
43
  xml_accessor :ar_account_ref, :from => 'ARAccountRef', :as => BaseReference
41
44
  xml_accessor :total_amount, :from => 'TotalAmt', :as => BigDecimal, :to_xml => to_xml_big_decimal
45
+ xml_accessor :home_total_amount, :from => 'HomeTotalAmt', :as => BigDecimal, :to_xml => to_xml_big_decimal
42
46
  xml_accessor :apply_tax_after_discount?, :from => 'ApplyTaxAfterDiscount'
43
47
  xml_accessor :print_status, :from => 'PrintStatus'
44
48
  xml_accessor :email_status, :from => 'EmailStatus'
@@ -23,8 +23,8 @@ module Quickbooks
23
23
  xml_accessor :journal_entry_line_detail, :from => 'JournalEntryLineDetail', :as => JournalEntryLineDetail
24
24
 
25
25
  def initialize(*args)
26
- super
27
26
  self.linked_transactions ||= []
27
+ super
28
28
  end
29
29
 
30
30
  def invoice_id=(id)
@@ -12,6 +12,7 @@
12
12
  module Quickbooks
13
13
  module Model
14
14
  class Purchase < BaseModel
15
+ include GlobalTaxCalculation
15
16
 
16
17
  #== Constants
17
18
  REST_RESOURCE = 'purchase'
@@ -1,6 +1,7 @@
1
1
  module Quickbooks
2
2
  module Model
3
3
  class PurchaseOrder < BaseModel
4
+ include GlobalTaxCalculation
4
5
 
5
6
  #== Constants
6
7
  REST_RESOURCE = 'purchaseorder'
@@ -1,6 +1,8 @@
1
1
  module Quickbooks
2
2
  module Model
3
3
  class RefundReceipt < BaseModel
4
+ include GlobalTaxCalculation
5
+
4
6
  XML_COLLECTION_NODE = "RefundReceipt"
5
7
  XML_NODE = "RefundReceipt"
6
8
  REST_RESOURCE = 'refundreceipt'
@@ -2,6 +2,8 @@ module Quickbooks
2
2
  module Model
3
3
  class SalesReceipt < BaseModel
4
4
  include DocumentNumbering
5
+ include GlobalTaxCalculation
6
+
5
7
  XML_COLLECTION_NODE = "SalesReceipt"
6
8
  XML_NODE = "SalesReceipt"
7
9
  REST_RESOURCE = 'salesreceipt'
@@ -5,6 +5,7 @@
5
5
  module Quickbooks
6
6
  module Model
7
7
  class VendorCredit < BaseModel
8
+ include GlobalTaxCalculation
8
9
 
9
10
  #== Constants
10
11
  REST_RESOURCE = 'vendorcredit'
@@ -15,9 +15,11 @@ module Quickbooks
15
15
  HTTP_ACCEPT = 'application/xml'
16
16
  HTTP_ACCEPT_ENCODING = 'gzip, deflate'
17
17
  BASE_DOMAIN = 'quickbooks.api.intuit.com'
18
+ SANDBOX_DOMAIN = 'sandbox-quickbooks.api.intuit.com'
18
19
 
19
20
  def initialize(attributes = {})
20
- @base_uri = "https://#{BASE_DOMAIN}/v3/company"
21
+ domain = Quickbooks.sandbox_mode ? SANDBOX_DOMAIN : BASE_DOMAIN
22
+ @base_uri = "https://#{domain}/v3/company"
21
23
  attributes.each {|key, value| public_send("#{key}=", value) }
22
24
  end
23
25
 
@@ -1,5 +1,5 @@
1
1
  module Quickbooks
2
2
 
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.6"
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.5
4
+ version: 0.1.6
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-09-08 00:00:00.000000000 Z
11
+ date: 2014-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth
@@ -199,6 +199,7 @@ files:
199
199
  - lib/quickbooks/model/entity.rb
200
200
  - lib/quickbooks/model/estimate.rb
201
201
  - lib/quickbooks/model/fault.rb
202
+ - lib/quickbooks/model/global_tax_calculation.rb
202
203
  - lib/quickbooks/model/group_line_detail.rb
203
204
  - lib/quickbooks/model/invoice.rb
204
205
  - lib/quickbooks/model/invoice_line_item.rb