quickeebooks 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. data/Gemfile +3 -0
  2. data/Gemfile.lock +52 -0
  3. data/MIT-LICENSE +9 -0
  4. data/README.md +306 -0
  5. data/Rakefile +17 -0
  6. data/lib/quickeebooks.rb +89 -0
  7. data/lib/quickeebooks/online/model/account.rb +47 -0
  8. data/lib/quickeebooks/online/model/account_detail_type.rb +233 -0
  9. data/lib/quickeebooks/online/model/account_reference.rb +17 -0
  10. data/lib/quickeebooks/online/model/address.rb +42 -0
  11. data/lib/quickeebooks/online/model/customer.rb +66 -0
  12. data/lib/quickeebooks/online/model/customer_custom_field.rb +51 -0
  13. data/lib/quickeebooks/online/model/email.rb +24 -0
  14. data/lib/quickeebooks/online/model/intuit_type.rb +25 -0
  15. data/lib/quickeebooks/online/model/invoice.rb +50 -0
  16. data/lib/quickeebooks/online/model/invoice_header.rb +29 -0
  17. data/lib/quickeebooks/online/model/invoice_line_item.rb +22 -0
  18. data/lib/quickeebooks/online/model/item.rb +47 -0
  19. data/lib/quickeebooks/online/model/meta_data.rb +27 -0
  20. data/lib/quickeebooks/online/model/note.rb +11 -0
  21. data/lib/quickeebooks/online/model/open_balance.rb +11 -0
  22. data/lib/quickeebooks/online/model/phone.rb +12 -0
  23. data/lib/quickeebooks/online/model/price.rb +18 -0
  24. data/lib/quickeebooks/online/model/purchase_cost.rb +11 -0
  25. data/lib/quickeebooks/online/model/unit_price.rb +11 -0
  26. data/lib/quickeebooks/online/model/web_site.rb +16 -0
  27. data/lib/quickeebooks/online/service/account.rb +52 -0
  28. data/lib/quickeebooks/online/service/customer.rb +57 -0
  29. data/lib/quickeebooks/online/service/entitlement.rb +15 -0
  30. data/lib/quickeebooks/online/service/filter.rb +96 -0
  31. data/lib/quickeebooks/online/service/invoice.rb +50 -0
  32. data/lib/quickeebooks/online/service/item.rb +52 -0
  33. data/lib/quickeebooks/online/service/pagination.rb +19 -0
  34. data/lib/quickeebooks/online/service/service_base.rb +202 -0
  35. data/lib/quickeebooks/online/service/sort.rb +19 -0
  36. data/lib/quickeebooks/version.rb +5 -0
  37. data/lib/quickeebooks/windows/model/account.rb +67 -0
  38. data/lib/quickeebooks/windows/model/account_detail_type.rb +233 -0
  39. data/lib/quickeebooks/windows/model/account_reference.rb +19 -0
  40. data/lib/quickeebooks/windows/model/address.rb +36 -0
  41. data/lib/quickeebooks/windows/model/custom_field.rb +13 -0
  42. data/lib/quickeebooks/windows/model/customer.rb +109 -0
  43. data/lib/quickeebooks/windows/model/email.rb +44 -0
  44. data/lib/quickeebooks/windows/model/intuit_type.rb +17 -0
  45. data/lib/quickeebooks/windows/model/invoice.rb +44 -0
  46. data/lib/quickeebooks/windows/model/invoice_header.rb +65 -0
  47. data/lib/quickeebooks/windows/model/invoice_line_item.rb +38 -0
  48. data/lib/quickeebooks/windows/model/item.rb +84 -0
  49. data/lib/quickeebooks/windows/model/meta_data.rb +31 -0
  50. data/lib/quickeebooks/windows/model/note.rb +19 -0
  51. data/lib/quickeebooks/windows/model/open_balance.rb +11 -0
  52. data/lib/quickeebooks/windows/model/phone.rb +20 -0
  53. data/lib/quickeebooks/windows/model/price.rb +18 -0
  54. data/lib/quickeebooks/windows/model/purchase_cost.rb +12 -0
  55. data/lib/quickeebooks/windows/model/tax_line.rb +18 -0
  56. data/lib/quickeebooks/windows/model/unit_price.rb +12 -0
  57. data/lib/quickeebooks/windows/model/vendor_reference.rb +13 -0
  58. data/lib/quickeebooks/windows/model/web_site.rb +19 -0
  59. data/lib/quickeebooks/windows/service/account.rb +16 -0
  60. data/lib/quickeebooks/windows/service/customer.rb +16 -0
  61. data/lib/quickeebooks/windows/service/invoice.rb +27 -0
  62. data/lib/quickeebooks/windows/service/item.rb +18 -0
  63. data/lib/quickeebooks/windows/service/service_base.rb +176 -0
  64. data/quickeebooks.gemspec +27 -0
  65. data/spec/mocks/oauth_consumer_mock.rb +2 -0
  66. data/spec/quickeebooks/online/account_spec.rb +41 -0
  67. data/spec/quickeebooks/online/customer_spec.rb +46 -0
  68. data/spec/quickeebooks/online/invoice_spec.rb +15 -0
  69. data/spec/quickeebooks/online/services/account_spec.rb +84 -0
  70. data/spec/quickeebooks/online/services/customer_spec.rb +107 -0
  71. data/spec/quickeebooks/online/services/filter_spec.rb +43 -0
  72. data/spec/quickeebooks/online/services/service_base_spec.rb +30 -0
  73. data/spec/quickeebooks/online/services/sort_spec.rb +17 -0
  74. data/spec/quickeebooks/windows/customer_spec.rb +49 -0
  75. data/spec/quickeebooks_spec.rb +11 -0
  76. data/spec/spec_helper.rb +20 -0
  77. data/spec/xml/online/account.xml +13 -0
  78. data/spec/xml/online/accounts.xml +108 -0
  79. data/spec/xml/online/customer.xml +63 -0
  80. data/spec/xml/online/customer2.xml +63 -0
  81. data/spec/xml/online/customers.xml +125 -0
  82. data/spec/xml/online/invoice.xml +33 -0
  83. data/spec/xml/online/user.xml +11 -0
  84. data/spec/xml/windows/customer.xml +56 -0
  85. data/spec/xml/windows/customers.xml +137 -0
  86. data/spec/xml/windows/http_401.xml +8 -0
  87. metadata +229 -0
@@ -0,0 +1,47 @@
1
+ require "quickeebooks"
2
+ require "quickeebooks/online/model/meta_data"
3
+ require "quickeebooks/online/model/account_detail_type"
4
+
5
+ module Quickeebooks
6
+ module Online
7
+ module Model
8
+ class Account < Quickeebooks::Online::Model::IntuitType
9
+ include ActiveModel::Validations
10
+ xml_convention :camelcase
11
+ xml_accessor :id, :from => 'Id'
12
+ xml_accessor :sync_token, :from => 'SyncToken', :as => Integer
13
+ xml_accessor :meta_data, :from => 'MetaData', :as => Quickeebooks::Online::Model::MetaData
14
+ xml_accessor :name, :from => 'Name'
15
+ xml_accessor :desc, :from => 'Desc'
16
+ xml_accessor :sub_type, :from => 'Subtype'
17
+ xml_accessor :acct_num, :from => 'AcctNum'
18
+ xml_accessor :account_parent_id, :from => 'AccountParentId'
19
+ xml_accessor :current_balance, :from => 'CurrentBalance', :as => Float
20
+ xml_accessor :opening_balance_date, :from => 'OpeningBalanceDate', :as => Date
21
+
22
+ validates_presence_of :name, :sub_type
23
+ validates_inclusion_of :sub_type, :in => Quickeebooks::Online::Model::AccountDetailType::TYPES
24
+
25
+ def to_xml_ns(options = {})
26
+ to_xml_inject_ns('Account', options)
27
+ end
28
+
29
+ def valid_for_update?
30
+ if sync_token.nil?
31
+ errors.add(:sync_token, "Missing required attribute SyncToken for update")
32
+ end
33
+ valid?
34
+ errors.empty?
35
+ end
36
+
37
+ # To delete an account Intuit requires we provide Id and SyncToken fields
38
+ def valid_for_deletion?
39
+ return false if(id.nil? || sync_token.nil?)
40
+ id.to_i > 0 && !sync_token.to_s.empty? && sync_token.to_i >= 0
41
+ end
42
+
43
+ end
44
+ end
45
+
46
+ end
47
+ end
@@ -0,0 +1,233 @@
1
+ module Quickeebooks
2
+ module Online
3
+ module Model
4
+ module AccountDetailType
5
+ TYPES = ["ARRefundCreditCard", "Accepted", "AccountsPayable", "AccountsReceivable", "AccumulatedAdjustment", "AccumulatedAmortization", "AccumulatedAmortizationOfOtherAssets", "AccumulatedDepletion", "AccumulatedDepreciation", "Active", "AdvertisingPromotional", "AllowanceForBadDebts", "AmEx", "AmEx", "Amortization", "Annually", "Area", "Assembly", "Asset", "Authorization", "Auto", "Awarded", "BadDebts", "Bank", "BankCharges", "Bill", "BillPayment", "Billable", "Billable", "BillableHasBeenBilled", "BuildAssembly", "Buildings", "Capture", "CardNotPresent", "CardPresent", "CarryOver", "Cash", "CashOnHand", "CashPurchase", "Charge", "Charge", "CharitableContributions", "Check", "Check", "Checking", "Closed", "Closed", "CommonStock", "Cost of Goods Sold", "CostOfLabor", "CostOfLaborCos", "Count", "Credit", "Credit Card", "CreditCard", "CreditCardCharge", "CreditCardCredit", "CreditMemo", "Customer", "DateDriven", "Debit", "DebitCard", "DebitCard", "DepletableAssets", "Deposit", "Depreciation", "DevelopmentCosts", "DirectDepositPayable", "DiscountsRefundsGiven", "Discover", "Discover", "DividendIncome", "Draft", "DuesSubscriptions", "ECheck", "EFPLiabilityCheck", "EFTBillPayment", "EFTRefund", "Employee", "Employee", "Employee", "EmployeeCashAdvances", "Entertainment", "EntertainmentMeals", "EquipmentRental", "EquipmentRentalCos", "Equity", "Equity", "Estimate", "Expense", "Expense", "Fail", "FederalIncomeTaxPayable", "Fixed Asset", "Fixed Asset", "FurnitureAndFixtures", "GiftCard", "GiftCard", "Goodwill", "Group", "HasBeenBilled", "InProgress", "Income", "Insurance", "InsurancePayable", "IntangibleAssets", "InterestEarned", "InterestPaid", "Inventory", "Inventory", "InventoryAdjustment", "Investment_MortgageRealEstateLoans", "Investment_Other", "Investment_TaxExemptSecurities", "Investment_USGovernmentObligations", "Invoice", "ItemReceipt", "JournalEntry", "Land", "LeaseBuyout", "LeaseholdImprovements", "LegalProfessionalFees", "Length", "Liability", "LiabilityAdjustment", "Licenses", "LineOfCredit", "LoanPayable", "LoansToOfficers", "LoansToOthers", "LoansToStockholders", "Long Term Liability", "MachineryAndEquipment", "MasterCard", "MasterCard", "MoneyMarket", "Monthly", "Non-Posting", "NonProfitIncome", "None", "NotActive", "NotAvailable", "NotAwarded", "NotBillable", "NotBillable", "NotesPayable", "OfficeGeneralAdministrativeExpenses", "OpeningBalanceEquity", "OrganizationalCosts", "Other", "Other", "Other", "Other Asset", "Other Charge", "Other Current Asset", "Other Current Liability", "Other Expense", "Other Income", "OtherCostsOfServiceCos", "OtherCreditCard", "OtherCreditCard", "OtherCurrentAssets", "OtherCurrentLiabilities", "OtherFixedAssets", "OtherInvestmentIncome", "OtherLongTermAssets", "OtherLongTermLiabilities", "OtherMiscellaneousExpense", "OtherMiscellaneousIncome", "OtherMiscellaneousServiceCost", "OtherPrimaryIncome", "Overdue", "OwnersEquity", "Paid", "PaidInCapitalOrSurplus", "PartnerContributions", "PartnerDistributions", "PartnersEquity", "Pass", "Payable", "Paycheck", "Payment", "PayrollClearing", "PayrollExpenses", "PayrollLiabilityCheck", "PayrollTaxPayable", "PenaltiesSettlements", "Pending", "Pending", "Pending", "PreferredStock", "PrepaidExpenses", "PrepaidExpensesPayable", "PriorPayment", "Product", "PromotionalMeals", "PurchaseOrder", "Quarterly", "ReceivePayment", "Refund", "RefundCheck", "Rejected", "RentOrLeaseOfBuildings", "RentsHeldInTrust", "RentsInTrustLiability", "RepairMaintenance", "Retainage", "RetainedEarnings", "Revenue", "SalesOfProductIncome", "SalesOrder", "SalesReceipt", "SalesTaxPayable", "SalesTaxPaymentCheck", "Savings", "SecurityDeposits", "Service", "ServiceFeeIncome", "ShareholderNotesPayable", "ShippingFreightDelivery", "ShippingFreightDeliveryCos", "Standard", "StateLocalIncomeTaxPayable", "Subtotal", "SuppliesMaterials", "SuppliesMaterialsCogs", "TaxExemptInterest", "TaxesPaid", "Time", "TimeActivity", "Transfer", "Trash", "Travel", "TravelMeals", "TreasuryStock", "TrustAccounts", "TrustAccountsLiabilities", "UnPaid", "UndepositedFunds", "Utilities", "Vehicles", "Vendor", "Vendor", "Vendor", "VendorCredit", "Visa", "Visa", "VoiceAuthorization", "Volume", "Weight", "YTDAdjustment"]
6
+
7
+ AR_REFUND_CREDIT_CARD = 'ARRefundCreditCard'
8
+ ACCEPTED = 'Accepted'
9
+ ACCOUNTS_PAYABLE = 'AccountsPayable'
10
+ ACCOUNTS_RECEIVABLE = 'AccountsReceivable'
11
+ ACCUMULATED_ADJUSTMENT = 'AccumulatedAdjustment'
12
+ ACCUMULATED_AMORTIZATION = 'AccumulatedAmortization'
13
+ ACCUMULATED_AMORTIZATION_OF_OTHER_ASSETS = 'AccumulatedAmortizationOfOtherAssets'
14
+ ACCUMULATED_DEPLETION = 'AccumulatedDepletion'
15
+ ACCUMULATED_DEPRECIATION = 'AccumulatedDepreciation'
16
+ ACTIVE = 'Active'
17
+ ADVERTISING_PROMOTIONAL = 'AdvertisingPromotional'
18
+ ALLOWANCE_FOR_BAD_DEBTS = 'AllowanceForBadDebts'
19
+ AM_EX = 'AmEx'
20
+ AMORTIZATION = 'Amortization'
21
+ ANNUALLY = 'Annually'
22
+ AREA = 'Area'
23
+ ASSEMBLY = 'Assembly'
24
+ ASSET = 'Asset'
25
+ AUTHORIZATION = 'Authorization'
26
+ AUTO = 'Auto'
27
+ AWARDED = 'Awarded'
28
+ BAD_DEBTS = 'BadDebts'
29
+ BANK = 'Bank'
30
+ BANK_CHARGES = 'BankCharges'
31
+ BILL = 'Bill'
32
+ BILL_PAYMENT = 'BillPayment'
33
+ BILLABLE = 'Billable'
34
+ BILLABLE_HAS_BEEN_BILLED = 'BillableHasBeenBilled'
35
+ BUILD_ASSEMBLY = 'BuildAssembly'
36
+ BUILDINGS = 'Buildings'
37
+ CAPTURE = 'Capture'
38
+ CARD_NOT_PRESENT = 'CardNotPresent'
39
+ CARD_PRESENT = 'CardPresent'
40
+ CARRY_OVER = 'CarryOver'
41
+ CASH = 'Cash'
42
+ CASH_ON_HAND = 'CashOnHand'
43
+ CASH_PURCHASE = 'CashPurchase'
44
+ CHARGE = 'Charge'
45
+ CHARITABLE_CONTRIBUTIONS = 'CharitableContributions'
46
+ CHECK = 'Check'
47
+ CHECKING = 'Checking'
48
+ CLOSED = 'Closed'
49
+ COMMON_STOCK = 'CommonStock'
50
+ COST_OF_GOODS_SOLD = 'CostOfGoodsSold'
51
+ COST_OF_LABOR = 'CostOfLabor'
52
+ COST_OF_LABOR_COS = 'CostOfLaborCos'
53
+ COUNT = 'Count'
54
+ CREDIT = 'Credit'
55
+ CREDIT_CARD = 'CreditCard'
56
+ CREDIT_CARD_CHARGE = 'CreditCardCharge'
57
+ CREDIT_CARD_CREDIT = 'CreditCardCredit'
58
+ CREDIT_MEMO = 'CreditMemo'
59
+ CUSTOMER = 'Customer'
60
+ DATE_DRIVEN = 'DateDriven'
61
+ DEBIT = 'Debit'
62
+ DEBIT_CARD = 'DebitCard'
63
+ DEPLETABLE_ASSETS = 'DepletableAssets'
64
+ DEPOSIT = 'Deposit'
65
+ DEPRECIATION = 'Depreciation'
66
+ DEVELOPMENT_COSTS = 'DevelopmentCosts'
67
+ DIRECT_DEPOSIT_PAYABLE = 'DirectDepositPayable'
68
+ DISCOUNTS_REFUNDS_GIVEN = 'DiscountsRefundsGiven'
69
+ DISCOVER = 'Discover'
70
+ DIVIDEND_INCOME = 'DividendIncome'
71
+ DRAFT = 'Draft'
72
+ DUES_SUBSCRIPTIONS = 'DuesSubscriptions'
73
+ E_CHECK = 'ECheck'
74
+ EFP_LIABILITY_CHECK = 'EFPLiabilityCheck'
75
+ EFT_BILL_PAYMENT = 'EFTBillPayment'
76
+ EFT_REFUND = 'EFTRefund'
77
+ EMPLOYEE = 'Employee'
78
+ EMPLOYEE_CASH_ADVANCES = 'EmployeeCashAdvances'
79
+ ENTERTAINMENT = 'Entertainment'
80
+ ENTERTAINMENT_MEALS = 'EntertainmentMeals'
81
+ EQUIPMENT_RENTAL = 'EquipmentRental'
82
+ EQUIPMENT_RENTAL_COS = 'EquipmentRentalCos'
83
+ EQUITY = 'Equity'
84
+ ESTIMATE = 'Estimate'
85
+ EXPENSE = 'Expense'
86
+ FAIL = 'Fail'
87
+ FEDERAL_INCOME_TAX_PAYABLE = 'FederalIncomeTaxPayable'
88
+ FIXED_ASSET = 'FixedAsset'
89
+ FURNITURE_AND_FIXTURES = 'FurnitureAndFixtures'
90
+ GIFT_CARD = 'GiftCard'
91
+ GOODWILL = 'Goodwill'
92
+ GROUP = 'Group'
93
+ HAS_BEEN_BILLED = 'HasBeenBilled'
94
+ IN_PROGRESS = 'InProgress'
95
+ INCOME = 'Income'
96
+ INSURANCE = 'Insurance'
97
+ INSURANCE_PAYABLE = 'InsurancePayable'
98
+ INTANGIBLE_ASSETS = 'IntangibleAssets'
99
+ INTEREST_EARNED = 'InterestEarned'
100
+ INTEREST_PAID = 'InterestPaid'
101
+ INVENTORY = 'Inventory'
102
+ INVENTORY_ADJUSTMENT = 'InventoryAdjustment'
103
+ INVESTMENT_MORTGAGE_REAL_ESTATE_LOANS = 'Investment_MortgageRealEstateLoans'
104
+ INVESTMENT_OTHER = 'Investment_Other'
105
+ INVESTMENT_TAX_EXEMPT_SECURITIES = 'Investment_TaxExemptSecurities'
106
+ INVESTMENT_US_GOVERNMENT_OBLIGATIONS = 'Investment_USGovernmentObligations'
107
+ INVOICE = 'Invoice'
108
+ ITEM_RECEIPT = 'ItemReceipt'
109
+ JOURNAL_ENTRY = 'JournalEntry'
110
+ LAND = 'Land'
111
+ LEASE_BUYOUT = 'LeaseBuyout'
112
+ LEASEHOLD_IMPROVEMENTS = 'LeaseholdImprovements'
113
+ LEGAL_PROFESSIONAL_FEES = 'LegalProfessionalFees'
114
+ LENGTH = 'Length'
115
+ LIABILITY = 'Liability'
116
+ LIABILITY_ADJUSTMENT = 'LiabilityAdjustment'
117
+ LICENSES = 'Licenses'
118
+ LINE_OF_CREDIT = 'LineOfCredit'
119
+ LOAN_PAYABLE = 'LoanPayable'
120
+ LOANS_TO_OFFICERS = 'LoansToOfficers'
121
+ LOANS_TO_OTHERS = 'LoansToOthers'
122
+ LOANS_TO_STOCKHOLDERS = 'LoansToStockholders'
123
+ LONG_TERM_LIABILITY = 'LongTermLiability'
124
+ MACHINERY_AND_EQUIPMENT = 'MachineryAndEquipment'
125
+ MASTER_CARD = 'MasterCard'
126
+ MONEY_MARKET = 'MoneyMarket'
127
+ MONTHLY = 'Monthly'
128
+ NON_POSTING = 'Non-Posting'
129
+ NON_PROFIT_INCOME = 'NonProfitIncome'
130
+ NONE = 'None'
131
+ NOT_ACTIVE = 'NotActive'
132
+ NOT_AVAILABLE = 'NotAvailable'
133
+ NOT_AWARDED = 'NotAwarded'
134
+ NOT_BILLABLE = 'NotBillable'
135
+ NOTES_PAYABLE = 'NotesPayable'
136
+ OFFICE_GENERAL_ADMINISTRATIVE_EXPENSES = 'OfficeGeneralAdministrativeExpenses'
137
+ OPENING_BALANCE_EQUITY = 'OpeningBalanceEquity'
138
+ ORGANIZATIONAL_COSTS = 'OrganizationalCosts'
139
+ OTHER_EXPENSE = 'OtherExpense'
140
+ OTHER_INCOME = 'OtherIncome'
141
+ OTHER_COSTS_OF_SERVICE_COS = 'OtherCostsOfServiceCos'
142
+ OTHER_CREDIT_CARD = 'OtherCreditCard'
143
+ OTHER_CURRENT_ASSETS = 'OtherCurrentAssets'
144
+ OTHER_CURRENT_LIABILITIES = 'OtherCurrentLiabilities'
145
+ OTHER_FIXED_ASSETS = 'OtherFixedAssets'
146
+ OTHER_INVESTMENT_INCOME = 'OtherInvestmentIncome'
147
+ OTHER_LONG_TERM_ASSETS = 'OtherLongTermAssets'
148
+ OTHER_LONG_TERM_LIABILITIES = 'OtherLongTermLiabilities'
149
+ OTHER_MISCELLANEOUS_EXPENSE = 'OtherMiscellaneousExpense'
150
+ OTHER_MISCELLANEOUS_INCOME = 'OtherMiscellaneousIncome'
151
+ OTHER_MISCELLANEOUS_SERVICE_COST = 'OtherMiscellaneousServiceCost'
152
+ OTHER_PRIMARY_INCOME = 'OtherPrimaryIncome'
153
+ OVERDUE = 'Overdue'
154
+ OWNERS_EQUITY = 'OwnersEquity'
155
+ PAID = 'Paid'
156
+ PAID_IN_CAPITAL_OR_SURPLUS = 'PaidInCapitalOrSurplus'
157
+ PARTNER_CONTRIBUTIONS = 'PartnerContributions'
158
+ PARTNER_DISTRIBUTIONS = 'PartnerDistributions'
159
+ PARTNERS_EQUITY = 'PartnersEquity'
160
+ PASS = 'Pass'
161
+ PAYABLE = 'Payable'
162
+ PAYCHECK = 'Paycheck'
163
+ PAYMENT = 'Payment'
164
+ PAYROLL_CLEARING = 'PayrollClearing'
165
+ PAYROLL_EXPENSES = 'PayrollExpenses'
166
+ PAYROLL_LIABILITY_CHECK = 'PayrollLiabilityCheck'
167
+ PAYROLL_TAX_PAYABLE = 'PayrollTaxPayable'
168
+ PENALTIES_SETTLEMENTS = 'PenaltiesSettlements'
169
+ PENDING = 'Pending'
170
+ PREFERRED_STOCK = 'PreferredStock'
171
+ PREPAID_EXPENSES = 'PrepaidExpenses'
172
+ PREPAID_EXPENSES_PAYABLE = 'PrepaidExpensesPayable'
173
+ PRIOR_PAYMENT = 'PriorPayment'
174
+ PRODUCT = 'Product'
175
+ PROMOTIONAL_MEALS = 'PromotionalMeals'
176
+ PURCHASE_ORDER = 'PurchaseOrder'
177
+ QUARTERLY = 'Quarterly'
178
+ RECEIVE_PAYMENT = 'ReceivePayment'
179
+ REFUND = 'Refund'
180
+ REFUND_CHECK = 'RefundCheck'
181
+ REJECTED = 'Rejected'
182
+ RENT_OR_LEASE_OF_BUILDINGS = 'RentOrLeaseOfBuildings'
183
+ RENTS_HELD_IN_TRUST = 'RentsHeldInTrust'
184
+ RENTS_IN_TRUST_LIABILITY = 'RentsInTrustLiability'
185
+ REPAIR_MAINTENANCE = 'RepairMaintenance'
186
+ RETAINAGE = 'Retainage'
187
+ RETAINED_EARNINGS = 'RetainedEarnings'
188
+ REVENUE = 'Revenue'
189
+ SALES_OF_PRODUCT_INCOME = 'SalesOfProductIncome'
190
+ SALES_ORDER = 'SalesOrder'
191
+ SALES_RECEIPT = 'SalesReceipt'
192
+ SALES_TAX_PAYABLE = 'SalesTaxPayable'
193
+ SALES_TAX_PAYMENT_CHECK = 'SalesTaxPaymentCheck'
194
+ SAVINGS = 'Savings'
195
+ SECURITY_DEPOSITS = 'SecurityDeposits'
196
+ SERVICE = 'Service'
197
+ SERVICE_FEE_INCOME = 'ServiceFeeIncome'
198
+ SHAREHOLDER_NOTES_PAYABLE = 'ShareholderNotesPayable'
199
+ SHIPPING_FREIGHT_DELIVERY = 'ShippingFreightDelivery'
200
+ SHIPPING_FREIGHT_DELIVERY_COS = 'ShippingFreightDeliveryCos'
201
+ STANDARD = 'Standard'
202
+ STATE_LOCAL_INCOME_TAX_PAYABLE = 'StateLocalIncomeTaxPayable'
203
+ SUBTOTAL = 'Subtotal'
204
+ SUPPLIES_MATERIALS = 'SuppliesMaterials'
205
+ SUPPLIES_MATERIALS_COGS = 'SuppliesMaterialsCogs'
206
+ TAX_EXEMPT_INTEREST = 'TaxExemptInterest'
207
+ TAXES_PAID = 'TaxesPaid'
208
+ TIME = 'Time'
209
+ TIME_ACTIVITY = 'TimeActivity'
210
+ TRANSFER = 'Transfer'
211
+ TRASH = 'Trash'
212
+ TRAVEL = 'Travel'
213
+ TRAVEL_MEALS = 'TravelMeals'
214
+ TREASURY_STOCK = 'TreasuryStock'
215
+ TRUST_ACCOUNTS = 'TrustAccounts'
216
+ TRUST_ACCOUNTS_LIABILITIES = 'TrustAccountsLiabilities'
217
+ UN_PAID = 'UnPaid'
218
+ UNDEPOSITED_FUNDS = 'UndepositedFunds'
219
+ UTILITIES = 'Utilities'
220
+ VEHICLES = 'Vehicles'
221
+ VENDOR = 'Vendor'
222
+ VENDOR_CREDIT = 'VendorCredit'
223
+ VISA = 'Visa'
224
+ VOICE_AUTHORIZATION = 'VoiceAuthorization'
225
+ VOLUME = 'Volume'
226
+ WEIGHT = 'Weight'
227
+ YTD_ADJUSTMENT = 'YTDAdjustment'
228
+
229
+
230
+ end
231
+ end
232
+ end
233
+ end
@@ -0,0 +1,17 @@
1
+ require "quickeebooks"
2
+
3
+ module Quickeebooks
4
+ module Online
5
+ module Model
6
+ class AccountReference < Quickeebooks::Online::Model::IntuitType
7
+ xml_accessor :account_id, :from => 'AccountId'
8
+
9
+ def initialize(account_id = nil)
10
+ unless account_id.nil?
11
+ self.account_id = account_id
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,42 @@
1
+ require 'quickeebooks'
2
+
3
+ module Quickeebooks
4
+ module Online
5
+ module Model
6
+ class Address < Quickeebooks::Online::Model::IntuitType
7
+ xml_accessor :line1, :from => 'Line1'
8
+ xml_accessor :line2, :from => 'Line2'
9
+ xml_accessor :line3, :from => 'Line3'
10
+ xml_accessor :line4, :from => 'Line4'
11
+ xml_accessor :line5, :from => 'Line5'
12
+ xml_accessor :city, :from => 'City'
13
+ xml_accessor :country, :from => 'Country'
14
+ xml_accessor :country_sub_division_code, :from => 'CountrySubDivisionCode'
15
+ xml_accessor :postal_code, :from => 'PostalCode'
16
+ xml_accessor :tag, :from => 'Tag'
17
+
18
+ def zip
19
+ postal_code
20
+ end
21
+
22
+ def to_xml_ns
23
+ to_xml_inject_ns('Address')
24
+ end
25
+
26
+ end
27
+ end
28
+
29
+ end
30
+ end
31
+
32
+ =begin
33
+ <Address>
34
+ <Line1>123 Main St.</Line1>
35
+ <Line2>Suite 400</Line2>
36
+ <City>San Diego</City>
37
+ <Country>USA</Country>
38
+ <CountrySubDivisionCode>CA</CountrySubDivisionCode>
39
+ <PostalCode>96009</PostalCode>
40
+ <Tag>Billing</Tag>
41
+ </Address>
42
+ =end
@@ -0,0 +1,66 @@
1
+ require "quickeebooks"
2
+ require "quickeebooks/online/model/meta_data"
3
+ require "quickeebooks/online/model/address"
4
+ require "quickeebooks/online/model/phone"
5
+ require "quickeebooks/online/model/web_site"
6
+ require "quickeebooks/online/model/email"
7
+ require "quickeebooks/online/model/note"
8
+ require "quickeebooks/online/model/customer_custom_field"
9
+ require "quickeebooks/online/model/open_balance"
10
+
11
+ module Quickeebooks
12
+ module Online
13
+ module Model
14
+ class Customer < Quickeebooks::Online::Model::IntuitType
15
+ include ActiveModel::Validations
16
+
17
+ xml_convention :camelcase
18
+ xml_accessor :id, :from => 'Id'
19
+ xml_accessor :sync_token, :from => 'SyncToken', :as => Integer
20
+ xml_accessor :name, :from => 'Name'
21
+ xml_accessor :meta_data, :from => 'MetaData', :as => Quickeebooks::Online::Model::MetaData
22
+ xml_accessor :addresses, :from => 'Address', :as => [Quickeebooks::Online::Model::Address]
23
+ xml_accessor :email, :from => 'Email', :as => Quickeebooks::Online::Model::Email
24
+ xml_accessor :phones, :from => 'Phone', :as => [Quickeebooks::Online::Model::Phone]
25
+ xml_accessor :web_site, :from => 'WebSite', :as => Quickeebooks::Online::Model::WebSite
26
+ xml_accessor :given_name, :from => 'GivenName'
27
+ xml_accessor :middle_name, :from => 'MiddleName'
28
+ xml_accessor :family_name, :from => 'FamilyName'
29
+ xml_accessor :suffix, :from => 'Suffix'
30
+ xml_accessor :gender, :from => 'Gender'
31
+ xml_accessor :dba_name, :from => 'DBAName'
32
+ xml_accessor :tax_identifier, :from => 'TaxIdentifier'
33
+ xml_accessor :notes, :from => 'Notes', :as => [Quickeebooks::Online::Model::Note]
34
+ xml_accessor :custom_fields, :from => 'CustomField', :as => [Quickeebooks::Online::Model::CustomerCustomField]
35
+ xml_accessor :sales_term_id, :from => 'SalesTermId'
36
+ xml_accessor :paymethod_method_id, :from => 'PaymentMethodId'
37
+ xml_accessor :open_balance, :from => 'OpenBalance', :as => Quickeebooks::Online::Model::OpenBalance
38
+
39
+ validates_length_of :name, :minimum => 1
40
+
41
+ def valid_for_update?
42
+ if sync_token.nil?
43
+ errors.add(:sync_token, "Missing required attribute SyncToken for update")
44
+ end
45
+ errors.empty?
46
+ end
47
+
48
+ def to_xml_ns(options = {})
49
+ to_xml_inject_ns('Customer', options)
50
+ end
51
+
52
+ def email_address=(email_address)
53
+ self.email = Quickeebooks::Online::Model::Email.new(email_address)
54
+ end
55
+
56
+ # To delete an account Intuit requires we provide Id and SyncToken fields
57
+ def valid_for_deletion?
58
+ return false if(id.nil? || sync_token.nil?)
59
+ id.to_i > 0 && !sync_token.to_s.empty? && sync_token.to_i >= 0
60
+ end
61
+
62
+ end
63
+ end
64
+ end
65
+
66
+ end
@@ -0,0 +1,51 @@
1
+ require "quickeebooks"
2
+
3
+ module Quickeebooks
4
+ module Online
5
+ module Model
6
+ class CustomerCustomField < Quickeebooks::Online::Model::IntuitType
7
+
8
+ TYPES = %w{BooleanTypeCustomField StringTypeCustomField}
9
+ BOOLEAN_TYPE = "BooleanTypeCustomField"
10
+ STRING_TYPE = "StringTypeCustomField"
11
+
12
+ xml_accessor :definition_id, :from => 'DefinitionId'
13
+ xml_accessor :value, :from => 'Value'
14
+
15
+ def to_xml(options = {})
16
+ # Intuit v3 doesnt support custom field updating...
17
+ return ""
18
+
19
+ # return "" if value.to_s.empty?
20
+ # xml = %Q{<CustomField xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="#{type_attr}">}
21
+ # xml = "#{xml}<DefinitionId>#{definition_id}</DefinitionId><Value>#{converted_value}</Value></CustomField>"
22
+ # xml
23
+ end
24
+
25
+ # Intuit sends back "DONT" for "None" but they dont accept it
26
+ # when WE send it back to them, they want "None". ugh....
27
+ def converted_value
28
+ if definition_id == "Preferred Delivery Method"
29
+ if value == "DONT"
30
+ "None"
31
+ else
32
+ value
33
+ end
34
+ else
35
+ value
36
+ end
37
+ end
38
+
39
+ def type_attr
40
+ if definition_id == "Bill With Parent"
41
+ "BooleanTypeCustomeField"
42
+ else
43
+ "StringTypeCustomField"
44
+ end
45
+ end
46
+
47
+ end
48
+ end
49
+
50
+ end
51
+ end