Skip to content

Commit

Permalink
Require storable gem for Storable::OrderedHash
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamcat4 committed Jul 8, 2009
1 parent dfef01c commit e9e7b61
Show file tree
Hide file tree
Showing 34 changed files with 1,241 additions and 1,196 deletions.
18 changes: 15 additions & 3 deletions lib/parser.rb
Expand Up @@ -9,14 +9,26 @@ def self.generate_model_maps
# write model map
model_name = File.basename(src)[0..-6]
File.open("#{File.dirname(__FILE__)}/../model_maps/#{model_name}.rb", 'w+') do |f|
formatted_map = attributes.map{ |a| ":#{a[0]} => '#{a[1]}'" }.join(",\n ")
# formatted_map = attributes.map{ |a| ":#{a[0]} => '#{a[1]}'" }.join(",\n ")
# f.write <<-MAP
# # auto-generated from json definitions
# module QBXML
# module ModelMaps
# #{model_name} = {
# #{formatted_map}
# }
# end
# end
# MAP
formatted_map = attributes.map{ |a| ":#{a[0]}, '#{a[1]}'" }.join(",\n ")
f.write <<-MAP
# auto-generated from json definitions
require 'storable'
module QBXML
module ModelMaps
#{model_name} = {
#{model_name} = Storable::OrderedHash[
#{formatted_map}
}
]
end
end
MAP
Expand Down
55 changes: 28 additions & 27 deletions model_maps/Account.rb
@@ -1,32 +1,33 @@
# auto-generated from json definitions
require 'storable'
module QBXML
module ModelMaps
Account = {
:list_id => 'ListID',
:time_created => 'TimeCreated',
:time_modified => 'TimeModified',
:edit_sequence => 'EditSequence',
:name => 'Name',
:full_name => 'FullName',
:is_active => 'IsActive',
:parent_ref_list_id => 'ParentRef/ListID',
:parent_ref_full_name => 'ParentRef/FullName',
:sublevel => 'Sublevel',
:account_type => 'AccountType',
:detail_account_type => 'DetailAccountType',
:special_account_type => 'SpecialAccountType',
:is_tax_account => 'IsTaxAccount',
:account_number => 'AccountNumber',
:bank_number => 'BankNumber',
:last_check_number => 'LastCheckNumber',
:desc => 'Desc',
:balance => 'Balance',
:total_balance => 'TotalBalance',
:sales_tax_code_ref_list_id => 'SalesTaxCodeRef/ListID',
:sales_tax_code_ref_full_name => 'SalesTaxCodeRef/FullName',
:tax_line_info_ret_tax_line_id => 'TaxLineInfoRet/TaxLineID',
:tax_line_info_ret_tax_line_name => 'TaxLineInfoRet/TaxLineName',
:cash_flow_classification => 'CashFlowClassification'
}
Account = Storable::OrderedHash[
:list_id, 'ListID',
:time_created, 'TimeCreated',
:time_modified, 'TimeModified',
:edit_sequence, 'EditSequence',
:name, 'Name',
:full_name, 'FullName',
:is_active, 'IsActive',
:parent_ref_list_id, 'ParentRef/ListID',
:parent_ref_full_name, 'ParentRef/FullName',
:sublevel, 'Sublevel',
:account_type, 'AccountType',
:detail_account_type, 'DetailAccountType',
:special_account_type, 'SpecialAccountType',
:is_tax_account, 'IsTaxAccount',
:account_number, 'AccountNumber',
:bank_number, 'BankNumber',
:last_check_number, 'LastCheckNumber',
:desc, 'Desc',
:balance, 'Balance',
:total_balance, 'TotalBalance',
:sales_tax_code_ref_list_id, 'SalesTaxCodeRef/ListID',
:sales_tax_code_ref_full_name, 'SalesTaxCodeRef/FullName',
:tax_line_info_ret_tax_line_id, 'TaxLineInfoRet/TaxLineID',
:tax_line_info_ret_tax_line_name, 'TaxLineInfoRet/TaxLineName',
:cash_flow_classification, 'CashFlowClassification'
]
end
end
173 changes: 87 additions & 86 deletions model_maps/CreditMemo.rb
@@ -1,91 +1,92 @@
# auto-generated from json definitions
require 'storable'
module QBXML
module ModelMaps
CreditMemo = {
:txn_id => 'TxnID',
:time_created => 'TimeCreated',
:time_modified => 'TimeModified',
:edit_sequence => 'EditSequence',
:txn_number => 'TxnNumber',
:customer_ref_list_id => 'CustomerRef/ListID',
:customer_ref_full_name => 'CustomerRef/FullName',
:class_ref_list_id => 'ClassRef/ListID',
:class_ref_full_name => 'ClassRef/FullName',
:ar_account_ref_list_id => 'ARAccountRef/ListID',
:ar_account_ref_full_name => 'ARAccountRef/FullName',
:template_ref_list_id => 'TemplateRef/ListID',
:template_ref_full_name => 'TemplateRef/FullName',
:txn_date => 'TxnDate',
:ref_number => 'RefNumber',
:bill_address_addr1 => 'BillAddress/Addr1',
:bill_address_addr2 => 'BillAddress/Addr2',
:bill_address_addr3 => 'BillAddress/Addr3',
:bill_address_addr4 => 'BillAddress/Addr4',
:bill_address_addr5 => 'BillAddress/Addr5',
:bill_address_city => 'BillAddress/City',
:bill_address_state => 'BillAddress/State',
:bill_address_postal_code => 'BillAddress/PostalCode',
:bill_address_country => 'BillAddress/Country',
:bill_address_note => 'BillAddress/Note',
:bill_address_block_addr1 => 'BillAddressBlock/Addr1',
:bill_address_block_addr2 => 'BillAddressBlock/Addr2',
:bill_address_block_addr3 => 'BillAddressBlock/Addr3',
:bill_address_block_addr4 => 'BillAddressBlock/Addr4',
:bill_address_block_addr5 => 'BillAddressBlock/Addr5',
:ship_address_addr1 => 'ShipAddress/Addr1',
:ship_address_addr2 => 'ShipAddress/Addr2',
:ship_address_addr3 => 'ShipAddress/Addr3',
:ship_address_addr4 => 'ShipAddress/Addr4',
:ship_address_addr5 => 'ShipAddress/Addr5',
:ship_address_city => 'ShipAddress/City',
:ship_address_state => 'ShipAddress/State',
:ship_address_postal_code => 'ShipAddress/PostalCode',
:ship_address_country => 'ShipAddress/Country',
:ship_address_note => 'ShipAddress/Note',
:ship_address_block_addr1 => 'ShipAddressBlock/Addr1',
:ship_address_block_addr2 => 'ShipAddressBlock/Addr2',
:ship_address_block_addr3 => 'ShipAddressBlock/Addr3',
:ship_address_block_addr4 => 'ShipAddressBlock/Addr4',
:ship_address_block_addr5 => 'ShipAddressBlock/Addr5',
:is_pending => 'IsPending',
:po_number => 'PONumber',
:terms_ref_list_id => 'TermsRef/ListID',
:terms_ref_full_name => 'TermsRef/FullName',
:due_date => 'DueDate',
:sales_rep_ref_list_id => 'SalesRepRef/ListID',
:sales_rep_ref_full_name => 'SalesRepRef/FullName',
:fob => 'FOB',
:ship_date => 'ShipDate',
:ship_method_ref_list_id => 'ShipMethodRef/ListID',
:ship_method_ref_full_name => 'ShipMethodRef/FullName',
:subtotal => 'Subtotal',
:item_sales_tax_ref_list_id => 'ItemSalesTaxRef/ListID',
:item_sales_tax_ref_full_name => 'ItemSalesTaxRef/FullName',
:sales_tax_percentage => 'SalesTaxPercentage',
:sales_tax_total => 'SalesTaxTotal',
:total_amount => 'TotalAmount',
:credit_remaining => 'CreditRemaining',
:memo => 'Memo',
:customer_msg_ref_list_id => 'CustomerMsgRef/ListID',
:customer_msg_ref_full_name => 'CustomerMsgRef/FullName',
:is_to_be_printed => 'IsToBePrinted',
:is_to_be_emailed => 'IsToBeEmailed',
:is_tax_included => 'IsTaxIncluded',
:customer_sales_tax_code_ref_list_id => 'CustomerSalesTaxCodeRef/ListID',
:customer_sales_tax_code_ref_full_name => 'CustomerSalesTaxCodeRef/FullName',
:other => 'Other',
:discount_line_ret_amount => 'DiscountLineRet/Amount',
:discount_line_ret_rate_percent => 'DiscountLineRet/RatePercent',
:discount_line_ret_is_taxable => 'DiscountLineRet/IsTaxable',
:discount_line_ret_account_ref_list_id => 'DiscountLineRet/AccountRef/ListID',
:discount_line_ret_account_ref_full_name => 'DiscountLineRet/AccountRef/FullName',
:sales_tax_line_ret_amount => 'SalesTaxLineRet/Amount',
:sales_tax_line_ret_rate_percent => 'SalesTaxLineRet/RatePercent',
:sales_tax_line_ret_account_ref_list_id => 'SalesTaxLineRet/AccountRef/ListID',
:sales_tax_line_ret_account_ref_full_name => 'SalesTaxLineRet/AccountRef/FullName',
:shipping_line_ret_amount => 'ShippingLineRet/Amount',
:shipping_line_ret_account_ref_list_id => 'ShippingLineRet/AccountRef/ListID',
:shipping_line_ret_account_ref_full_name => 'ShippingLineRet/AccountRef/FullName'
}
CreditMemo = Storable::OrderedHash[
:txn_id, 'TxnID',
:time_created, 'TimeCreated',
:time_modified, 'TimeModified',
:edit_sequence, 'EditSequence',
:txn_number, 'TxnNumber',
:customer_ref_list_id, 'CustomerRef/ListID',
:customer_ref_full_name, 'CustomerRef/FullName',
:class_ref_list_id, 'ClassRef/ListID',
:class_ref_full_name, 'ClassRef/FullName',
:ar_account_ref_list_id, 'ARAccountRef/ListID',
:ar_account_ref_full_name, 'ARAccountRef/FullName',
:template_ref_list_id, 'TemplateRef/ListID',
:template_ref_full_name, 'TemplateRef/FullName',
:txn_date, 'TxnDate',
:ref_number, 'RefNumber',
:bill_address_addr1, 'BillAddress/Addr1',
:bill_address_addr2, 'BillAddress/Addr2',
:bill_address_addr3, 'BillAddress/Addr3',
:bill_address_addr4, 'BillAddress/Addr4',
:bill_address_addr5, 'BillAddress/Addr5',
:bill_address_city, 'BillAddress/City',
:bill_address_state, 'BillAddress/State',
:bill_address_postal_code, 'BillAddress/PostalCode',
:bill_address_country, 'BillAddress/Country',
:bill_address_note, 'BillAddress/Note',
:bill_address_block_addr1, 'BillAddressBlock/Addr1',
:bill_address_block_addr2, 'BillAddressBlock/Addr2',
:bill_address_block_addr3, 'BillAddressBlock/Addr3',
:bill_address_block_addr4, 'BillAddressBlock/Addr4',
:bill_address_block_addr5, 'BillAddressBlock/Addr5',
:ship_address_addr1, 'ShipAddress/Addr1',
:ship_address_addr2, 'ShipAddress/Addr2',
:ship_address_addr3, 'ShipAddress/Addr3',
:ship_address_addr4, 'ShipAddress/Addr4',
:ship_address_addr5, 'ShipAddress/Addr5',
:ship_address_city, 'ShipAddress/City',
:ship_address_state, 'ShipAddress/State',
:ship_address_postal_code, 'ShipAddress/PostalCode',
:ship_address_country, 'ShipAddress/Country',
:ship_address_note, 'ShipAddress/Note',
:ship_address_block_addr1, 'ShipAddressBlock/Addr1',
:ship_address_block_addr2, 'ShipAddressBlock/Addr2',
:ship_address_block_addr3, 'ShipAddressBlock/Addr3',
:ship_address_block_addr4, 'ShipAddressBlock/Addr4',
:ship_address_block_addr5, 'ShipAddressBlock/Addr5',
:is_pending, 'IsPending',
:po_number, 'PONumber',
:terms_ref_list_id, 'TermsRef/ListID',
:terms_ref_full_name, 'TermsRef/FullName',
:due_date, 'DueDate',
:sales_rep_ref_list_id, 'SalesRepRef/ListID',
:sales_rep_ref_full_name, 'SalesRepRef/FullName',
:fob, 'FOB',
:ship_date, 'ShipDate',
:ship_method_ref_list_id, 'ShipMethodRef/ListID',
:ship_method_ref_full_name, 'ShipMethodRef/FullName',
:subtotal, 'Subtotal',
:item_sales_tax_ref_list_id, 'ItemSalesTaxRef/ListID',
:item_sales_tax_ref_full_name, 'ItemSalesTaxRef/FullName',
:sales_tax_percentage, 'SalesTaxPercentage',
:sales_tax_total, 'SalesTaxTotal',
:total_amount, 'TotalAmount',
:credit_remaining, 'CreditRemaining',
:memo, 'Memo',
:customer_msg_ref_list_id, 'CustomerMsgRef/ListID',
:customer_msg_ref_full_name, 'CustomerMsgRef/FullName',
:is_to_be_printed, 'IsToBePrinted',
:is_to_be_emailed, 'IsToBeEmailed',
:is_tax_included, 'IsTaxIncluded',
:customer_sales_tax_code_ref_list_id, 'CustomerSalesTaxCodeRef/ListID',
:customer_sales_tax_code_ref_full_name, 'CustomerSalesTaxCodeRef/FullName',
:other, 'Other',
:discount_line_ret_amount, 'DiscountLineRet/Amount',
:discount_line_ret_rate_percent, 'DiscountLineRet/RatePercent',
:discount_line_ret_is_taxable, 'DiscountLineRet/IsTaxable',
:discount_line_ret_account_ref_list_id, 'DiscountLineRet/AccountRef/ListID',
:discount_line_ret_account_ref_full_name, 'DiscountLineRet/AccountRef/FullName',
:sales_tax_line_ret_amount, 'SalesTaxLineRet/Amount',
:sales_tax_line_ret_rate_percent, 'SalesTaxLineRet/RatePercent',
:sales_tax_line_ret_account_ref_list_id, 'SalesTaxLineRet/AccountRef/ListID',
:sales_tax_line_ret_account_ref_full_name, 'SalesTaxLineRet/AccountRef/FullName',
:shipping_line_ret_amount, 'ShippingLineRet/Amount',
:shipping_line_ret_account_ref_list_id, 'ShippingLineRet/AccountRef/ListID',
:shipping_line_ret_account_ref_full_name, 'ShippingLineRet/AccountRef/FullName'
]
end
end

0 comments on commit e9e7b61

Please sign in to comment.