netsuite 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +15 -0
  2. data/README.md +14 -12
  3. data/lib/netsuite.rb +16 -2
  4. data/lib/netsuite/actions/delete_list.rb +104 -0
  5. data/lib/netsuite/actions/login.rb +26 -1
  6. data/lib/netsuite/actions/search.rb +7 -3
  7. data/lib/netsuite/actions/upsert.rb +0 -4
  8. data/lib/netsuite/configuration.rb +1 -0
  9. data/lib/netsuite/namespaces/tran_purch.rb +11 -0
  10. data/lib/netsuite/records/cash_refund.rb +2 -2
  11. data/lib/netsuite/records/cash_sale.rb +41 -1
  12. data/lib/netsuite/records/cash_sale_item.rb +40 -0
  13. data/lib/netsuite/records/cash_sale_item_list.rb +25 -0
  14. data/lib/netsuite/records/contact.rb +1 -1
  15. data/lib/netsuite/records/contact_list.rb +1 -4
  16. data/lib/netsuite/records/credit_memo.rb +1 -1
  17. data/lib/netsuite/records/credit_memo_apply_list.rb +1 -4
  18. data/lib/netsuite/records/credit_memo_item.rb +1 -0
  19. data/lib/netsuite/records/credit_memo_item_list.rb +1 -4
  20. data/lib/netsuite/records/custom_field_list.rb +3 -0
  21. data/lib/netsuite/records/customer.rb +8 -8
  22. data/lib/netsuite/records/customer_payment.rb +1 -1
  23. data/lib/netsuite/records/customer_payment_apply.rb +1 -1
  24. data/lib/netsuite/records/customer_payment_apply_list.rb +13 -9
  25. data/lib/netsuite/records/customer_refund.rb +1 -1
  26. data/lib/netsuite/records/customer_refund_apply_list.rb +7 -3
  27. data/lib/netsuite/records/customer_refund_deposit_list.rb +1 -1
  28. data/lib/netsuite/records/deposit.rb +3 -3
  29. data/lib/netsuite/records/deposit_payment_list.rb +5 -2
  30. data/lib/netsuite/records/employee.rb +12 -4
  31. data/lib/netsuite/records/inventory_assignment.rb +1 -1
  32. data/lib/netsuite/records/inventory_assignment_list.rb +3 -1
  33. data/lib/netsuite/records/inventory_detail.rb +3 -3
  34. data/lib/netsuite/records/inventory_item.rb +4 -0
  35. data/lib/netsuite/records/invoice.rb +8 -4
  36. data/lib/netsuite/records/invoice_item_list.rb +4 -21
  37. data/lib/netsuite/records/job.rb +1 -1
  38. data/lib/netsuite/records/kit_item.rb +1 -1
  39. data/lib/netsuite/records/partner.rb +4 -2
  40. data/lib/netsuite/records/payment_method.rb +1 -1
  41. data/lib/netsuite/records/promotion_code.rb +1 -1
  42. data/lib/netsuite/records/rev_rec_template.rb +1 -1
  43. data/lib/netsuite/records/sales_order.rb +1 -1
  44. data/lib/netsuite/records/sales_order_item_list.rb +0 -1
  45. data/lib/netsuite/records/service_sale_item.rb +2 -2
  46. data/lib/netsuite/records/vendor_bill.rb +45 -0
  47. data/lib/netsuite/records/vendor_bill_expense.rb +40 -0
  48. data/lib/netsuite/records/vendor_bill_expense_list.rb +32 -0
  49. data/lib/netsuite/records/vendor_bill_item.rb +45 -0
  50. data/lib/netsuite/records/vendor_bill_item_list.rb +32 -0
  51. data/lib/netsuite/records/vendor_payment.rb +43 -0
  52. data/lib/netsuite/records/vendor_payment_apply.rb +16 -0
  53. data/lib/netsuite/records/vendor_payment_apply_list.rb +32 -0
  54. data/lib/netsuite/support/actions.rb +2 -2
  55. data/lib/netsuite/support/sublist.rb +13 -0
  56. data/lib/netsuite/version.rb +1 -1
  57. data/netsuite.gemspec +1 -1
  58. data/spec/netsuite/actions/delete_list_spec.rb +86 -0
  59. data/spec/netsuite/actions/login_spec.rb +21 -0
  60. data/spec/netsuite/records/cash_refund_spec.rb +1 -1
  61. data/spec/netsuite/records/cash_sale_item_list_spec.rb +27 -0
  62. data/spec/netsuite/records/cash_sale_item_spec.rb +23 -0
  63. data/spec/netsuite/records/credit_memo_apply_list_spec.rb +7 -8
  64. data/spec/netsuite/records/credit_memo_item_list_spec.rb +6 -8
  65. data/spec/netsuite/records/customer_payment_apply_list_spec.rb +25 -0
  66. data/spec/netsuite/records/customer_refund_apply_list_spec.rb +6 -8
  67. data/spec/netsuite/records/customer_spec.rb +6 -6
  68. data/spec/netsuite/records/employee_spec.rb +152 -0
  69. data/spec/netsuite/records/inventory_assignment_list_spec.rb +59 -0
  70. data/spec/netsuite/records/inventory_assignment_spec.rb +21 -0
  71. data/spec/netsuite/records/inventory_detail_spec.rb +13 -0
  72. data/spec/netsuite/records/invoice_spec.rb +3 -3
  73. data/spec/netsuite/records/job_spec.rb +4 -0
  74. data/spec/netsuite/records/vendor_bill_expense_list_spec.rb +36 -0
  75. data/spec/netsuite/records/vendor_bill_expense_spec.rb +72 -0
  76. data/spec/netsuite/records/vendor_bill_item_list_spec.rb +36 -0
  77. data/spec/netsuite/records/vendor_bill_item_spec.rb +118 -0
  78. data/spec/netsuite/records/vendor_bill_spec.rb +187 -0
  79. data/spec/netsuite/records/vendor_payment_apply_list_spec.rb +25 -0
  80. data/spec/netsuite/records/vendor_payment_apply_spec.rb +15 -0
  81. data/spec/netsuite/records/vendor_payment_spec.rb +164 -0
  82. data/spec/netsuite/support/sublist_spec.rb +6 -0
  83. data/spec/support/fixtures/delete_list/delete_list_customers.xml +26 -0
  84. data/spec/support/fixtures/delete_list/delete_list_customers_with_errors.xml +31 -0
  85. data/spec/support/fixtures/login.xml +35 -0
  86. metadata +58 -12
@@ -0,0 +1,25 @@
1
+ module NetSuite
2
+ module Records
3
+ class CashSaleItemList
4
+ include Namespaces::TranSales
5
+
6
+ def initialize(attributes = {})
7
+ case attributes[:item]
8
+ when Hash
9
+ items << CashSaleItem.new(attributes[:item])
10
+ when Array
11
+ attributes[:item].each { |item| items << CashSaleItem.new(item) }
12
+ end
13
+ end
14
+
15
+ def items
16
+ @items ||= []
17
+ end
18
+
19
+ def to_record
20
+ { "#{record_namespace}:item" => items.map(&:to_record) }
21
+ end
22
+ end
23
+ end
24
+ end
25
+
@@ -7,7 +7,7 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::ListRel
9
9
 
10
- actions :get, :get_list, :add, :delete, :search, :update, :upsert
10
+ actions :get, :get_list, :add, :delete, :delete_list, :search, :update, :upsert
11
11
 
12
12
  fields :salutation, :first_name, :middle_name, :last_name, :title, :phone, :fax, :email, :default_address,
13
13
  :entity_id, :phonetic_name, :alt_email, :office_phone, :home_phone, :mobile_phone, :supervisor_phone,
@@ -42,11 +42,8 @@ module NetSuite
42
42
  end
43
43
 
44
44
  def to_record
45
- contacts.map do |contact|
46
- { "#{record_namespace}:contact" => contact.to_record }
47
- end
45
+ { "#{record_namespace}:contact" => contacts.map(&:to_record) }
48
46
  end
49
-
50
47
  end
51
48
  end
52
49
  end
@@ -7,7 +7,7 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::TranCust
9
9
 
10
- actions :get, :get_list, :add, :initialize, :delete, :update, :upsert
10
+ actions :get, :get_list, :add, :initialize, :delete, :update, :upsert, :search
11
11
 
12
12
  fields :alt_handling_cost, :alt_shipping_cost, :amount_paid, :amount_remaining, :auto_apply, :balance,
13
13
  :bill_address, :contrib_pct, :created_date, :currency_name, :deferred_revenue, :discount_rate, :email,
@@ -17,11 +17,8 @@ module NetSuite
17
17
  end
18
18
 
19
19
  def to_record
20
- applies.map do |apply|
21
- { "#{record_namespace}:apply" => apply.to_record }
22
- end
20
+ { "#{record_namespace}:apply" => applies.map(&:to_record) }
23
21
  end
24
-
25
22
  end
26
23
  end
27
24
  end
@@ -13,6 +13,7 @@ module NetSuite
13
13
  :vsoe_permit_discount, :vsoe_price
14
14
 
15
15
  field :custom_field_list, CustomFieldList
16
+ field :inventory_detail, InventoryDetail
16
17
 
17
18
  record_refs :department, :item, :job, :klass, :location, :price, :rev_rec_schedule, :tax_code, :units
18
19
 
@@ -17,11 +17,8 @@ module NetSuite
17
17
  end
18
18
 
19
19
  def to_record
20
- items.map do |item|
21
- { "#{record_namespace}:item" => item.to_record }
22
- end
20
+ { "#{record_namespace}:item" => items.map(&:to_record) }
23
21
  end
24
-
25
22
  end
26
23
  end
27
24
  end
@@ -72,6 +72,9 @@ module NetSuite
72
72
  '@xsi:type' => custom_field.type
73
73
  }
74
74
 
75
+ # TODO this is broken in > 2013_1; need to conditionally change the synax here
76
+ # if NetSuite::Configuration.api_version < "2013_2"
77
+
75
78
  if custom_field.internal_id
76
79
  base['@internalId'] = custom_field.internal_id
77
80
  end
@@ -7,23 +7,23 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::ListRel
9
9
 
10
- actions :get, :get_list, :add, :update, :upsert, :upsert_list, :delete, :search
10
+ actions :get, :get_list, :add, :update, :upsert, :upsert_list, :delete, :delete_list, :search
11
11
 
12
12
  # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/schema/record/customer.html
13
13
 
14
- fields :access_role, :account_number, :aging, :alt_email, :alt_name, :alt_phone, :bill_pay,
14
+ fields :account_number, :aging, :alt_email, :alt_name, :alt_phone, :bill_pay,
15
15
  :buying_reason, :buying_time_frame, :campaign_category, :click_stream, :comments, :company_name,
16
16
  :consol_aging, :consol_days_overdue, :contrib_pct, :credit_cards_list, :credit_hold_override,
17
- :credit_limit, :currency, :currency_list, :date_created, :days_overdue, :default_address,
17
+ :credit_limit, :currency_list, :date_created, :days_overdue, :default_address,
18
18
  :download_list, :email, :email_preference, :email_transactions, :end_date, :entity_id,
19
19
  :estimated_budget, :fax, :fax_transactions, :first_name, :first_visit, :give_access, :global_subscription_status,
20
20
  :group_pricing_list, :home_phone, :image, :is_budget_approved, :is_inactive, :is_person, :item_pricing_list, :keywords,
21
21
  :language, :last_modified_date, :last_name, :last_page_visited, :last_visit, :middle_name, :mobile_phone,
22
- :opening_balance, :opening_balance_account, :opening_balance_date, :parent, :partners_list,
22
+ :opening_balance, :opening_balance_account, :opening_balance_date, :partners_list,
23
23
  :password, :password2, :phone, :phonetic_name, :pref_cc_processor, :print_on_check_as,
24
24
  :print_transactions, :referrer, :reminder_days, :representing_subsidiary, :require_pwd_change, :resale_number,
25
- :sales_group, :sales_readiness, :sales_rep, :sales_team_list, :salutation, :send_email, :ship_complete, :shipping_item,
26
- :stage, :start_date, :subscriptions_list, :sync_partner_teams, :tax_exempt, :tax_item, :taxable, :terms,
25
+ :sales_group, :sales_readiness, :sales_team_list, :salutation, :send_email, :ship_complete, :shipping_item,
26
+ :stage, :start_date, :subscriptions_list, :sync_partner_teams, :tax_exempt, :tax_item, :taxable,
27
27
  :territory, :third_party_acct, :third_party_country, :third_party_zipcode, :title, :url,
28
28
  :vat_reg_number, :visits, :web_lead
29
29
 
@@ -34,8 +34,8 @@ module NetSuite
34
34
  read_only_fields :balance, :consol_balance, :deposit_balance, :consol_deposit_balance, :overdue_balance,
35
35
  :consol_overdue_balance, :unbilled_orders, :consol_unbilled_orders
36
36
 
37
- record_refs :custom_form, :entity_status, :partner, :category, :lead_source,
38
- :price_level, :subsidiary
37
+ record_refs :access_role, :custom_form, :currency, :entity_status, :partner, :category, :lead_source,
38
+ :price_level,:sales_rep, :subsidiary, :terms, :parent
39
39
 
40
40
  attr_reader :internal_id
41
41
  attr_accessor :external_id
@@ -7,7 +7,7 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::TranCust
9
9
 
10
- actions :get, :get_list, :initialize, :add, :delete, :upsert
10
+ actions :get, :get_list, :initialize, :add, :delete, :update, :upsert
11
11
 
12
12
  fields :auth_code, :auto_apply, :cc_approved, :cc_avs_street_match, :cc_avs_zip_match,
13
13
  :cc_expire_date, :cc_name, :cc_number, :cc_security_code, :cc_security_code_match, :cc_street, :cc_zip_code,
@@ -14,4 +14,4 @@ module NetSuite
14
14
 
15
15
  end
16
16
  end
17
- end
17
+ end
@@ -1,14 +1,21 @@
1
1
  module NetSuite
2
2
  module Records
3
3
  class CustomerPaymentApplyList
4
+ include Support::Fields
4
5
  include Namespaces::TranCust
5
6
 
7
+ fields :apply
8
+
6
9
  def initialize(attributes = {})
7
- case attributes[:apply]
8
- when Hash
9
- applies << CustomerPaymentApply.new(attributes[:apply])
10
- when Array
11
- attributes[:apply].each { |apply| applies << CustomerPaymentApply.new(apply) }
10
+ initialize_from_attributes_hash(attributes)
11
+ end
12
+
13
+ def apply=(applies)
14
+ case applies
15
+ when Hash
16
+ self.applies << CustomerPaymentApply.new(applies)
17
+ when Array
18
+ applies.each { |apply| self.applies << CustomerPaymentApply.new(apply) }
12
19
  end
13
20
  end
14
21
 
@@ -17,11 +24,8 @@ module NetSuite
17
24
  end
18
25
 
19
26
  def to_record
20
- applies.map do |apply|
21
- { "#{record_namespace}:apply" => apply.to_record }
22
- end
27
+ { "#{record_namespace}:apply" => applies.map(&:to_record) }
23
28
  end
24
-
25
29
  end
26
30
  end
27
31
  end
@@ -7,7 +7,7 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::TranCust
9
9
 
10
- actions :get, :get_list, :initialize, :add, :delete, :upsert
10
+ actions :get, :get_list, :initialize, :add, :delete, :update, :upsert
11
11
 
12
12
  fields :address, :cc_approved, :cc_expire_date, :cc_name, :cc_number, :cc_street, :cc_zip_code, :charge_it,
13
13
  :created_date, :currency_name, :debit_card_issue_no, :exchange_rate, :last_modified_date, :memo, :pn_ref_num, :status,
@@ -3,6 +3,10 @@ module NetSuite
3
3
  class CustomerRefundApplyList
4
4
  include Namespaces::TranCust
5
5
 
6
+ # TODO should use new sublist implementation
7
+
8
+ attr_accessor :replace_all
9
+
6
10
  def initialize(attributes = {})
7
11
  case attributes[:apply]
8
12
  when Hash
@@ -17,9 +21,9 @@ module NetSuite
17
21
  end
18
22
 
19
23
  def to_record
20
- applies.map do |apply|
21
- { "#{record_namespace}:apply" => apply.to_record }
22
- end
24
+ rec = { "#{record_namespace}:apply" => applies.map(&:to_record) }
25
+ rec[:@replaceAll] = @replace_all unless @replace_all.nil?
26
+ rec
23
27
  end
24
28
 
25
29
  end
@@ -26,4 +26,4 @@ module NetSuite
26
26
  end
27
27
  end
28
28
  end
29
- end
29
+ end
@@ -7,9 +7,9 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::TranBank
9
9
 
10
- actions :get, :get_list, :add, :delete, :upsert
10
+ actions :get, :get_list, :add, :delete, :upsert, :update
11
11
 
12
- fields :created_date, :last_modified_date, :currency_name, :tran_id, :total, :tran_date, :memo, :to_be_printed
12
+ fields :created_date, :last_modified_date, :currency_name, :exchange_rate, :tran_id, :total, :tran_date, :memo, :to_be_printed
13
13
 
14
14
  record_refs :custom_form, :account, :posting_period, :subsidiary, :department, :klass, :location
15
15
 
@@ -29,4 +29,4 @@ module NetSuite
29
29
 
30
30
  end
31
31
  end
32
- end
32
+ end
@@ -4,6 +4,8 @@ module NetSuite
4
4
  include Support::Fields
5
5
  include Namespaces::TranBank
6
6
 
7
+ attr_accessor :replace_all
8
+
7
9
  fields :deposit_payment
8
10
 
9
11
  def initialize(attributes = {})
@@ -24,9 +26,10 @@ module NetSuite
24
26
  end
25
27
 
26
28
  def to_record
27
- { "#{record_namespace}:depositPayment" => payments.map(&:to_record) }
29
+ rec = { "#{record_namespace}:depositPayment" => payments.map(&:to_record) }
30
+ rec[:@replaceAll] = @replace_all unless @replace_all.nil?
31
+ rec
28
32
  end
29
-
30
33
  end
31
34
  end
32
35
  end
@@ -1,20 +1,28 @@
1
1
  module NetSuite
2
2
  module Records
3
-
4
3
  class Employee < Support::Base
4
+ include Support::RecordRefs
5
5
  include Support::Actions
6
+ include Support::RecordRefs
6
7
  include Namespaces::ListEmp
7
8
 
8
9
  # https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2014_1/script/record/employee.html
9
10
 
10
11
  actions :get, :get_list, :add, :update, :upsert, :upsert_list, :delete, :search
11
12
 
12
- fields :phone, :first_name, :last_name, :is_inactive, :email
13
+ fields :phone, :first_name, :last_name, :is_inactive, :email, :give_access, :send_email, :is_support_rep,
14
+ :birth_date, :hire_date, :last_review_date, :next_review_date, :title, :home_phone, :office_phone,
15
+ :eligible_for_commission, :is_sales_rep, :klass, :middle_name, :account_number, :alien_number, :approval_limit,
16
+ :bill_pay, :comments, :date_created, :direct_deposit, :employee_status, :employee_type, :entity_id,
17
+ :expense_limit, :fax, :is_job_resource, :job_description, :labor_cost, :last_modified_date, :mobile_phone, :pay_frequency,
18
+ :phonetic_name, :purchase_order_approval_limit, :purchase_order_approver, :purchase_order_limit, :release_date,
19
+ :resident_status, :salutation, :social_security_number, :visa_exp_date, :visa_type
20
+
21
+ record_refs :currency, :department, :location, :subsidiary
13
22
 
14
23
  field :roles_list, RoleList
15
24
 
16
- attr_reader :internal_id
25
+ attr_reader :internal_id
17
26
  end
18
-
19
27
  end
20
28
  end
@@ -6,7 +6,7 @@ module NetSuite
6
6
  include Support::Fields
7
7
  include Namespaces::PlatformCommon
8
8
 
9
- fields :date_time, :quantity, :quantity_available,
9
+ fields :date_time, :quantity, :quantity_available, :expiration_date,
10
10
  :receipt_inventory_number
11
11
 
12
12
  record_refs :bin_number, :issue_inventory_number, :to_bin_number
@@ -25,7 +25,9 @@ module NetSuite
25
25
  end
26
26
 
27
27
  def to_record
28
- { "#{record_namespace}:inventoryAssignment" => inventory_assignment.map(&:to_record) }
28
+ rec = { "#{record_namespace}:inventoryAssignment" => inventory_assignment.map(&:to_record) }
29
+ rec[:@replaceAll] = self.replace_all if !self.replace_all.nil?
30
+ rec
29
31
  end
30
32
  end
31
33
  end
@@ -1,15 +1,15 @@
1
1
  module NetSuite
2
2
  module Records
3
3
  class InventoryDetail
4
+ include Support::Fields
4
5
  include Support::RecordRefs
5
6
  include Support::Records
6
- include Support::Fields
7
7
  include Namespaces::PlatformCommon
8
8
 
9
- record_ref :custom_form
10
-
11
9
  field :inventory_assignment_list, InventoryAssignmentList
12
10
 
11
+ record_refs :custom_form
12
+
13
13
  def initialize(attributes = {})
14
14
  initialize_from_attributes_hash(attributes)
15
15
  end
@@ -58,6 +58,10 @@ module NetSuite
58
58
  field :bin_number_list, BinNumberList
59
59
  field :locations_list, LocationsList
60
60
  field :matrix_option_list, MatrixOptionList
61
+ field :subsidiary_list, RecordRefList
62
+
63
+ # for Assembly/Kit
64
+ field :member_list, MemberList
61
65
 
62
66
  attr_reader :internal_id
63
67
  attr_accessor :external_id
@@ -7,7 +7,7 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::TranSales
9
9
 
10
- actions :get, :get_list, :initialize, :add, :delete, :upsert
10
+ actions :get, :get_list, :initialize, :add, :delete, :upsert, :search
11
11
 
12
12
  fields :balance, :bill_address,
13
13
  :billing_schedule, :contrib_pct, :created_date, :currency_name, :custom_field_list,
@@ -19,8 +19,8 @@ module NetSuite
19
19
  :handling_tax_2_rate, :handling_tax_code, :is_taxable, :item_cost_disc_amount, :item_cost_disc_print,
20
20
  :item_cost_disc_rate, :item_cost_disc_tax_1_amt, :item_cost_disc_taxable, :item_cost_discount, :item_cost_list,
21
21
  :item_cost_tax_code, :item_cost_tax_rate_1, :item_cost_tax_rate_2, :item_list, :job, :last_modified_date,
22
- :lead_source, :linked_tracking_numbers, :memo, :message, :message_sel, :on_credit_hold, :opportunity,
23
- :other_ref_num, :partners_list, :promo_code, :rev_rec_end_date,
22
+ :linked_tracking_numbers, :memo, :message, :message_sel, :on_credit_hold, :opportunity,
23
+ :other_ref_num, :partners_list, :rev_rec_end_date,
24
24
  :rev_rec_on_rev_commitment, :rev_rec_schedule, :rev_rec_start_date, :revenue_status, :sales_effective_date,
25
25
  :sales_group, :sales_team_list, :ship_address, :ship_date, :ship_group_list,
26
26
  :shipping_cost, :shipping_tax_1_rate, :shipping_tax_2_rate, :shipping_tax_code, :source, :start_date,
@@ -40,7 +40,7 @@ module NetSuite
40
40
 
41
41
  record_refs :account, :bill_address_list, :custom_form, :department, :entity, :klass, :partner,
42
42
  :posting_period, :ship_address_list, :terms, :location, :sales_rep, :tax_item, :created_from,
43
- :ship_method
43
+ :ship_method, :lead_source, :promo_code
44
44
 
45
45
  attr_reader :internal_id
46
46
  attr_accessor :external_id
@@ -59,6 +59,10 @@ module NetSuite
59
59
  rec
60
60
  end
61
61
 
62
+ def self.search_class_name
63
+ "Transaction"
64
+ end
65
+
62
66
  end
63
67
  end
64
68
  end
@@ -1,30 +1,13 @@
1
1
  module NetSuite
2
2
  module Records
3
- class InvoiceItemList
4
- include Support::Fields
3
+ class InvoiceItemList < Support::Sublist
5
4
  include Namespaces::TranSales
6
5
 
7
- fields :item
8
-
9
- def initialize(attributes = {})
10
- initialize_from_attributes_hash(attributes)
11
- end
12
-
13
- def item=(items)
14
- case items
15
- when Hash
16
- self.items << InvoiceItem.new(items)
17
- when Array
18
- items.each { |item| self.items << InvoiceItem.new(item) }
19
- end
20
- end
6
+ sublist :item, InvoiceItem
21
7
 
8
+ # legacy support
22
9
  def items
23
- @items ||= []
24
- end
25
-
26
- def to_record
27
- { "#{record_namespace}:item" => items.map(&:to_record) }
10
+ self.item
28
11
  end
29
12
 
30
13
  end