quickbooks-ruby 0.0.6 → 0.0.7
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 +6 -2
- data/lib/quickbooks/model/access_token_response.rb +29 -0
- data/lib/quickbooks/model/base_model.rb +4 -0
- data/lib/quickbooks/model/invoice.rb +1 -1
- data/lib/quickbooks/model/item.rb +5 -5
- data/lib/quickbooks/model/sales_receipt.rb +2 -2
- data/lib/quickbooks/model/tax_line.rb +1 -1
- data/lib/quickbooks/model/time_activity.rb +55 -0
- data/lib/quickbooks/model/transaction_tax_detail.rb +2 -2
- data/lib/quickbooks/service/access_token.rb +38 -0
- data/lib/quickbooks/service/account.rb +0 -1
- data/lib/quickbooks/service/base_service.rb +1 -0
- data/lib/quickbooks/service/bill.rb +0 -1
- data/lib/quickbooks/service/bill_payment.rb +0 -1
- data/lib/quickbooks/service/company_info.rb +0 -1
- data/lib/quickbooks/service/credit_memo.rb +0 -1
- data/lib/quickbooks/service/customer.rb +0 -1
- data/lib/quickbooks/service/employee.rb +0 -1
- data/lib/quickbooks/service/estimate.rb +0 -1
- data/lib/quickbooks/service/invoice.rb +0 -1
- data/lib/quickbooks/service/item.rb +0 -1
- data/lib/quickbooks/service/payment.rb +0 -1
- data/lib/quickbooks/service/payment_method.rb +0 -1
- data/lib/quickbooks/service/purchase.rb +0 -1
- data/lib/quickbooks/service/purchase_order.rb +0 -1
- data/lib/quickbooks/service/sales_receipt.rb +0 -1
- data/lib/quickbooks/service/term.rb +0 -1
- data/lib/quickbooks/service/time_activity.rb +21 -0
- data/lib/quickbooks/service/vendor.rb +0 -1
- data/lib/quickbooks/service/vendor_credit.rb +0 -1
- data/lib/quickbooks/version.rb +1 -1
- metadata +8 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76e7ba2dadf9a296b38a09a900281a2551d08dcc
|
4
|
+
data.tar.gz: f5e631c07e1ef626ef13c9519223bf2642018006
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e515f78c27d4dbc33389de24a2c7b96ecacb42e1ed13fc573883514b673e82819b13b410800de49e8587e7baddde1a8f8f8ab414951be4e98eb2036dab534a6e
|
7
|
+
data.tar.gz: 44cfedffe0f2b986da31b13647e282bd50424e0ffb027c0ff023288b73a08171b7611017d0e2fefc1bef2641ec5ded9219015367468fb512aae2f4817c75e8f1
|
data/lib/quickbooks-ruby.rb
CHANGED
@@ -14,6 +14,7 @@ require 'quickbooks/util/name_entity'
|
|
14
14
|
#== Models
|
15
15
|
require 'quickbooks/model/base_model'
|
16
16
|
require 'quickbooks/model/base_reference'
|
17
|
+
require 'quickbooks/model/access_token_response'
|
17
18
|
require 'quickbooks/model/meta_data'
|
18
19
|
require 'quickbooks/model/custom_field'
|
19
20
|
require 'quickbooks/model/sales_item_line_detail'
|
@@ -33,7 +34,6 @@ require 'quickbooks/model/web_site_address'
|
|
33
34
|
require 'quickbooks/model/physical_address'
|
34
35
|
require 'quickbooks/model/linked_transaction'
|
35
36
|
require 'quickbooks/model/invoice_line_item'
|
36
|
-
require 'quickbooks/model/invoice'
|
37
37
|
require 'quickbooks/model/company_info'
|
38
38
|
require 'quickbooks/model/customer'
|
39
39
|
require 'quickbooks/model/sales_receipt'
|
@@ -54,16 +54,19 @@ require 'quickbooks/model/group_line_detail'
|
|
54
54
|
require 'quickbooks/model/item_based_expense_line_detail'
|
55
55
|
require 'quickbooks/model/tax_line_detail'
|
56
56
|
require 'quickbooks/model/tax_line'
|
57
|
+
require 'quickbooks/model/time_activity'
|
57
58
|
require 'quickbooks/model/transaction_tax_detail'
|
58
59
|
require 'quickbooks/model/purchase_line_item'
|
59
60
|
require 'quickbooks/model/purchase'
|
60
61
|
require 'quickbooks/model/purchase_order'
|
61
62
|
require 'quickbooks/model/vendor_credit'
|
62
63
|
require 'quickbooks/model/estimate'
|
64
|
+
require 'quickbooks/model/invoice'
|
63
65
|
|
64
66
|
#== Services
|
65
|
-
require 'quickbooks/service/base_service'
|
66
67
|
require 'quickbooks/service/service_crud'
|
68
|
+
require 'quickbooks/service/base_service'
|
69
|
+
require 'quickbooks/service/access_token'
|
67
70
|
require 'quickbooks/service/company_info'
|
68
71
|
require 'quickbooks/service/customer'
|
69
72
|
require 'quickbooks/service/invoice'
|
@@ -78,6 +81,7 @@ require 'quickbooks/service/vendor'
|
|
78
81
|
require 'quickbooks/service/employee'
|
79
82
|
require 'quickbooks/service/payment'
|
80
83
|
require 'quickbooks/service/term'
|
84
|
+
require 'quickbooks/service/time_activity'
|
81
85
|
require 'quickbooks/service/purchase'
|
82
86
|
require 'quickbooks/service/purchase_order'
|
83
87
|
require 'quickbooks/service/vendor_credit'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Quickbooks
|
2
|
+
module Model
|
3
|
+
class AccessTokenResponse < BaseModel
|
4
|
+
xml_convention :camelcase
|
5
|
+
xml_accessor :error_code, :from => 'ErrorCode'
|
6
|
+
xml_accessor :error_message, :from => 'ErrorMessage'
|
7
|
+
xml_accessor :token, :from => 'OAuthToken'
|
8
|
+
xml_accessor :secret, :from => 'OAuthTokenSecret'
|
9
|
+
xml_accessor :server_time, :from => 'ServerTime', :as => Time
|
10
|
+
|
11
|
+
def error?
|
12
|
+
error_code.to_i != 0
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
=begin
|
20
|
+
<?xml version="1.0"?>
|
21
|
+
<ReconnectResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://platform.intuit.com/api/v1">
|
22
|
+
<ErrorMessage/>
|
23
|
+
<ErrorCode>0</ErrorCode>
|
24
|
+
<ServerTime>2012-01-04T19:21:21.0782072Z</ServerTime>
|
25
|
+
<OAuthToken>qye2eIdQ5H5yMyrlJflUWh712xfFXjyNnW1MfbC0rz04TfCP</OAuthToken>
|
26
|
+
<OAuthTokenSecret>cyDeUNQTkFzoR0KkDn7viN6uLQxWTobeEUKW7I79</OAuthTokenSecret>
|
27
|
+
</ReconnectResponse>
|
28
|
+
|
29
|
+
=end
|
@@ -24,7 +24,7 @@ module Quickbooks
|
|
24
24
|
xml_accessor :private_note, :from => 'PrivateNote'
|
25
25
|
xml_accessor :linked_transactions, :from => 'LinkedTxn', :as => [LinkedTransaction]
|
26
26
|
xml_accessor :line_items, :from => 'Line', :as => [InvoiceLineItem]
|
27
|
-
xml_accessor :txn_tax_detail, :from => 'TxnTaxDetail'
|
27
|
+
xml_accessor :txn_tax_detail, :from => 'TxnTaxDetail', :as => TransactionTaxDetail
|
28
28
|
xml_accessor :customer_ref, :from => 'CustomerRef', :as => BaseReference
|
29
29
|
xml_accessor :customer_memo, :from => 'CustomerMemo'
|
30
30
|
xml_accessor :billing_address, :from => 'BillAddr', :as => PhysicalAddress
|
@@ -32,17 +32,17 @@ module Quickbooks
|
|
32
32
|
|
33
33
|
xml_accessor :taxable, :from => 'Taxable'
|
34
34
|
xml_accessor :sales_tax_included, :from => 'SalesTaxIncluded'
|
35
|
-
xml_accessor :unit_price, :from => 'UnitPrice', :as => BigDecimal, :to_xml =>
|
36
|
-
xml_accessor :rate_percent, :from => 'RatePercent', :as => BigDecimal, :to_xml =>
|
35
|
+
xml_accessor :unit_price, :from => 'UnitPrice', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
36
|
+
xml_accessor :rate_percent, :from => 'RatePercent', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
37
37
|
xml_accessor :type, :from => 'Type'
|
38
38
|
xml_accessor :income_account_ref, :from => 'IncomeAccountRef', :as => BaseReference
|
39
39
|
xml_accessor :purchase_desc, :from => 'PurchaseDesc'
|
40
40
|
xml_accessor :purchase_tax_included, :from => 'PurchaseTaxIncluded'
|
41
|
-
xml_accessor :purchase_cost, :from => 'PurchaseCost', :as => BigDecimal, :to_xml =>
|
41
|
+
xml_accessor :purchase_cost, :from => 'PurchaseCost', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
42
42
|
xml_accessor :expense_account_ref, :from => 'ExpenseAccountRef', :as => BaseReference
|
43
43
|
xml_accessor :asset_account_ref, :from => 'AssetAccountRef', :as => BaseReference
|
44
44
|
xml_accessor :track_quantity_on_hand, :from => 'TrackQtyOnHand'
|
45
|
-
xml_accessor :quantity_on_hand, :from => 'QtyOnHand', :as => BigDecimal, :to_xml =>
|
45
|
+
xml_accessor :quantity_on_hand, :from => 'QtyOnHand', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
46
46
|
xml_accessor :sales_tax_code_ref, :from => 'SalesTaxCodeRef', :as => BaseReference
|
47
47
|
xml_accessor :purchase_tax_code_ref, :from => 'PurchaseTaxCodeRef', :as => BaseReference
|
48
48
|
xml_accessor :inv_start_date, :from => 'InvStartDate', :as => Date
|
@@ -103,4 +103,4 @@ module Quickbooks
|
|
103
103
|
|
104
104
|
end
|
105
105
|
end
|
106
|
-
end
|
106
|
+
end
|
@@ -19,7 +19,7 @@ module Quickbooks
|
|
19
19
|
|
20
20
|
xml_accessor :po_number, :from => 'PONumber'
|
21
21
|
|
22
|
-
xml_accessor :ship_method_ref, :from => 'ShipMethodRef'
|
22
|
+
xml_accessor :ship_method_ref, :from => 'ShipMethodRef'
|
23
23
|
xml_accessor :ship_date, :from => 'ShipDate', :as => Time
|
24
24
|
xml_accessor :tracking_num, :from => 'TrackingNum'
|
25
25
|
|
@@ -34,7 +34,7 @@ module Quickbooks
|
|
34
34
|
# readonly
|
35
35
|
xml_accessor :total, :from => 'TotalAmt', :as => BigDecimal
|
36
36
|
|
37
|
-
reference_setters :customer_ref, :
|
37
|
+
reference_setters :customer_ref, :payment_method_ref, :deposit_to_account_ref
|
38
38
|
|
39
39
|
validates_length_of :line_items, :minimum => 1
|
40
40
|
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Quickbooks
|
2
|
+
module Model
|
3
|
+
class TimeActivity < BaseModel
|
4
|
+
XML_COLLECTION_NODE = "TimeActivity"
|
5
|
+
XML_NODE = "TimeActivity"
|
6
|
+
REST_RESOURCE = 'timeactivity'
|
7
|
+
|
8
|
+
NAMEOF_OPTIONS = %w( Employee Vendor )
|
9
|
+
|
10
|
+
xml_name XML_NODE
|
11
|
+
|
12
|
+
xml_accessor :id, :from => 'Id', :as => Integer
|
13
|
+
xml_accessor :sync_token, :from => 'SyncToken', :as => Integer
|
14
|
+
xml_accessor :meta_data, :from => 'MetaData', :as => MetaData
|
15
|
+
|
16
|
+
xml_accessor :txn_date, :from => 'TxnDate'
|
17
|
+
xml_accessor :name_of, :from => 'NameOf'
|
18
|
+
|
19
|
+
xml_accessor :employee_ref, :from => 'EmployeeRef', :as => BaseReference
|
20
|
+
xml_accessor :vendor_ref, :from => 'VendorRef', :as => BaseReference
|
21
|
+
xml_accessor :customer_ref, :from => 'CustomerRef', :as => BaseReference
|
22
|
+
xml_accessor :item_ref, :from => 'ItemRef', :as => BaseReference
|
23
|
+
|
24
|
+
xml_accessor :billable_status, :from => 'BillableStatus'
|
25
|
+
xml_accessor :taxable, :from => 'Taxable'
|
26
|
+
xml_accessor :hours, :from => 'Hours', :as => Integer
|
27
|
+
xml_accessor :hourly_rate, :from => 'HourlyRate'
|
28
|
+
xml_accessor :minutes, :from => 'Minutes', :as => Integer
|
29
|
+
xml_accessor :description, :from => 'Description'
|
30
|
+
|
31
|
+
#== Validations
|
32
|
+
validates_inclusion_of :name_of, :in => NAMEOF_OPTIONS
|
33
|
+
validates_presence_of :employee_ref, :if => Proc.new { |ta| ta.name_of == "Employee" }
|
34
|
+
validates_presence_of :vendor_ref, :if => Proc.new { |ta| ta.name_of == "Vendor" }
|
35
|
+
|
36
|
+
def valid_for_update?
|
37
|
+
if sync_token.nil?
|
38
|
+
errors.add(:sync_token, "Missing required attribute SyncToken for update")
|
39
|
+
end
|
40
|
+
errors.empty?
|
41
|
+
end
|
42
|
+
|
43
|
+
def valid_for_create?
|
44
|
+
valid?
|
45
|
+
errors.empty?
|
46
|
+
end
|
47
|
+
|
48
|
+
def valid_for_deletion?
|
49
|
+
return false if(id.nil? || sync_token.nil?)
|
50
|
+
id.to_i > 0 && !sync_token.to_s.empty? && sync_token.to_i >= 0
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -3,9 +3,9 @@ module Quickbooks
|
|
3
3
|
class TransactionTaxDetail < BaseModel
|
4
4
|
|
5
5
|
xml_accessor :txn_tax_code_ref, :from => 'TxnTaxCodeRef', :as => BaseReference
|
6
|
-
xml_accessor :total_tax, :from => '
|
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
9
|
end
|
10
10
|
end
|
11
|
-
end
|
11
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Quickbooks
|
2
|
+
module Service
|
3
|
+
class AccessToken < BaseService
|
4
|
+
|
5
|
+
RENEW_URL = "https://appcenter.intuit.com/api/v1/connection/reconnect"
|
6
|
+
DISCONNECT_URL = "https://appcenter.intuit.com/api/v1/connection/disconnect"
|
7
|
+
|
8
|
+
# https://developer.intuit.com/docs/0025_quickbooksapi/0053_auth_auth/oauth_management_api#Reconnect
|
9
|
+
def renew
|
10
|
+
result = nil
|
11
|
+
response = do_http_get(RENEW_URL)
|
12
|
+
if response
|
13
|
+
code = response.code.to_i
|
14
|
+
if code == 200
|
15
|
+
result = Quickbooks::Model::AccessTokenResponse.from_xml(response.plain_body)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
result
|
20
|
+
end
|
21
|
+
|
22
|
+
# https://developer.intuit.com/docs/0025_quickbooksapi/0053_auth_auth/oauth_management_api#Disconnect
|
23
|
+
def disconnect
|
24
|
+
result = nil
|
25
|
+
response = do_http_get(DISCONNECT_URL)
|
26
|
+
if response
|
27
|
+
code = response.code.to_i
|
28
|
+
if code == 200
|
29
|
+
result = Quickbooks::Model::AccessTokenResponse.from_xml(response.plain_body)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
result
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Quickbooks
|
2
|
+
module Service
|
3
|
+
class TimeActivity < BaseService
|
4
|
+
include ServiceCrud
|
5
|
+
|
6
|
+
def delete(time_activity, options = {})
|
7
|
+
delete_by_query_string(time_activity)
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def default_model_query
|
13
|
+
"SELECT * FROM TIMEACTIVITY"
|
14
|
+
end
|
15
|
+
|
16
|
+
def model
|
17
|
+
Quickbooks::Model::TimeActivity
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
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.0.
|
4
|
+
version: 0.0.7
|
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-
|
11
|
+
date: 2014-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth
|
@@ -42,22 +42,16 @@ dependencies:
|
|
42
42
|
name: nokogiri
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '1.6'
|
48
45
|
- - '>='
|
49
46
|
- !ruby/object:Gem::Version
|
50
|
-
version:
|
47
|
+
version: '0'
|
51
48
|
type: :runtime
|
52
49
|
prerelease: false
|
53
50
|
version_requirements: !ruby/object:Gem::Requirement
|
54
51
|
requirements:
|
55
|
-
- - ~>
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: '1.6'
|
58
52
|
- - '>='
|
59
53
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
54
|
+
version: '0'
|
61
55
|
- !ruby/object:Gem::Dependency
|
62
56
|
name: activemodel
|
63
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,6 +170,7 @@ executables: []
|
|
176
170
|
extensions: []
|
177
171
|
extra_rdoc_files: []
|
178
172
|
files:
|
173
|
+
- lib/quickbooks/model/access_token_response.rb
|
179
174
|
- lib/quickbooks/model/account.rb
|
180
175
|
- lib/quickbooks/model/account_based_expense_line_detail.rb
|
181
176
|
- lib/quickbooks/model/base_model.rb
|
@@ -220,10 +215,12 @@ files:
|
|
220
215
|
- lib/quickbooks/model/tax_line_detail.rb
|
221
216
|
- lib/quickbooks/model/telephone_number.rb
|
222
217
|
- lib/quickbooks/model/term.rb
|
218
|
+
- lib/quickbooks/model/time_activity.rb
|
223
219
|
- lib/quickbooks/model/transaction_tax_detail.rb
|
224
220
|
- lib/quickbooks/model/vendor.rb
|
225
221
|
- lib/quickbooks/model/vendor_credit.rb
|
226
222
|
- lib/quickbooks/model/web_site_address.rb
|
223
|
+
- lib/quickbooks/service/access_token.rb
|
227
224
|
- lib/quickbooks/service/account.rb
|
228
225
|
- lib/quickbooks/service/base_service.rb
|
229
226
|
- lib/quickbooks/service/bill.rb
|
@@ -242,6 +239,7 @@ files:
|
|
242
239
|
- lib/quickbooks/service/sales_receipt.rb
|
243
240
|
- lib/quickbooks/service/service_crud.rb
|
244
241
|
- lib/quickbooks/service/term.rb
|
242
|
+
- lib/quickbooks/service/time_activity.rb
|
245
243
|
- lib/quickbooks/service/vendor.rb
|
246
244
|
- lib/quickbooks/service/vendor_credit.rb
|
247
245
|
- lib/quickbooks/util/http_encoding_helper.rb
|