quickbooks-ruby 0.1.5 → 0.1.6
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 +11 -0
- data/lib/quickbooks/model/base_reference.rb +1 -0
- data/lib/quickbooks/model/bill.rb +2 -0
- data/lib/quickbooks/model/credit_memo.rb +2 -0
- data/lib/quickbooks/model/custom_field.rb +2 -2
- data/lib/quickbooks/model/estimate.rb +1 -0
- data/lib/quickbooks/model/fault.rb +1 -0
- data/lib/quickbooks/model/global_tax_calculation.rb +13 -0
- data/lib/quickbooks/model/invoice.rb +4 -0
- data/lib/quickbooks/model/line.rb +1 -1
- data/lib/quickbooks/model/purchase.rb +1 -0
- data/lib/quickbooks/model/purchase_order.rb +1 -0
- data/lib/quickbooks/model/refund_receipt.rb +2 -0
- data/lib/quickbooks/model/sales_receipt.rb +2 -0
- data/lib/quickbooks/model/vendor_credit.rb +1 -0
- data/lib/quickbooks/service/base_service.rb +3 -1
- data/lib/quickbooks/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da1eed0bda8ea24f1208cadd17ae3a71d9bb5ad3
|
4
|
+
data.tar.gz: f722fa73671873c979a30272ebfc34099d454431
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 501c32416df4feab6f5bda98a7228cd43be3a6a49b5ce9571078e023e976cd05bd4e402e53f372fc85adcb909c9b7ba6429fd32f144b8deaad55cbad7c6b1b7a
|
7
|
+
data.tar.gz: ace357f52b45d67c50483742e9b6499a4f58a8de92fc089075c6fb3685c7b9306f8e9006365ed4fdf93981a700c3ab0fecb7bdeee9ec51cb50f4d10c191f3afc
|
data/lib/quickbooks-ruby.rb
CHANGED
@@ -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,7 +1,7 @@
|
|
1
1
|
module Quickbooks
|
2
2
|
module Model
|
3
3
|
class CustomField < BaseModel
|
4
|
-
xml_accessor :id, :from => '
|
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
|
@@ -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'
|
@@ -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
|
-
|
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
|
|
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: 0.1.
|
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-
|
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
|