quickbooks-ruby-oauth2 0.6.1
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 +7 -0
- data/lib/quickbooks/faraday/middleware/gzip.rb +72 -0
- data/lib/quickbooks/model/access_token_response.rb +29 -0
- data/lib/quickbooks/model/account.rb +78 -0
- data/lib/quickbooks/model/account_based_expense_line_detail.rb +15 -0
- data/lib/quickbooks/model/attachable.rb +33 -0
- data/lib/quickbooks/model/attachable_ref.rb +22 -0
- data/lib/quickbooks/model/base_model.rb +120 -0
- data/lib/quickbooks/model/base_model_json.rb +16 -0
- data/lib/quickbooks/model/base_reference.rb +23 -0
- data/lib/quickbooks/model/batch_request.rb +45 -0
- data/lib/quickbooks/model/batch_response.rb +33 -0
- data/lib/quickbooks/model/bill.rb +45 -0
- data/lib/quickbooks/model/bill_line_item.rb +42 -0
- data/lib/quickbooks/model/bill_payment.rb +40 -0
- data/lib/quickbooks/model/bill_payment_check.rb +12 -0
- data/lib/quickbooks/model/bill_payment_credit_card.rb +10 -0
- data/lib/quickbooks/model/bill_payment_line_item.rb +21 -0
- data/lib/quickbooks/model/budget.rb +27 -0
- data/lib/quickbooks/model/budget_line_item.rb +15 -0
- data/lib/quickbooks/model/change_data_capture.rb +42 -0
- data/lib/quickbooks/model/change_model.rb +10 -0
- data/lib/quickbooks/model/check_payment.rb +11 -0
- data/lib/quickbooks/model/class.rb +31 -0
- data/lib/quickbooks/model/company_info.rb +69 -0
- data/lib/quickbooks/model/credit_card_payment.rb +17 -0
- data/lib/quickbooks/model/credit_memo.rb +59 -0
- data/lib/quickbooks/model/credit_memo_change.rb +8 -0
- data/lib/quickbooks/model/custom_field.rb +13 -0
- data/lib/quickbooks/model/customer.rb +76 -0
- data/lib/quickbooks/model/customer_change.rb +8 -0
- data/lib/quickbooks/model/definition.rb +46 -0
- data/lib/quickbooks/model/delivery_info.rb +8 -0
- data/lib/quickbooks/model/department.rb +31 -0
- data/lib/quickbooks/model/deposit.rb +44 -0
- data/lib/quickbooks/model/deposit_line_detail.rb +17 -0
- data/lib/quickbooks/model/deposit_line_item.rb +35 -0
- data/lib/quickbooks/model/description_line_detail.rb +7 -0
- data/lib/quickbooks/model/discount_line_detail.rb +15 -0
- data/lib/quickbooks/model/discount_override.rb +13 -0
- data/lib/quickbooks/model/document_numbering.rb +18 -0
- data/lib/quickbooks/model/effective_tax_rate.rb +15 -0
- data/lib/quickbooks/model/email_address.rb +19 -0
- data/lib/quickbooks/model/employee.rb +47 -0
- data/lib/quickbooks/model/entity.rb +16 -0
- data/lib/quickbooks/model/entity_ref.rb +8 -0
- data/lib/quickbooks/model/estimate.rb +76 -0
- data/lib/quickbooks/model/exchange_rate.rb +23 -0
- data/lib/quickbooks/model/fault.rb +16 -0
- data/lib/quickbooks/model/global_tax_calculation.rb +13 -0
- data/lib/quickbooks/model/group_line_detail.rb +13 -0
- data/lib/quickbooks/model/has_line_items.rb +14 -0
- data/lib/quickbooks/model/invoice.rb +107 -0
- data/lib/quickbooks/model/invoice_change.rb +9 -0
- data/lib/quickbooks/model/invoice_group_line_detail.rb +14 -0
- data/lib/quickbooks/model/invoice_line_item.rb +88 -0
- data/lib/quickbooks/model/item.rb +87 -0
- data/lib/quickbooks/model/item_based_expense_line_detail.rb +20 -0
- data/lib/quickbooks/model/item_change.rb +8 -0
- data/lib/quickbooks/model/item_group_detail.rb +9 -0
- data/lib/quickbooks/model/item_group_line.rb +20 -0
- data/lib/quickbooks/model/journal_entry.rb +36 -0
- data/lib/quickbooks/model/journal_entry_line_detail.rb +27 -0
- data/lib/quickbooks/model/line.rb +95 -0
- data/lib/quickbooks/model/line_ex.rb +9 -0
- data/lib/quickbooks/model/linked_transaction.rb +9 -0
- data/lib/quickbooks/model/markup_info.rb +12 -0
- data/lib/quickbooks/model/meta_data.rb +24 -0
- data/lib/quickbooks/model/name_value.rb +8 -0
- data/lib/quickbooks/model/other_contact_info.rb +8 -0
- data/lib/quickbooks/model/payment.rb +43 -0
- data/lib/quickbooks/model/payment_change.rb +8 -0
- data/lib/quickbooks/model/payment_line_detail.rb +12 -0
- data/lib/quickbooks/model/payment_method.rb +25 -0
- data/lib/quickbooks/model/physical_address.rb +40 -0
- data/lib/quickbooks/model/preferences.rb +49 -0
- data/lib/quickbooks/model/purchase.rb +57 -0
- data/lib/quickbooks/model/purchase_line_item.rb +44 -0
- data/lib/quickbooks/model/purchase_order.rb +50 -0
- data/lib/quickbooks/model/purchase_tax_rate_list.rb +11 -0
- data/lib/quickbooks/model/refund_receipt.rb +62 -0
- data/lib/quickbooks/model/refund_receipt_change.rb +8 -0
- data/lib/quickbooks/model/report.rb +52 -0
- data/lib/quickbooks/model/sales_item_line_detail.rb +16 -0
- data/lib/quickbooks/model/sales_receipt.rb +65 -0
- data/lib/quickbooks/model/sales_tax_rate_list.rb +11 -0
- data/lib/quickbooks/model/sub_total_line_detail.rb +13 -0
- data/lib/quickbooks/model/tax_agency.rb +18 -0
- data/lib/quickbooks/model/tax_code.rb +21 -0
- data/lib/quickbooks/model/tax_line.rb +15 -0
- data/lib/quickbooks/model/tax_line_detail.rb +16 -0
- data/lib/quickbooks/model/tax_rate.rb +28 -0
- data/lib/quickbooks/model/tax_rate_detail.rb +15 -0
- data/lib/quickbooks/model/tax_rate_detail_line.rb +23 -0
- data/lib/quickbooks/model/tax_service.rb +52 -0
- data/lib/quickbooks/model/telephone_number.rb +13 -0
- data/lib/quickbooks/model/term.rb +28 -0
- data/lib/quickbooks/model/time_activity.rb +79 -0
- data/lib/quickbooks/model/transaction_tax_detail.rb +12 -0
- data/lib/quickbooks/model/transfer.rb +21 -0
- data/lib/quickbooks/model/upload.rb +35 -0
- data/lib/quickbooks/model/validator.rb +10 -0
- data/lib/quickbooks/model/vendor.rb +53 -0
- data/lib/quickbooks/model/vendor_change.rb +8 -0
- data/lib/quickbooks/model/vendor_credit.rb +40 -0
- data/lib/quickbooks/model/web_site_address.rb +16 -0
- data/lib/quickbooks/service/access_token.rb +38 -0
- data/lib/quickbooks/service/account.rb +17 -0
- data/lib/quickbooks/service/attachable.rb +12 -0
- data/lib/quickbooks/service/base_service.rb +445 -0
- data/lib/quickbooks/service/base_service_json.rb +39 -0
- data/lib/quickbooks/service/batch.rb +11 -0
- data/lib/quickbooks/service/bill.rb +16 -0
- data/lib/quickbooks/service/bill_payment.rb +16 -0
- data/lib/quickbooks/service/budget.rb +12 -0
- data/lib/quickbooks/service/change_data_capture.rb +24 -0
- data/lib/quickbooks/service/change_service.rb +28 -0
- data/lib/quickbooks/service/class.rb +23 -0
- data/lib/quickbooks/service/company_info.rb +12 -0
- data/lib/quickbooks/service/credit_memo.rb +16 -0
- data/lib/quickbooks/service/credit_memo_change.rb +16 -0
- data/lib/quickbooks/service/customer.rb +18 -0
- data/lib/quickbooks/service/customer_change.rb +16 -0
- data/lib/quickbooks/service/department.rb +23 -0
- data/lib/quickbooks/service/deposit.rb +16 -0
- data/lib/quickbooks/service/employee.rb +24 -0
- data/lib/quickbooks/service/estimate.rb +22 -0
- data/lib/quickbooks/service/exchange_rate.rb +25 -0
- data/lib/quickbooks/service/invoice.rb +45 -0
- data/lib/quickbooks/service/invoice_change.rb +16 -0
- data/lib/quickbooks/service/item.rb +32 -0
- data/lib/quickbooks/service/item_change.rb +16 -0
- data/lib/quickbooks/service/journal_entry.rb +16 -0
- data/lib/quickbooks/service/payment.rb +29 -0
- data/lib/quickbooks/service/payment_change.rb +16 -0
- data/lib/quickbooks/service/payment_method.rb +30 -0
- data/lib/quickbooks/service/preferences.rb +12 -0
- data/lib/quickbooks/service/purchase.rb +16 -0
- data/lib/quickbooks/service/purchase_order.rb +16 -0
- data/lib/quickbooks/service/refund_receipt.rb +16 -0
- data/lib/quickbooks/service/refund_receipt_change.rb +16 -0
- data/lib/quickbooks/service/reports.rb +33 -0
- data/lib/quickbooks/service/responses/methods.rb +17 -0
- data/lib/quickbooks/service/responses/oauth1_http_response.rb +42 -0
- data/lib/quickbooks/service/responses/oauth2_http_response.rb +43 -0
- data/lib/quickbooks/service/responses/oauth_http_response.rb +21 -0
- data/lib/quickbooks/service/sales_receipt.rb +46 -0
- data/lib/quickbooks/service/service_crud.rb +75 -0
- data/lib/quickbooks/service/service_crud_json.rb +31 -0
- data/lib/quickbooks/service/tax_agency.rb +12 -0
- data/lib/quickbooks/service/tax_code.rb +12 -0
- data/lib/quickbooks/service/tax_rate.rb +12 -0
- data/lib/quickbooks/service/tax_service.rb +11 -0
- data/lib/quickbooks/service/term.rb +17 -0
- data/lib/quickbooks/service/time_activity.rb +16 -0
- data/lib/quickbooks/service/transfer.rb +16 -0
- data/lib/quickbooks/service/upload.rb +39 -0
- data/lib/quickbooks/service/vendor.rb +24 -0
- data/lib/quickbooks/service/vendor_change.rb +16 -0
- data/lib/quickbooks/service/vendor_credit.rb +16 -0
- data/lib/quickbooks/util/collection.rb +18 -0
- data/lib/quickbooks/util/http_encoding_helper.rb +54 -0
- data/lib/quickbooks/util/logging.rb +19 -0
- data/lib/quickbooks/util/multipart.rb +85 -0
- data/lib/quickbooks/util/name_entity.rb +85 -0
- data/lib/quickbooks/util/query_builder.rb +35 -0
- data/lib/quickbooks/version.rb +5 -0
- data/lib/quickbooks-ruby.rb +255 -0
- metadata +378 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module DocumentNumbering
|
|
2
|
+
|
|
3
|
+
# Convenience method for proper AutoDocNumber tag
|
|
4
|
+
# construction, which should be blank if auto
|
|
5
|
+
# document numbering is desired.
|
|
6
|
+
def auto_doc_number!
|
|
7
|
+
self.auto_doc_number = ''
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def document_numbering
|
|
13
|
+
if !auto_doc_number.nil? && !doc_number.nil?
|
|
14
|
+
errors.add(:doc_number, "DocumentNumber should not be specified if AutoDocNumber is.")
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'time'
|
|
2
|
+
|
|
3
|
+
module Quickbooks
|
|
4
|
+
module Model
|
|
5
|
+
class EffectiveTaxRate < BaseModel
|
|
6
|
+
XML_COLLECTION_NODE = "EffectiveTaxRate"
|
|
7
|
+
XML_NODE = "EffectiveTaxRate"
|
|
8
|
+
REST_RESOURCE = "effectivetaxrate"
|
|
9
|
+
|
|
10
|
+
xml_accessor :rate_value, :from => 'RateValue'
|
|
11
|
+
xml_accessor :effective_date, :from => 'EffectiveDate', :as => Time
|
|
12
|
+
xml_accessor :end_date, :from => 'EndDate', :as => Time
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Quickbooks
|
|
2
|
+
module Model
|
|
3
|
+
class EmailAddress < BaseModel
|
|
4
|
+
xml_accessor :address, :from => 'Address'
|
|
5
|
+
|
|
6
|
+
def to_xml(options = {})
|
|
7
|
+
return "" if address.to_s.empty?
|
|
8
|
+
super
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def initialize(email_address = nil)
|
|
12
|
+
unless email_address.nil?
|
|
13
|
+
self.address = email_address
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# == Business Rules
|
|
2
|
+
# * DisplayName, GivenName, MiddleName, FamilyName, and PrintOnCheckName must not contain a colon (":")
|
|
3
|
+
# * DisplayName must be unique across all other customers, employees, vendors, and other names.
|
|
4
|
+
|
|
5
|
+
module Quickbooks
|
|
6
|
+
module Model
|
|
7
|
+
class Employee < BaseModel
|
|
8
|
+
XML_COLLECTION_NODE = "Employee"
|
|
9
|
+
XML_NODE = "Employee"
|
|
10
|
+
REST_RESOURCE = 'employee'
|
|
11
|
+
include NameEntity::Quality
|
|
12
|
+
include NameEntity::PermitAlterations
|
|
13
|
+
|
|
14
|
+
xml_name XML_NODE
|
|
15
|
+
xml_accessor :id, :from => 'Id'
|
|
16
|
+
xml_accessor :sync_token, :from => 'SyncToken', :as => Integer
|
|
17
|
+
xml_accessor :meta_data, :from => 'MetaData', :as => MetaData
|
|
18
|
+
xml_accessor :organization?, :from => 'Organization'
|
|
19
|
+
xml_accessor :title, :from => 'Title'
|
|
20
|
+
xml_accessor :given_name, :from => 'GivenName'
|
|
21
|
+
xml_accessor :middle_name, :from => 'MiddleName'
|
|
22
|
+
xml_accessor :family_name, :from => 'FamilyName'
|
|
23
|
+
xml_accessor :suffix, :from => 'Suffix'
|
|
24
|
+
xml_accessor :display_name, :from => 'DisplayName'
|
|
25
|
+
xml_accessor :print_on_check_name, :from => 'PrintOnCheckName'
|
|
26
|
+
xml_accessor :active?, :from => 'Active'
|
|
27
|
+
xml_accessor :primary_phone, :from => 'PrimaryPhone', :as => TelephoneNumber
|
|
28
|
+
xml_accessor :mobile_phone, :from => 'Mobile', :as => TelephoneNumber
|
|
29
|
+
xml_accessor :primary_email_address, :from => 'PrimaryEmailAddr', :as => EmailAddress
|
|
30
|
+
xml_accessor :number, :from => 'EmployeeNumber'
|
|
31
|
+
xml_accessor :ssn, :from => 'SSN'
|
|
32
|
+
xml_accessor :address, :from => 'PrimaryAddr', :as => PhysicalAddress
|
|
33
|
+
xml_accessor :billable?, :from => 'BillableTime'
|
|
34
|
+
xml_accessor :billable_rate, :from => 'BillRate', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
|
35
|
+
xml_accessor :birth_date, :from => 'BirthDate', :as => Date
|
|
36
|
+
xml_accessor :gender, :from => 'Gender'
|
|
37
|
+
xml_accessor :hired_date, :from => 'HiredDate', :as => Date
|
|
38
|
+
xml_accessor :released_date, :from => 'ReleasedDate', :as => Date
|
|
39
|
+
|
|
40
|
+
#== Validations
|
|
41
|
+
validate :names_cannot_contain_invalid_characters
|
|
42
|
+
validate :email_address_is_valid
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Quickbooks
|
|
2
|
+
module Model
|
|
3
|
+
class Entity < BaseModel
|
|
4
|
+
include NameEntity::Quality
|
|
5
|
+
|
|
6
|
+
xml_accessor :type, :from => 'Type'
|
|
7
|
+
xml_accessor :entity_ref, :as => BaseReference
|
|
8
|
+
|
|
9
|
+
reference_setters :entity_ref
|
|
10
|
+
|
|
11
|
+
#== Validations
|
|
12
|
+
validate :entity_type_is_valid
|
|
13
|
+
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# == Business Rules
|
|
2
|
+
# The Estimate object has the following business rules and validations:
|
|
3
|
+
# * An Estimate must have at least one line that describes an item.
|
|
4
|
+
# * An Estimate must have a reference to a customer.
|
|
5
|
+
# * If shipping address and billing address are not provided, the customer address is used to fill those values.
|
|
6
|
+
# * For US country, CustomSalesTax cannot be used as TaxCodeRef.
|
|
7
|
+
|
|
8
|
+
module Quickbooks
|
|
9
|
+
module Model
|
|
10
|
+
class Estimate < BaseModel
|
|
11
|
+
include GlobalTaxCalculation
|
|
12
|
+
include HasLineItems
|
|
13
|
+
|
|
14
|
+
#== Constants
|
|
15
|
+
REST_RESOURCE = 'estimate'
|
|
16
|
+
XML_COLLECTION_NODE = "Estimate"
|
|
17
|
+
XML_NODE = "Estimate"
|
|
18
|
+
|
|
19
|
+
xml_accessor :id, :from => 'Id'
|
|
20
|
+
xml_accessor :sync_token, :from => 'SyncToken', :as => Integer
|
|
21
|
+
xml_accessor :meta_data, :from => 'MetaData', :as => MetaData
|
|
22
|
+
xml_accessor :custom_fields, :from => 'CustomField', :as => [CustomField]
|
|
23
|
+
xml_accessor :doc_number, :from => 'DocNumber'
|
|
24
|
+
xml_accessor :txn_date, :from => 'TxnDate', :as => Date
|
|
25
|
+
xml_accessor :private_note, :from => 'PrivateNote'
|
|
26
|
+
|
|
27
|
+
xml_accessor :department_ref, :from => 'DepartmentRef', :as => BaseReference
|
|
28
|
+
xml_accessor :linked_transactions, :from => 'LinkedTxn', :as => [LinkedTransaction]
|
|
29
|
+
xml_accessor :line_items, :from => 'Line', :as => [InvoiceLineItem]
|
|
30
|
+
xml_accessor :txn_tax_detail, :from => 'TxnTaxDetail', :as => TransactionTaxDetail
|
|
31
|
+
xml_accessor :txn_status, :from => 'TxnStatus'
|
|
32
|
+
|
|
33
|
+
xml_accessor :customer_ref, :from => 'CustomerRef', :as => BaseReference
|
|
34
|
+
xml_accessor :customer_memo, :from => 'CustomerMemo'
|
|
35
|
+
xml_accessor :billing_address, :from => 'BillAddr', :as => PhysicalAddress
|
|
36
|
+
xml_accessor :shipping_address, :from => 'ShipAddr', :as => PhysicalAddress
|
|
37
|
+
xml_accessor :class_ref, :from => 'ClassRef', :as => BaseReference
|
|
38
|
+
xml_accessor :sales_term_ref, :from => 'SalesTermRef', :as => BaseReference
|
|
39
|
+
xml_accessor :total, :from => 'TotalAmt', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
|
40
|
+
xml_accessor :ship_method_ref, :from => 'ShipMethodRef', :as => BaseReference
|
|
41
|
+
xml_accessor :ship_date, :from => 'ShipDate', :as => Date
|
|
42
|
+
|
|
43
|
+
xml_accessor :currency_ref, :from => 'CurrencyRef', :as => BaseReference
|
|
44
|
+
xml_accessor :exchange_rate, :from => 'ExchangeRate', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
|
45
|
+
xml_accessor :due_date, :from => 'DueDate', :as => Date
|
|
46
|
+
xml_accessor :deposit_to_account_ref, :from => 'DepositToAccountRef', :as => BaseReference
|
|
47
|
+
|
|
48
|
+
xml_accessor :apply_tax_after_discount?, :from => 'ApplyTaxAfterDiscount'
|
|
49
|
+
xml_accessor :print_status, :from => 'PrintStatus'
|
|
50
|
+
xml_accessor :email_status, :from => 'EmailStatus'
|
|
51
|
+
xml_accessor :bill_email, :from => 'BillEmail', :as => EmailAddress
|
|
52
|
+
xml_accessor :expiration_date, :from => 'ExpirationDate', :as => Date
|
|
53
|
+
xml_accessor :accepted_by, :from => 'AcceptedBy'
|
|
54
|
+
xml_accessor :accepted_date, :from => 'AcceptedDate', :as => Date
|
|
55
|
+
|
|
56
|
+
reference_setters
|
|
57
|
+
|
|
58
|
+
#== This adds aliases for backwards compatability to old attributes names
|
|
59
|
+
alias_method :total_amount, :total
|
|
60
|
+
alias_method :total_amount=, :total=
|
|
61
|
+
|
|
62
|
+
#== Validations
|
|
63
|
+
validate :line_item_size
|
|
64
|
+
validate :existence_of_customer_ref
|
|
65
|
+
|
|
66
|
+
private
|
|
67
|
+
|
|
68
|
+
def existence_of_customer_ref
|
|
69
|
+
if customer_ref.nil? || (customer_ref && customer_ref.value == 0)
|
|
70
|
+
errors.add(:customer_ref, "CustomerRef is required and must be a non-zero value.")
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Quickbooks
|
|
2
|
+
module Model
|
|
3
|
+
class ExchangeRate < BaseModel
|
|
4
|
+
XML_COLLECTION_NODE = "ExchangeRate"
|
|
5
|
+
XML_NODE = "ExchangeRate"
|
|
6
|
+
REST_RESOURCE = "exchangerate"
|
|
7
|
+
|
|
8
|
+
xml_accessor :id, :from => "Id"
|
|
9
|
+
xml_accessor :sync_token, :from => "SyncToken", :as => Integer
|
|
10
|
+
xml_accessor :meta_data, :from => "MetaData", :as => MetaData
|
|
11
|
+
|
|
12
|
+
xml_accessor :custom_fields, :from => 'CustomField', :as => [CustomField]
|
|
13
|
+
xml_accessor :source_currency_code, :from => 'SourceCurrencyCode'
|
|
14
|
+
xml_accessor :target_currency_code, :from => 'TargetCurrencyCode'
|
|
15
|
+
xml_accessor :rate, :from => 'Rate', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
|
16
|
+
xml_accessor :as_of_date, :from => 'AsOfDate', :as => Date
|
|
17
|
+
|
|
18
|
+
validates_presence_of :source_currency_code, :rate, :as_of_date
|
|
19
|
+
validates_length_of :source_currency_code, :is => 3
|
|
20
|
+
validates_length_of :target_currency_code, :is => 3
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Quickbooks
|
|
2
|
+
module Model
|
|
3
|
+
class Fault < BaseModel
|
|
4
|
+
class Error
|
|
5
|
+
include ROXML
|
|
6
|
+
xml_name 'Error'
|
|
7
|
+
xml_accessor :code, :from => "@code"
|
|
8
|
+
xml_accessor :element, :from => "@element"
|
|
9
|
+
xml_accessor :message, :from => "Message"
|
|
10
|
+
xml_accessor :detail, :from => "Detail"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
xml_accessor :errors, :as => [Quickbooks::Model::Fault::Error]
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module GlobalTaxCalculation
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
TAX_INCLUSIVE = "TaxInclusive"
|
|
5
|
+
TAX_EXCLUDED = "TaxExcluded"
|
|
6
|
+
NOT_APPLICABLE = "NotApplicable"
|
|
7
|
+
GLOBAL_TAX_CALCULATION = [TAX_INCLUSIVE, 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
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Quickbooks
|
|
2
|
+
module Model
|
|
3
|
+
class GroupLineDetail < BaseModel
|
|
4
|
+
include HasLineItems
|
|
5
|
+
|
|
6
|
+
xml_accessor :group_item_ref, :from => 'CustomerRef', :as => BaseReference
|
|
7
|
+
xml_accessor :quantity, :from => 'Quantity', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
|
8
|
+
xml_accessor :line_items, :from => 'Line', :as => [Line]
|
|
9
|
+
|
|
10
|
+
reference_setters :group_item_ref
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# == Business Rules
|
|
2
|
+
# * An invoice must have at least one Line that describes an item.
|
|
3
|
+
# * An invoice must have CustomerRef populated.
|
|
4
|
+
# * The DocNumber attribute is populated automatically by the data service if not supplied.
|
|
5
|
+
# * If ShipAddr, BillAddr, or both are not provided, the appropriate customer address from Customer is used to fill those values.
|
|
6
|
+
# * DocNumber, if supplied, must be unique.
|
|
7
|
+
|
|
8
|
+
module Quickbooks
|
|
9
|
+
module Model
|
|
10
|
+
class Invoice < BaseModel
|
|
11
|
+
include DocumentNumbering
|
|
12
|
+
include GlobalTaxCalculation
|
|
13
|
+
include HasLineItems
|
|
14
|
+
|
|
15
|
+
#== Constants
|
|
16
|
+
REST_RESOURCE = 'invoice'
|
|
17
|
+
XML_COLLECTION_NODE = "Invoice"
|
|
18
|
+
XML_NODE = "Invoice"
|
|
19
|
+
EMAIL_STATUS_NEED_TO_SEND = 'NeedToSend'
|
|
20
|
+
|
|
21
|
+
xml_accessor :id, :from => 'Id'
|
|
22
|
+
xml_accessor :sync_token, :from => 'SyncToken', :as => Integer
|
|
23
|
+
xml_accessor :meta_data, :from => 'MetaData', :as => MetaData
|
|
24
|
+
xml_accessor :custom_fields, :from => 'CustomField', :as => [CustomField]
|
|
25
|
+
xml_accessor :auto_doc_number, :from => 'AutoDocNumber' # See auto_doc_number! method below for usage
|
|
26
|
+
xml_accessor :doc_number, :from => 'DocNumber'
|
|
27
|
+
xml_accessor :txn_date, :from => 'TxnDate', :as => Date
|
|
28
|
+
xml_accessor :currency_ref, :from => 'CurrencyRef', :as => BaseReference
|
|
29
|
+
xml_accessor :exchange_rate, :from => 'ExchangeRate', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
|
30
|
+
xml_accessor :private_note, :from => 'PrivateNote'
|
|
31
|
+
xml_accessor :linked_transactions, :from => 'LinkedTxn', :as => [LinkedTransaction]
|
|
32
|
+
xml_accessor :line_items, :from => 'Line', :as => [InvoiceLineItem]
|
|
33
|
+
xml_accessor :txn_tax_detail, :from => 'TxnTaxDetail', :as => TransactionTaxDetail
|
|
34
|
+
xml_accessor :customer_ref, :from => 'CustomerRef', :as => BaseReference
|
|
35
|
+
xml_accessor :customer_memo, :from => 'CustomerMemo'
|
|
36
|
+
xml_accessor :billing_address, :from => 'BillAddr', :as => PhysicalAddress
|
|
37
|
+
xml_accessor :shipping_address, :from => 'ShipAddr', :as => PhysicalAddress
|
|
38
|
+
xml_accessor :class_ref, :from => 'ClassRef', :as => BaseReference
|
|
39
|
+
xml_accessor :sales_term_ref, :from => 'SalesTermRef', :as => BaseReference
|
|
40
|
+
xml_accessor :due_date, :from => 'DueDate', :as => Date
|
|
41
|
+
xml_accessor :ship_method_ref, :from => 'ShipMethodRef', :as => BaseReference
|
|
42
|
+
xml_accessor :ship_date, :from => 'ShipDate', :as => Date
|
|
43
|
+
xml_accessor :tracking_num, :from => 'TrackingNum'
|
|
44
|
+
xml_accessor :ar_account_ref, :from => 'ARAccountRef', :as => BaseReference
|
|
45
|
+
xml_accessor :total, :from => 'TotalAmt', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
|
46
|
+
xml_accessor :home_total, :from => 'HomeTotalAmt', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
|
47
|
+
xml_accessor :apply_tax_after_discount?, :from => 'ApplyTaxAfterDiscount'
|
|
48
|
+
xml_accessor :print_status, :from => 'PrintStatus'
|
|
49
|
+
xml_accessor :email_status, :from => 'EmailStatus'
|
|
50
|
+
xml_accessor :balance, :from => 'Balance', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
|
51
|
+
xml_accessor :home_balance, :from => 'HomeBalance', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
|
52
|
+
xml_accessor :deposit, :from => 'Deposit', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
|
53
|
+
xml_accessor :department_ref, :from => 'DepartmentRef', :as => BaseReference
|
|
54
|
+
xml_accessor :allow_ipn_payment?, :from => 'AllowIPNPayment'
|
|
55
|
+
xml_accessor :delivery_info, :from => 'DeliveryInfo', :as => DeliveryInfo
|
|
56
|
+
xml_accessor :bill_email, :from => 'BillEmail', :as => EmailAddress
|
|
57
|
+
xml_accessor :allow_online_payment?, :from => 'AllowOnlinePayment'
|
|
58
|
+
xml_accessor :allow_online_credit_card_payment?, :from => 'AllowOnlineCreditCardPayment'
|
|
59
|
+
xml_accessor :allow_online_ach_payment?, :from => 'AllowOnlineACHPayment'
|
|
60
|
+
xml_accessor :deposit_to_account_ref, :from => 'DepositToAccountRef', :as => BaseReference
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
reference_setters
|
|
64
|
+
|
|
65
|
+
#== This adds aliases for backwards compatability to old attributes names
|
|
66
|
+
alias_method :total_amount, :total
|
|
67
|
+
alias_method :total_amount=, :total=
|
|
68
|
+
alias_method :home_total_amount, :home_total
|
|
69
|
+
alias_method :home_total_amount=, :home_total=
|
|
70
|
+
|
|
71
|
+
#== Validations
|
|
72
|
+
validate :line_item_size
|
|
73
|
+
validate :existence_of_customer_ref
|
|
74
|
+
validate :required_bill_email_if_email_delivery
|
|
75
|
+
validate :document_numbering
|
|
76
|
+
|
|
77
|
+
def required_bill_email_if_email_delivery
|
|
78
|
+
return unless email_status_for_delivery?
|
|
79
|
+
|
|
80
|
+
if bill_email.nil?
|
|
81
|
+
errors.add(:bill_email, "BillEmail is required if EmailStatus=NeedToSend")
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def billing_email_address=(email_address_string)
|
|
86
|
+
self.bill_email = EmailAddress.new(email_address_string)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def wants_billing_email_sent!
|
|
91
|
+
self.email_status = EMAIL_STATUS_NEED_TO_SEND
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def email_status_for_delivery?
|
|
95
|
+
email_status == EMAIL_STATUS_NEED_TO_SEND
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def existence_of_customer_ref
|
|
100
|
+
if customer_ref.nil? || (customer_ref && customer_ref.value == 0)
|
|
101
|
+
errors.add(:customer_ref, "CustomerRef is required and must be a non-zero value.")
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Quickbooks
|
|
2
|
+
module Model
|
|
3
|
+
class InvoiceGroupLineDetail < InvoiceLineItem
|
|
4
|
+
include HasLineItems
|
|
5
|
+
|
|
6
|
+
xml_accessor :id, :from => 'Id'
|
|
7
|
+
xml_accessor :group_item_ref, :from => 'GroupItemRef', :as => BaseReference
|
|
8
|
+
xml_accessor :quantity, :from => 'Quantity', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
|
9
|
+
xml_accessor :line_items, :from => 'Line', :as => [InvoiceLineItem]
|
|
10
|
+
|
|
11
|
+
reference_setters :group_item_ref
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
module Quickbooks
|
|
2
|
+
module Model
|
|
3
|
+
class InvoiceLineItem < BaseModel
|
|
4
|
+
require 'quickbooks/model/invoice_group_line_detail'
|
|
5
|
+
|
|
6
|
+
#== Constants
|
|
7
|
+
SALES_LINE_ITEM_DETAIL = 'SalesItemLineDetail'
|
|
8
|
+
SUB_TOTAL_LINE_DETAIL = 'SubTotalLineDetail'
|
|
9
|
+
PAYMENT_LINE_DETAIL = 'PaymentLineDetail'
|
|
10
|
+
DISCOUNT_LINE_DETAIL = 'DiscountLineDetail'
|
|
11
|
+
INVOICE_GROUP_LINE_DETAIL = 'GroupLineDetail'
|
|
12
|
+
DESCRIPTION_LINE_DETAIL = 'DescriptionLineDetail'
|
|
13
|
+
DESCRIPTION_DETAIL_TYPE = 'DescriptionOnly'
|
|
14
|
+
|
|
15
|
+
xml_accessor :id, :from => 'Id'
|
|
16
|
+
xml_accessor :line_num, :from => 'LineNum', :as => Integer
|
|
17
|
+
xml_accessor :description, :from => 'Description'
|
|
18
|
+
xml_accessor :amount, :from => 'Amount', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
|
19
|
+
xml_accessor :detail_type, :from => 'DetailType'
|
|
20
|
+
|
|
21
|
+
#== Various detail types
|
|
22
|
+
xml_accessor :sales_line_item_detail, :from => SALES_LINE_ITEM_DETAIL, :as => SalesItemLineDetail
|
|
23
|
+
xml_accessor :sub_total_line_detail, :from => SUB_TOTAL_LINE_DETAIL, :as => SubTotalLineDetail
|
|
24
|
+
xml_accessor :payment_line_detail, :from => PAYMENT_LINE_DETAIL, :as => PaymentLineDetail
|
|
25
|
+
xml_accessor :discount_line_detail, :from => DISCOUNT_LINE_DETAIL, :as => DiscountLineDetail
|
|
26
|
+
xml_accessor :group_line_detail, :from => INVOICE_GROUP_LINE_DETAIL, :as => InvoiceGroupLineDetail
|
|
27
|
+
xml_accessor :description_line_detail, :from => DESCRIPTION_LINE_DETAIL, :as => DescriptionLineDetail
|
|
28
|
+
|
|
29
|
+
def group_line_detail?
|
|
30
|
+
detail_type.to_s == INVOICE_GROUP_LINE_DETAIL
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def sales_item?
|
|
34
|
+
detail_type.to_s == SALES_LINE_ITEM_DETAIL
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def sub_total_item?
|
|
38
|
+
detail_type.to_s == SUB_TOTAL_LINE_DETAIL
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def discount_item?
|
|
42
|
+
detail_type.to_s == DISCOUNT_LINE_DETAIL
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def description_only?
|
|
46
|
+
# The detail type for a description-only line detail differs slightly
|
|
47
|
+
# from the node name (DescriptionOnly vs DescriptionLineDetail)
|
|
48
|
+
detail_type.to_s == DESCRIPTION_DETAIL_TYPE
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def sales_item!
|
|
52
|
+
self.detail_type = SALES_LINE_ITEM_DETAIL
|
|
53
|
+
self.sales_line_item_detail = SalesItemLineDetail.new
|
|
54
|
+
|
|
55
|
+
yield self.sales_line_item_detail if block_given?
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def group_line_detail!
|
|
59
|
+
self.detail_type = INVOICE_GROUP_LINE_DETAIL
|
|
60
|
+
self.group_line_detail = InvoiceGroupLineDetail.new
|
|
61
|
+
|
|
62
|
+
yield self.group_line_detail if block_given?
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def payment_item!
|
|
66
|
+
self.detail_type = PAYMENT_LINE_DETAIL
|
|
67
|
+
self.payment_line_detail = PaymentLineDetail.new
|
|
68
|
+
|
|
69
|
+
yield self.payment_line_detail if block_given?
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def discount_item!
|
|
73
|
+
self.detail_type = DISCOUNT_LINE_DETAIL
|
|
74
|
+
self.discount_line_detail = DiscountLineDetail.new
|
|
75
|
+
|
|
76
|
+
yield self.discount_line_detail if block_given?
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def description_only!
|
|
80
|
+
self.detail_type = DESCRIPTION_DETAIL_TYPE
|
|
81
|
+
self.description_line_detail = DescriptionLineDetail.new
|
|
82
|
+
|
|
83
|
+
yield self.description_line_detail if block_given?
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Business Rules
|
|
2
|
+
# * The item name must be unique.
|
|
3
|
+
# * Service item types must have IncomeAccountRef.
|
|
4
|
+
# * Service item types must have ExpenseAccountRef.
|
|
5
|
+
|
|
6
|
+
module Quickbooks
|
|
7
|
+
module Model
|
|
8
|
+
class Item < BaseModel
|
|
9
|
+
|
|
10
|
+
XML_COLLECTION_NODE = "Item"
|
|
11
|
+
XML_NODE = "Item"
|
|
12
|
+
REST_RESOURCE = 'item'
|
|
13
|
+
MINORVERSION = 4
|
|
14
|
+
|
|
15
|
+
INVENTORY_TYPE = 'Inventory'
|
|
16
|
+
NON_INVENTORY_TYPE = 'NonInventory'
|
|
17
|
+
SERVICE_TYPE = 'Service'
|
|
18
|
+
CATEGORY_TYPE = 'Category'
|
|
19
|
+
ITEM_TYPES = [INVENTORY_TYPE, NON_INVENTORY_TYPE, SERVICE_TYPE, CATEGORY_TYPE]
|
|
20
|
+
|
|
21
|
+
xml_name 'Item'
|
|
22
|
+
xml_accessor :id, :from => 'Id'
|
|
23
|
+
xml_accessor :sync_token, :from => 'SyncToken', :as => Integer
|
|
24
|
+
xml_accessor :meta_data, :from => 'MetaData', :as => MetaData
|
|
25
|
+
xml_accessor :name, :from => 'Name'
|
|
26
|
+
xml_accessor :sku, :from => 'Sku'
|
|
27
|
+
xml_accessor :description, :from => 'Description'
|
|
28
|
+
xml_accessor :active?, :from => 'Active'
|
|
29
|
+
xml_accessor :sub_item?, :from => 'SubItem'
|
|
30
|
+
xml_accessor :parent_ref, :from => 'ParentRef', :as => Integer
|
|
31
|
+
xml_accessor :level, :from => 'Level', :as => Integer
|
|
32
|
+
|
|
33
|
+
# read-only
|
|
34
|
+
xml_accessor :fully_qualified_name, :from => 'FullyQualifiedName'
|
|
35
|
+
xml_accessor :taxable?, :from => 'Taxable'
|
|
36
|
+
xml_accessor :sales_tax_included?, :from => 'SalesTaxIncluded'
|
|
37
|
+
xml_accessor :unit_price, :from => 'UnitPrice', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
|
38
|
+
xml_accessor :rate_percent, :from => 'RatePercent', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
|
39
|
+
xml_accessor :type, :from => 'Type'
|
|
40
|
+
xml_accessor :income_account_ref, :from => 'IncomeAccountRef', :as => BaseReference
|
|
41
|
+
xml_accessor :purchase_desc, :from => 'PurchaseDesc'
|
|
42
|
+
xml_accessor :purchase_tax_included?, :from => 'PurchaseTaxIncluded'
|
|
43
|
+
xml_accessor :purchase_cost, :from => 'PurchaseCost', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
|
44
|
+
xml_accessor :expense_account_ref, :from => 'ExpenseAccountRef', :as => BaseReference
|
|
45
|
+
xml_accessor :asset_account_ref, :from => 'AssetAccountRef', :as => BaseReference
|
|
46
|
+
xml_accessor :track_quantity_on_hand?, :from => 'TrackQtyOnHand'
|
|
47
|
+
xml_accessor :quantity_on_hand, :from => 'QtyOnHand', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
|
48
|
+
xml_accessor :sales_tax_code_ref, :from => 'SalesTaxCodeRef', :as => BaseReference
|
|
49
|
+
xml_accessor :purchase_tax_code_ref, :from => 'PurchaseTaxCodeRef', :as => BaseReference
|
|
50
|
+
xml_accessor :inv_start_date, :from => 'InvStartDate', :as => Date
|
|
51
|
+
|
|
52
|
+
xml_accessor :print_grouped_items?, :from => 'PrintGroupedItems'
|
|
53
|
+
|
|
54
|
+
xml_accessor :item_group_details, :from => 'ItemGroupDetail', :as => ItemGroupDetail
|
|
55
|
+
|
|
56
|
+
reference_setters :parent_ref, :income_account_ref, :expense_account_ref
|
|
57
|
+
reference_setters :asset_account_ref, :sales_tax_code_ref, :purchase_tax_code_ref
|
|
58
|
+
|
|
59
|
+
#== Validations
|
|
60
|
+
validates_length_of :name, :minimum => 1
|
|
61
|
+
validates_inclusion_of :type, :in => ITEM_TYPES
|
|
62
|
+
|
|
63
|
+
def initialize(*args)
|
|
64
|
+
self.type = INVENTORY_TYPE
|
|
65
|
+
super
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def valid_for_create?
|
|
69
|
+
valid?
|
|
70
|
+
errors.empty?
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# To delete an object Intuit requires we provide Id and SyncToken fields
|
|
74
|
+
def valid_for_deletion?
|
|
75
|
+
return false if(id.nil? || sync_token.nil?)
|
|
76
|
+
id.to_i > 0 && !sync_token.to_s.empty? && sync_token.to_i >= 0
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def valid_for_update?
|
|
80
|
+
if sync_token.nil?
|
|
81
|
+
errors.add(:sync_token, "Missing required attribute SyncToken for update")
|
|
82
|
+
end
|
|
83
|
+
errors.empty?
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'quickbooks/model/markup_info'
|
|
2
|
+
|
|
3
|
+
module Quickbooks
|
|
4
|
+
module Model
|
|
5
|
+
class ItemBasedExpenseLineDetail < BaseModel
|
|
6
|
+
xml_accessor :item_ref, :from => 'ItemRef', :as => BaseReference
|
|
7
|
+
xml_accessor :class_ref, :from => 'ClassRef', :as => BaseReference
|
|
8
|
+
xml_accessor :unit_price, :from => 'UnitPrice', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
|
9
|
+
xml_accessor :rate_percent, :from => 'RatePercent', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
|
10
|
+
xml_accessor :price_level_ref, :from => 'PriceLevelRef', :as => BaseReference
|
|
11
|
+
xml_accessor :markup_info, :from => 'MarkupInfo', :as => MarkupInfo
|
|
12
|
+
xml_accessor :quantity, :from => 'Qty', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
|
13
|
+
xml_accessor :tax_code_ref, :from => 'TaxCodeRef', :as => BaseReference
|
|
14
|
+
xml_accessor :customer_ref, :from => 'CustomerRef', :as => BaseReference
|
|
15
|
+
xml_accessor :billable_status, :from => 'BillableStatus'
|
|
16
|
+
|
|
17
|
+
reference_setters :item_ref, :class_ref, :price_level_ref, :customer_ref, :tax_code_ref
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Quickbooks
|
|
2
|
+
module Model
|
|
3
|
+
class ItemGroupLine < BaseModel
|
|
4
|
+
xml_accessor :item_ref, :from => 'ItemRef', :as => BaseReference
|
|
5
|
+
xml_accessor :quantity, :from => 'Qty'
|
|
6
|
+
|
|
7
|
+
def id
|
|
8
|
+
item_ref.value.to_i
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def name
|
|
12
|
+
item_ref.name
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def type
|
|
16
|
+
item_ref.type
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|