quickbooks-ruby 0.1.2 → 0.1.3
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 +12 -2
- data/lib/quickbooks/model/account.rb +3 -3
- data/lib/quickbooks/model/account_based_expense_line_detail.rb +2 -2
- data/lib/quickbooks/model/base_model.rb +5 -1
- data/lib/quickbooks/model/bill.rb +2 -1
- data/lib/quickbooks/model/bill_line_item.rb +2 -2
- data/lib/quickbooks/model/bill_payment.rb +0 -1
- data/lib/quickbooks/model/bill_payment_line_item.rb +2 -2
- data/lib/quickbooks/model/class.rb +31 -0
- data/lib/quickbooks/model/credit_memo.rb +8 -1
- data/lib/quickbooks/model/customer.rb +2 -2
- data/lib/quickbooks/model/department.rb +31 -0
- data/lib/quickbooks/model/discount_line_detail.rb +2 -2
- data/lib/quickbooks/model/discount_override.rb +1 -1
- data/lib/quickbooks/model/document_numbering.rb +18 -0
- data/lib/quickbooks/model/employee.rb +1 -1
- data/lib/quickbooks/model/estimate.rb +3 -6
- data/lib/quickbooks/model/group_line_detail.rb +2 -2
- data/lib/quickbooks/model/invoice.rb +9 -8
- data/lib/quickbooks/model/invoice_line_item.rb +2 -2
- data/lib/quickbooks/model/item_based_expense_line_detail.rb +3 -3
- data/lib/quickbooks/model/line.rb +1 -1
- data/lib/quickbooks/model/markup_info.rb +2 -2
- data/lib/quickbooks/model/payment.rb +2 -2
- data/lib/quickbooks/model/payment_line_detail.rb +2 -2
- data/lib/quickbooks/model/payment_method.rb +1 -1
- data/lib/quickbooks/model/purchase.rb +2 -2
- data/lib/quickbooks/model/sales_item_line_detail.rb +1 -1
- data/lib/quickbooks/model/sales_receipt.rb +8 -6
- data/lib/quickbooks/model/tax_code.rb +3 -14
- data/lib/quickbooks/model/tax_line_detail.rb +2 -2
- data/lib/quickbooks/model/tax_rate.rb +1 -4
- data/lib/quickbooks/model/transaction_tax_detail.rb +1 -1
- data/lib/quickbooks/service/account.rb +0 -4
- data/lib/quickbooks/service/base_service.rb +20 -12
- data/lib/quickbooks/service/bill.rb +4 -2
- data/lib/quickbooks/service/bill_payment.rb +1 -3
- data/lib/quickbooks/service/class.rb +23 -0
- data/lib/quickbooks/service/company_info.rb +1 -5
- data/lib/quickbooks/service/credit_memo.rb +2 -4
- data/lib/quickbooks/service/customer.rb +0 -4
- data/lib/quickbooks/service/department.rb +23 -0
- data/lib/quickbooks/service/employee.rb +0 -4
- data/lib/quickbooks/service/estimate.rb +1 -5
- data/lib/quickbooks/service/invoice.rb +2 -6
- data/lib/quickbooks/service/item.rb +1 -5
- data/lib/quickbooks/service/payment.rb +0 -4
- data/lib/quickbooks/service/payment_method.rb +6 -8
- data/lib/quickbooks/service/purchase.rb +1 -3
- data/lib/quickbooks/service/purchase_order.rb +2 -4
- data/lib/quickbooks/service/sales_receipt.rb +1 -3
- data/lib/quickbooks/service/service_crud.rb +1 -15
- data/lib/quickbooks/service/tax_code.rb +0 -4
- data/lib/quickbooks/service/tax_rate.rb +0 -4
- data/lib/quickbooks/service/term.rb +0 -4
- data/lib/quickbooks/service/time_activity.rb +0 -4
- data/lib/quickbooks/service/vendor.rb +0 -4
- data/lib/quickbooks/service/vendor_credit.rb +2 -4
- data/lib/quickbooks/util/logging.rb +10 -0
- data/lib/quickbooks/util/name_entity.rb +2 -1
- data/lib/quickbooks/version.rb +1 -1
- metadata +7 -2
@@ -3,11 +3,11 @@ module Quickbooks
|
|
3
3
|
class ItemBasedExpenseLineDetail < BaseModel
|
4
4
|
xml_accessor :item_ref, :from => 'ItemRef', :as => BaseReference
|
5
5
|
xml_accessor :class_ref, :from => 'ClassRef', :as => BaseReference
|
6
|
-
xml_accessor :unit_price, :from => 'UnitPrice', :as => BigDecimal, :to_xml =>
|
7
|
-
xml_accessor :rate_percent, :from => 'RatePercent', :as => BigDecimal, :to_xml =>
|
6
|
+
xml_accessor :unit_price, :from => 'UnitPrice', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
7
|
+
xml_accessor :rate_percent, :from => 'RatePercent', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
8
8
|
xml_accessor :price_level_ref, :from => 'PriceLevelRef', :as => BaseReference
|
9
9
|
xml_accessor :markup_info, :from => 'MarkupInfo', :as => MarkupInfo
|
10
|
-
xml_accessor :quantity, :from => 'Qty', :as => BigDecimal, :to_xml =>
|
10
|
+
xml_accessor :quantity, :from => 'Qty', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
11
11
|
xml_accessor :tax_code_ref, :from => 'TaxCodeRef', :as => BaseReference
|
12
12
|
xml_accessor :customer_ref, :from => 'CustomerRef', :as => BaseReference
|
13
13
|
xml_accessor :billable_status, :from => 'BillableStatus'
|
@@ -10,7 +10,7 @@ module Quickbooks
|
|
10
10
|
xml_accessor :id, :from => 'Id', :as => Integer
|
11
11
|
xml_accessor :line_num, :from => 'LineNum', :as => Integer
|
12
12
|
xml_accessor :description, :from => 'Description'
|
13
|
-
xml_accessor :amount, :from => 'Amount', :as => BigDecimal, :to_xml =>
|
13
|
+
xml_accessor :amount, :from => 'Amount', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
14
14
|
xml_accessor :detail_type, :from => 'DetailType'
|
15
15
|
xml_accessor :linked_transactions, :from => 'LinkedTxn', :as => [LinkedTransaction]
|
16
16
|
|
@@ -2,8 +2,8 @@ module Quickbooks
|
|
2
2
|
module Model
|
3
3
|
class MarkupInfo < BaseModel
|
4
4
|
xml_accessor :percent_based, :from => 'PercentBased'
|
5
|
-
xml_accessor :value, :from => 'Value', :as => BigDecimal, :to_xml =>
|
6
|
-
xml_accessor :percent, :from => 'Percent', :as => BigDecimal, :to_xml =>
|
5
|
+
xml_accessor :value, :from => 'Value', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
6
|
+
xml_accessor :percent, :from => 'Percent', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
7
7
|
xml_accessor :price_level_ref, :from => 'PriceLevelRef', :as => BaseReference
|
8
8
|
|
9
9
|
reference_setters :price_level_ref
|
@@ -19,10 +19,10 @@ module Quickbooks
|
|
19
19
|
xml_accessor :payment_ref_number, :from => 'PaymentRefNum'
|
20
20
|
xml_accessor :credit_card_payment, :from => 'CreditCardPayment', :as => CreditCardPayment
|
21
21
|
xml_accessor :total, :from => 'TotalAmt', :as => BigDecimal, :to_xml => :to_f.to_proc
|
22
|
-
xml_accessor :unapplied_amount, :from => 'UnappliedAmt', :as => BigDecimal, :to_xml =>
|
22
|
+
xml_accessor :unapplied_amount, :from => 'UnappliedAmt', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
23
23
|
xml_accessor :process_payment, :from => 'ProcessPayment'
|
24
24
|
xml_accessor :currency_ref, :from => 'CurrencyRef', :as => BaseReference
|
25
|
-
xml_accessor :exchange_rate, :from => 'ExchangeRate', :as => BigDecimal, :to_xml =>
|
25
|
+
xml_accessor :exchange_rate, :from => 'ExchangeRate', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
26
26
|
|
27
27
|
reference_setters :customer_ref, :ar_account_ref
|
28
28
|
reference_setters :payment_method_ref, :deposit_to_account_ref, :currency_ref
|
@@ -3,10 +3,10 @@ module Quickbooks
|
|
3
3
|
class PaymentLineDetail < BaseModel
|
4
4
|
xml_accessor :item_ref, :from => 'ItemRef', :as => BaseReference
|
5
5
|
xml_accessor :class_ref, :from => 'ClassRef', :as => BaseReference
|
6
|
-
xml_accessor :balance, :from => 'Balance', :as => BigDecimal, :to_xml =>
|
6
|
+
xml_accessor :balance, :from => 'Balance', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
7
7
|
xml_accessor :discount, :from => 'Discount', :as => DiscountOverride
|
8
8
|
|
9
9
|
reference_setters :item_ref, :class_ref
|
10
10
|
end
|
11
11
|
end
|
12
|
-
end
|
12
|
+
end
|
@@ -8,7 +8,7 @@ module Quickbooks
|
|
8
8
|
xml_accessor :id, :from => 'Id', :as => Integer
|
9
9
|
xml_accessor :name, :from => 'Name'
|
10
10
|
xml_accessor :active?, :from => 'Active'
|
11
|
-
xml_accessor :amount, :from => 'Amount', :as => BigDecimal, :to_xml =>
|
11
|
+
xml_accessor :amount, :from => 'Amount', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
@@ -24,7 +24,7 @@ module Quickbooks
|
|
24
24
|
xml_accessor :doc_number, :from => 'DocNumber'
|
25
25
|
xml_accessor :txn_date, :from => 'TxnDate', :as => Date
|
26
26
|
xml_accessor :private_note, :from => 'PrivateNote'
|
27
|
-
|
27
|
+
|
28
28
|
xml_accessor :line_items, :from => 'Line', :as => [PurchaseLineItem]
|
29
29
|
xml_accessor :account_ref, :from => 'AccountRef', :as => BaseReference
|
30
30
|
xml_accessor :txn_tax_detail, :from => 'TxnTaxDetail', :as => TransactionTaxDetail
|
@@ -32,7 +32,7 @@ module Quickbooks
|
|
32
32
|
xml_accessor :payment_type, :from => 'PaymentType'
|
33
33
|
xml_accessor :entity_ref, :from => 'EntityRef', :as => BaseReference
|
34
34
|
xml_accessor :remit_to_address, :from => 'RemitToAddr', :as => PhysicalAddress
|
35
|
-
xml_accessor :total_amount, :from => 'TotalAmt', :as => BigDecimal, :to_xml =>
|
35
|
+
xml_accessor :total_amount, :from => 'TotalAmt', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
36
36
|
xml_accessor :print_status, :from => 'PrintStatus'
|
37
37
|
xml_accessor :department_ref, :from => 'DepartmentRef', :as => BaseReference
|
38
38
|
|
@@ -4,7 +4,7 @@ module Quickbooks
|
|
4
4
|
xml_accessor :item_ref, :from => 'ItemRef', :as => BaseReference
|
5
5
|
xml_accessor :class_ref, :from => 'ClassRef', :as => BaseReference
|
6
6
|
xml_accessor :unit_price, :from => 'UnitPrice', :as => BigDecimal, :to_xml => Proc.new { |val| val.to_f }
|
7
|
-
xml_accessor :rate_percent, :from => 'RatePercent', :as => BigDecimal, :to_xml =>
|
7
|
+
xml_accessor :rate_percent, :from => 'RatePercent', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
8
8
|
xml_accessor :price_level_ref, :from => 'PriceLevelRef', :as => BaseReference
|
9
9
|
xml_accessor :quantity, :from => 'Qty', :as => BigDecimal, :to_xml => Proc.new { |val| val.to_f }
|
10
10
|
xml_accessor :tax_code_ref, :from => 'TaxCodeRef', :as => BaseReference
|
@@ -8,35 +8,37 @@ module Quickbooks
|
|
8
8
|
xml_accessor :id, :from => 'Id', :as => Integer
|
9
9
|
xml_accessor :sync_token, :from => 'SyncToken', :as => Integer
|
10
10
|
xml_accessor :meta_data, :from => 'MetaData', :as => MetaData
|
11
|
+
xml_accessor :auto_doc_number, :from => 'AutoDocNumber' # See auto_doc_number! method below for usage
|
11
12
|
xml_accessor :doc_number, :from => 'DocNumber'
|
12
13
|
xml_accessor :placed_on, :from => 'TxnDate', :as => Time
|
13
|
-
|
14
14
|
xml_accessor :line_items, :from => 'Line', :as => [Line]
|
15
15
|
xml_accessor :customer_ref, :from => 'CustomerRef', :as => BaseReference
|
16
16
|
xml_accessor :bill_email, :from => 'BillEmail', :as => EmailAddress
|
17
17
|
xml_accessor :bill_address, :from => 'BillAddr', :as => PhysicalAddress
|
18
18
|
xml_accessor :ship_address, :from => 'ShipAddr', :as => PhysicalAddress
|
19
|
-
|
20
19
|
xml_accessor :po_number, :from => 'PONumber'
|
21
|
-
|
22
20
|
xml_accessor :ship_method_ref, :from => 'ShipMethodRef'
|
23
21
|
xml_accessor :ship_date, :from => 'ShipDate', :as => Time
|
24
22
|
xml_accessor :tracking_num, :from => 'TrackingNum'
|
25
|
-
|
26
23
|
xml_accessor :payment_method_ref, :from => 'PaymentMethodRef', :as => BaseReference
|
27
24
|
xml_accessor :payment_ref_number, :from => 'PaymentRefNum'
|
28
|
-
|
29
25
|
xml_accessor :deposit_to_account_ref, :from => 'DepositToAccountRef', :as => BaseReference
|
30
|
-
|
31
26
|
xml_accessor :customer_memo, :from => 'CustomerMemo'
|
32
27
|
xml_accessor :private_note, :from => 'PrivateNote'
|
33
28
|
|
34
29
|
# readonly
|
35
30
|
xml_accessor :total, :from => 'TotalAmt', :as => BigDecimal
|
36
31
|
|
32
|
+
include DocumentNumbering
|
37
33
|
reference_setters :customer_ref, :payment_method_ref, :deposit_to_account_ref
|
38
34
|
|
39
35
|
validates_length_of :line_items, :minimum => 1
|
36
|
+
validate :document_numbering
|
37
|
+
|
38
|
+
def initialize(*args)
|
39
|
+
ensure_line_items_initialization
|
40
|
+
super
|
41
|
+
end
|
40
42
|
|
41
43
|
def email=(email)
|
42
44
|
self.bill_email = EmailAddress.new(email)
|
@@ -10,22 +10,11 @@ module Quickbooks
|
|
10
10
|
xml_accessor :meta_data, :from => "MetaData", :as => MetaData
|
11
11
|
xml_accessor :name, :from => "Name"
|
12
12
|
xml_accessor :description, :from => "Description"
|
13
|
-
xml_accessor :active
|
14
|
-
xml_accessor :taxable
|
15
|
-
xml_accessor :tax_group
|
13
|
+
xml_accessor :active?, :from => "Active"
|
14
|
+
xml_accessor :taxable?, :from => "Taxable"
|
15
|
+
xml_accessor :tax_group?, :from => "TaxGroup"
|
16
16
|
xml_accessor :sales_tax_rate_list, :from => "SalesTaxRateList", :as => SalesTaxRateList
|
17
17
|
|
18
|
-
def active?
|
19
|
-
active == "true"
|
20
|
-
end
|
21
|
-
|
22
|
-
def taxable?
|
23
|
-
taxable == "true"
|
24
|
-
end
|
25
|
-
|
26
|
-
def tax_group?
|
27
|
-
tax_group == "true"
|
28
|
-
end
|
29
18
|
end
|
30
19
|
end
|
31
20
|
end
|
@@ -2,7 +2,7 @@ module Quickbooks
|
|
2
2
|
module Model
|
3
3
|
class TaxLineDetail < BaseModel
|
4
4
|
|
5
|
-
xml_accessor :percent_based
|
5
|
+
xml_accessor :percent_based?, :from => 'PercentBased'
|
6
6
|
xml_accessor :net_amount_taxable, :from => 'NetAmountTaxable', :as => BigDecimal, :to_xml => Proc.new { |val| val.to_f }
|
7
7
|
xml_accessor :tax_inclusive_amount, :from => 'TaxInclusiveAmount', :as => BigDecimal, :to_xml => Proc.new { |val| val.to_f }
|
8
8
|
xml_accessor :override_delta_amount, :from => 'OverrideDeltaAmount', :as => BigDecimal, :to_xml => Proc.new { |val| val.to_f }
|
@@ -13,4 +13,4 @@ module Quickbooks
|
|
13
13
|
|
14
14
|
end
|
15
15
|
end
|
16
|
-
end
|
16
|
+
end
|
@@ -10,7 +10,7 @@ module Quickbooks
|
|
10
10
|
xml_accessor :meta_data, :from => "MetaData", :as => MetaData
|
11
11
|
xml_accessor :name, :from => "Name"
|
12
12
|
xml_accessor :description, :from => "Description"
|
13
|
-
xml_accessor :active
|
13
|
+
xml_accessor :active?, :from => "Active"
|
14
14
|
xml_accessor :rate_value, :from => "RateValue", :as => BigDecimal, :to_xml => :to_f.to_proc
|
15
15
|
xml_accessor :agency_ref, :from => "AgencyRef", :as => BaseReference
|
16
16
|
xml_accessor :tax_return_line_ref, :from => "TaxReturnLineRef", :as => BaseReference
|
@@ -23,9 +23,6 @@ module Quickbooks
|
|
23
23
|
reference_setters :agency_ref
|
24
24
|
reference_setters :tax_return_line_ref
|
25
25
|
|
26
|
-
def active?
|
27
|
-
active == "true"
|
28
|
-
end
|
29
26
|
end
|
30
27
|
end
|
31
28
|
end
|
@@ -3,7 +3,7 @@ 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 => 'TotalTax', :as => BigDecimal, :to_xml =>
|
6
|
+
xml_accessor :total_tax, :from => 'TotalTax', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
7
7
|
xml_accessor :lines, :from => 'TaxLine', :as => [TaxLine]
|
8
8
|
|
9
9
|
reference_setters :txn_tax_code_ref
|
@@ -15,8 +15,9 @@ module Quickbooks
|
|
15
15
|
HTTP_ACCEPT = 'application/xml'
|
16
16
|
HTTP_ACCEPT_ENCODING = 'gzip, deflate'
|
17
17
|
|
18
|
-
def initialize()
|
18
|
+
def initialize(attributes = {})
|
19
19
|
@base_uri = 'https://qb.sbfinance.intuit.com/v3/company'
|
20
|
+
attributes.each {|key, value| public_send("#{key}=", value) }
|
20
21
|
end
|
21
22
|
|
22
23
|
def access_token=(token)
|
@@ -40,6 +41,10 @@ module Quickbooks
|
|
40
41
|
"#{@base_uri}/#{@company_id}"
|
41
42
|
end
|
42
43
|
|
44
|
+
def default_model_query
|
45
|
+
"SELECT * FROM #{self.class.name.split("::").last}"
|
46
|
+
end
|
47
|
+
|
43
48
|
def url_for_query(query = nil, start_position = 1, max_results = 20)
|
44
49
|
query ||= default_model_query
|
45
50
|
query = "#{query} STARTPOSITION #{start_position} MAXRESULTS #{max_results}"
|
@@ -194,11 +199,12 @@ module Quickbooks
|
|
194
199
|
headers['Accept-Encoding'] = HTTP_ACCEPT_ENCODING
|
195
200
|
end
|
196
201
|
|
197
|
-
log "------
|
202
|
+
log "------ QUICKBOOKS-RUBY REQUEST ------"
|
198
203
|
log "METHOD = #{method}"
|
199
204
|
log "RESOURCE = #{url}"
|
200
|
-
log "BODY
|
201
|
-
log
|
205
|
+
log "REQUEST BODY:"
|
206
|
+
log(log_xml(body))
|
207
|
+
log "REQUEST HEADERS = #{headers.inspect}"
|
202
208
|
|
203
209
|
response = case method
|
204
210
|
when :get
|
@@ -208,7 +214,7 @@ module Quickbooks
|
|
208
214
|
else
|
209
215
|
raise "Do not know how to perform that HTTP operation"
|
210
216
|
end
|
211
|
-
check_response(response)
|
217
|
+
check_response(response, :request_xml => body)
|
212
218
|
end
|
213
219
|
|
214
220
|
def add_query_string_to_url(url, params)
|
@@ -219,25 +225,27 @@ module Quickbooks
|
|
219
225
|
end
|
220
226
|
end
|
221
227
|
|
222
|
-
def check_response(response)
|
228
|
+
def check_response(response, options = {})
|
229
|
+
log "------ QUICKBOOKS-RUBY RESPONSE ------"
|
223
230
|
log "RESPONSE CODE = #{response.code}"
|
224
|
-
log "RESPONSE BODY
|
231
|
+
log "RESPONSE BODY:"
|
232
|
+
log(log_xml(response.plain_body))
|
225
233
|
parse_xml(response.plain_body)
|
226
234
|
status = response.code.to_i
|
227
235
|
case status
|
228
236
|
when 200
|
229
237
|
# even HTTP 200 can contain an error, so we always have to peek for an Error
|
230
238
|
if response_is_error?
|
231
|
-
parse_and_raise_exception
|
239
|
+
parse_and_raise_exception(options)
|
232
240
|
else
|
233
241
|
response
|
234
242
|
end
|
235
243
|
when 302
|
236
244
|
raise "Unhandled HTTP Redirect"
|
237
|
-
when 401
|
245
|
+
when 401, 403
|
238
246
|
raise Quickbooks::AuthorizationFailure
|
239
247
|
when 400, 500
|
240
|
-
parse_and_raise_exception
|
248
|
+
parse_and_raise_exception(options)
|
241
249
|
when 503
|
242
250
|
raise Quickbooks::ServiceUnavailable
|
243
251
|
else
|
@@ -245,13 +253,13 @@ module Quickbooks
|
|
245
253
|
end
|
246
254
|
end
|
247
255
|
|
248
|
-
def parse_and_raise_exception
|
256
|
+
def parse_and_raise_exception(options = {})
|
249
257
|
err = parse_intuit_error
|
250
258
|
ex = Quickbooks::IntuitRequestException.new("#{err[:message]}:\n\t#{err[:detail]}")
|
251
259
|
ex.code = err[:code]
|
252
260
|
ex.detail = err[:detail]
|
253
261
|
ex.type = err[:type]
|
254
|
-
|
262
|
+
ex.request_xml = options[:request_xml]
|
255
263
|
raise ex
|
256
264
|
end
|
257
265
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Quickbooks
|
2
|
+
module Service
|
3
|
+
class Class < BaseService
|
4
|
+
|
5
|
+
def update(entity, options = {})
|
6
|
+
raise Quickbooks::InvalidModelException.new('Class sparse update is not supported by Intuit at this time') if options[:sparse] && options[:sparse] == true
|
7
|
+
super(entity, options)
|
8
|
+
end
|
9
|
+
|
10
|
+
def delete(classs)
|
11
|
+
classs.active = false
|
12
|
+
update(classs, :sparse => false)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def model
|
18
|
+
Quickbooks::Model::Class
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Quickbooks
|
2
|
+
module Service
|
3
|
+
class Department < BaseService
|
4
|
+
|
5
|
+
def update(entity, options = {})
|
6
|
+
raise Quickbooks::InvalidModelException.new('Department sparse update is not supported by Intuit at this time') if options[:sparse] && options[:sparse] == true
|
7
|
+
super(entity, options)
|
8
|
+
end
|
9
|
+
|
10
|
+
def delete(department)
|
11
|
+
department.active = false
|
12
|
+
update(department, :sparse => false)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def model
|
18
|
+
Quickbooks::Model::Department
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|