netsuite 0.8.10 → 0.8.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.github/dependabot.yml +14 -0
  4. data/.github/workflows/codeql-analysis.yml +70 -0
  5. data/.github/workflows/main.yml +7 -4
  6. data/Gemfile +5 -3
  7. data/HISTORY.md +27 -2
  8. data/README.md +13 -18
  9. data/lib/netsuite/actions/add.rb +5 -1
  10. data/lib/netsuite/actions/attach_file.rb +87 -0
  11. data/lib/netsuite/actions/search.rb +19 -6
  12. data/lib/netsuite/records/account.rb +0 -1
  13. data/lib/netsuite/records/accounting_period.rb +1 -1
  14. data/lib/netsuite/records/assembly_component.rb +0 -2
  15. data/lib/netsuite/records/assembly_item.rb +0 -1
  16. data/lib/netsuite/records/assembly_unbuild.rb +0 -1
  17. data/lib/netsuite/records/cash_refund.rb +0 -1
  18. data/lib/netsuite/records/cash_sale.rb +1 -2
  19. data/lib/netsuite/records/contact.rb +0 -1
  20. data/lib/netsuite/records/credit_memo.rb +0 -1
  21. data/lib/netsuite/records/currency_rate.rb +0 -1
  22. data/lib/netsuite/records/custom_record.rb +1 -1
  23. data/lib/netsuite/records/customer.rb +0 -1
  24. data/lib/netsuite/records/customer_deposit.rb +0 -1
  25. data/lib/netsuite/records/customer_payment.rb +0 -1
  26. data/lib/netsuite/records/customer_refund.rb +0 -1
  27. data/lib/netsuite/records/deposit.rb +0 -1
  28. data/lib/netsuite/records/deposit_application.rb +0 -1
  29. data/lib/netsuite/records/description_item.rb +1 -1
  30. data/lib/netsuite/records/estimate.rb +0 -1
  31. data/lib/netsuite/records/inbound_shipment.rb +0 -1
  32. data/lib/netsuite/records/inventory_item.rb +236 -37
  33. data/lib/netsuite/records/inventory_number.rb +0 -1
  34. data/lib/netsuite/records/invoice.rb +1 -2
  35. data/lib/netsuite/records/item_fulfillment.rb +0 -1
  36. data/lib/netsuite/records/item_group.rb +1 -1
  37. data/lib/netsuite/records/item_option_custom_field.rb +52 -0
  38. data/lib/netsuite/records/item_receipt.rb +0 -1
  39. data/lib/netsuite/records/item_vendor.rb +10 -1
  40. data/lib/netsuite/records/job.rb +0 -1
  41. data/lib/netsuite/records/kit_item.rb +1 -1
  42. data/lib/netsuite/records/location.rb +0 -1
  43. data/lib/netsuite/records/lot_numbered_inventory_item.rb +225 -81
  44. data/lib/netsuite/records/matrix_option_list.rb +16 -0
  45. data/lib/netsuite/records/non_inventory_resale_item.rb +156 -20
  46. data/lib/netsuite/records/non_inventory_sale_item.rb +133 -21
  47. data/lib/netsuite/records/opportunity.rb +0 -1
  48. data/lib/netsuite/records/other_charge_sale_item.rb +1 -1
  49. data/lib/netsuite/records/payment_item.rb +1 -1
  50. data/lib/netsuite/records/payroll_item.rb +0 -1
  51. data/lib/netsuite/records/purchase_order.rb +0 -1
  52. data/lib/netsuite/records/return_authorization.rb +1 -0
  53. data/lib/netsuite/records/sales_order.rb +1 -2
  54. data/lib/netsuite/records/serialized_inventory_item.rb +1 -1
  55. data/lib/netsuite/records/serialized_inventory_item_location.rb +0 -1
  56. data/lib/netsuite/records/service_resale_item.rb +123 -19
  57. data/lib/netsuite/records/service_sale_item.rb +0 -1
  58. data/lib/netsuite/records/subsidiary.rb +0 -1
  59. data/lib/netsuite/records/subtotal_item.rb +1 -1
  60. data/lib/netsuite/records/transfer_order.rb +0 -1
  61. data/lib/netsuite/records/translation.rb +17 -0
  62. data/lib/netsuite/records/translation_list.rb +11 -0
  63. data/lib/netsuite/records/vendor.rb +0 -1
  64. data/lib/netsuite/records/vendor_bill.rb +0 -1
  65. data/lib/netsuite/records/work_order.rb +0 -1
  66. data/lib/netsuite/records/work_order_item.rb +0 -1
  67. data/lib/netsuite/support/actions.rb +2 -0
  68. data/lib/netsuite/support/fields.rb +2 -0
  69. data/lib/netsuite/support/records.rb +9 -1
  70. data/lib/netsuite/utilities.rb +5 -0
  71. data/lib/netsuite/version.rb +1 -1
  72. data/lib/netsuite.rb +4 -0
  73. data/netsuite.gemspec +2 -2
  74. data/spec/netsuite/actions/add_spec.rb +36 -0
  75. data/spec/netsuite/actions/attach_file_spec.rb +59 -0
  76. data/spec/netsuite/actions/search_spec.rb +205 -0
  77. data/spec/netsuite/records/inventory_item_spec.rb +239 -22
  78. data/spec/netsuite/records/invoice_spec.rb +29 -0
  79. data/spec/netsuite/records/item_option_custom_field_spec.rb +27 -0
  80. data/spec/netsuite/records/item_vendor_list_spec.rb +2 -5
  81. data/spec/netsuite/records/item_vendor_spec.rb +14 -2
  82. data/spec/netsuite/records/lot_numbered_inventory_item_spec.rb +247 -0
  83. data/spec/netsuite/records/matrix_option_list_spec.rb +26 -0
  84. data/spec/netsuite/records/non_inventory_resale_item_spec.rb +159 -24
  85. data/spec/netsuite/records/non_inventory_sale_item_spec.rb +135 -22
  86. data/spec/netsuite/records/return_authorization_spec.rb +62 -0
  87. data/spec/netsuite/records/sales_order_spec.rb +29 -0
  88. data/spec/netsuite/records/service_resale_item_spec.rb +122 -17
  89. data/spec/netsuite/records/translation_list_spec.rb +34 -0
  90. data/spec/netsuite/records/translation_spec.rb +28 -0
  91. data/spec/netsuite/support/fields_spec.rb +16 -4
  92. data/spec/netsuite/support/search_result_spec.rb +12 -0
  93. data/spec/netsuite/utilities_spec.rb +10 -2
  94. data/spec/support/fixtures/add/add_file.xml +20 -0
  95. data/spec/support/fixtures/attach/attach_file_to_sales_order.xml +16 -0
  96. data/spec/support/fixtures/attach/attach_file_to_sales_order_error.xml +20 -0
  97. data/spec/support/fixtures/search/basic_search_contact.xml +39 -0
  98. data/spec/support/fixtures/search/single_search_result.xml +46 -0
  99. metadata +37 -8
@@ -5,11 +5,23 @@ describe NetSuite::Records::ItemVendor do
5
5
 
6
6
  it 'has all the right fields' do
7
7
  [
8
- :vendor, :purchase_price, :preferred_vendor
8
+ :purchase_price,
9
+ :preferred_vendor,
10
+ :vendor_code,
11
+ :vendor_currency_name,
9
12
  ].each do |field|
10
13
  expect(vendor).to have_field(field)
11
14
  end
12
15
  end
13
16
 
14
- it 'has all the right record refs'
17
+ it 'has all the right record refs' do
18
+ [
19
+ :schedule,
20
+ :subsidiary,
21
+ :vendor,
22
+ :vendor_currency,
23
+ ].each do |field|
24
+ expect(vendor).to have_record_ref(field)
25
+ end
26
+ end
15
27
  end
@@ -0,0 +1,247 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::LotNumberedInventoryItem do
4
+ let(:item) { described_class.new }
5
+
6
+ it 'has all the right fields' do
7
+ [
8
+ :auto_lead_time,
9
+ :auto_preferred_stock_level,
10
+ :auto_reorder_point,
11
+ :available_to_partners,
12
+ :average_cost,
13
+ :backward_consumption_days,
14
+ :conversion_rate,
15
+ :copy_description,
16
+ :cost,
17
+ :cost_estimate,
18
+ :cost_estimate_type,
19
+ :costing_method,
20
+ :costing_method_display,
21
+ :cost_units,
22
+ :country_of_manufacture,
23
+ :created_date,
24
+ :currency,
25
+ :default_return_cost,
26
+ :demand_modifier,
27
+ :demand_time_fence,
28
+ :direct_revenue_posting,
29
+ :display_name,
30
+ :dont_show_price,
31
+ :enable_catch_weight,
32
+ :enforce_min_qty_internally,
33
+ :exclude_from_sitemap,
34
+ :expiration_date,
35
+ :featured_description,
36
+ :fixed_lot_size,
37
+ :forward_consumption_days,
38
+ :future_horizon,
39
+ :handling_cost,
40
+ :handling_cost_units,
41
+ :hazmat_hazard_class,
42
+ :hazmat_id,
43
+ :hazmat_item_units,
44
+ :hazmat_item_units_qty,
45
+ :hazmat_packing_group,
46
+ :hazmat_shipping_name,
47
+ :include_children,
48
+ :invt_classification,
49
+ :invt_count_interval,
50
+ :is_donation_item,
51
+ :is_drop_ship_item,
52
+ :is_gco_compliant,
53
+ :is_hazmat_item,
54
+ :is_inactive,
55
+ :is_online,
56
+ :is_special_order_item,
57
+ :is_store_pickup_allowed,
58
+ :is_taxable,
59
+ :item_carrier,
60
+ :item_id,
61
+ :last_invt_count_date,
62
+ :last_modified_date,
63
+ :last_purchase_price,
64
+ :lead_time,
65
+ :lower_warning_limit,
66
+ :manufacturer,
67
+ :manufacturer_addr1,
68
+ :manufacturer_city,
69
+ :manufacturer_state,
70
+ :manufacturer_tariff,
71
+ :manufacturer_tax_id,
72
+ :manufacturer_zip,
73
+ :match_bill_to_receipt,
74
+ :matrix_item_name_template,
75
+ :matrix_type,
76
+ :max_donation_amount,
77
+ :maximum_quantity,
78
+ :meta_tag_html,
79
+ :minimum_quantity,
80
+ :minimum_quantity_units,
81
+ :mpn,
82
+ :mult_manufacture_addr,
83
+ :nex_tag_category,
84
+ :next_invt_count_date,
85
+ :no_price_message,
86
+ :offer_support,
87
+ :on_hand_value_mli,
88
+ :on_special,
89
+ :out_of_stock_behavior,
90
+ :out_of_stock_message,
91
+ :overall_quantity_pricing_type,
92
+ :page_title,
93
+ :periodic_lot_size_days,
94
+ :periodic_lot_size_type,
95
+ :preference_criterion,
96
+ :preferred_stock_level,
97
+ :preferred_stock_level_days,
98
+ :preferred_stock_level_units,
99
+ :prices_include_tax,
100
+ :producer,
101
+ :purchase_description,
102
+ :purchase_order_amount,
103
+ :purchase_order_quantity,
104
+ :purchase_order_quantity_diff,
105
+ :quantity_available,
106
+ :quantity_back_ordered,
107
+ :quantity_committed,
108
+ :quantity_on_hand,
109
+ :quantity_on_hand_units,
110
+ :quantity_on_order,
111
+ :quantity_reorder_units,
112
+ :rate,
113
+ :receipt_amount,
114
+ :receipt_quantity,
115
+ :receipt_quantity_diff,
116
+ :related_items_description,
117
+ :reorder_multiple,
118
+ :reorder_point,
119
+ :reorder_point_units,
120
+ :reschedule_in_days,
121
+ :reschedule_out_days,
122
+ :round_up_as_component,
123
+ :safety_stock_level,
124
+ :safety_stock_level_days,
125
+ :safety_stock_level_units,
126
+ :sales_description,
127
+ :schedule_b_code,
128
+ :schedule_b_number,
129
+ :schedule_b_quantity,
130
+ :search_keywords,
131
+ :seasonal_demand,
132
+ :serial_numbers,
133
+ :ship_individually,
134
+ :shipping_cost,
135
+ :shipping_cost_units,
136
+ :shopping_dot_com_category,
137
+ :shopzilla_category_id,
138
+ :show_default_donation_amount,
139
+ :sitemap_priority,
140
+ :specials_description,
141
+ :stock_description,
142
+ :store_description,
143
+ :store_detailed_description,
144
+ :store_display_name,
145
+ :supply_time_fence,
146
+ :total_value,
147
+ :track_landed_cost,
148
+ :transfer_price,
149
+ :upc_code,
150
+ :upper_warning_limit,
151
+ :url_component,
152
+ :use_bins,
153
+ :use_marginal_rates,
154
+ :vendor_name,
155
+ :vsoe_deferral,
156
+ :vsoe_delivered,
157
+ :vsoe_permit_discount,
158
+ :vsoe_price,
159
+ :vsoe_sop_group,
160
+ :weight,
161
+ :weight_unit,
162
+ :weight_units,
163
+ ].each do |field|
164
+ expect(item).to have_field(field)
165
+ end
166
+ end
167
+
168
+ it 'has all the right fields with specific classes' do
169
+ {
170
+ bin_number_list: NetSuite::Records::BinNumberList,
171
+ custom_field_list: NetSuite::Records::CustomFieldList,
172
+ item_number_options_list: NetSuite::Records::RecordRefList,
173
+ item_ship_method_list: NetSuite::Records::RecordRefList,
174
+ item_vendor_list: NetSuite::Records::ItemVendorList,
175
+ locations_list: NetSuite::Records::LocationsList,
176
+ matrix_option_list: NetSuite::Records::MatrixOptionList,
177
+ pricing_matrix: NetSuite::Records::PricingMatrix,
178
+ subsidiary_list: NetSuite::Records::RecordRefList,
179
+ translations_list: NetSuite::Records::TranslationList,
180
+ }.each do |field, klass|
181
+ expect(item).to have_field(field, klass)
182
+ end
183
+ end
184
+
185
+ it 'has all the right record refs' do
186
+ [
187
+ :alternate_demand_source_item,
188
+ :asset_account,
189
+ :bill_exch_rate_variance_acct,
190
+ :billing_schedule,
191
+ :bill_price_variance_acct,
192
+ :bill_qty_variance_acct,
193
+ :klass,
194
+ :cogs_account,
195
+ :consumption_unit,
196
+ :cost_category,
197
+ :create_revenue_plans_on,
198
+ :custom_form,
199
+ :default_item_ship_method,
200
+ :deferred_revenue_account,
201
+ :demand_source,
202
+ :department,
203
+ :dropship_expense_account,
204
+ :gain_loss_account,
205
+ :income_account,
206
+ :interco_cogs_account,
207
+ :interco_income_account,
208
+ :issue_product,
209
+ :item_revenue_category,
210
+ :location,
211
+ :parent,
212
+ :planning_item_category,
213
+ :preferred_location,
214
+ :pricing_group,
215
+ :purchase_price_variance_acct,
216
+ :purchase_tax_code,
217
+ :purchase_unit,
218
+ :quantity_pricing_schedule,
219
+ :revenue_allocation_group,
220
+ :revenue_recognition_rule,
221
+ :rev_rec_forecast_rule,
222
+ :rev_rec_schedule,
223
+ :sales_tax_code,
224
+ :sale_unit,
225
+ :secondary_base_unit,
226
+ :secondary_consumption_unit,
227
+ :secondary_purchase_unit,
228
+ :secondary_sale_unit,
229
+ :secondary_stock_unit,
230
+ :secondary_units_type,
231
+ :ship_package,
232
+ :soft_descriptor,
233
+ :stock_unit,
234
+ :store_display_image,
235
+ :store_display_thumbnail,
236
+ :store_item_template,
237
+ :supply_lot_sizing_method,
238
+ :supply_replenishment_method,
239
+ :supply_type,
240
+ :tax_schedule,
241
+ :units_type,
242
+ :vendor,
243
+ ].each do |record_ref|
244
+ expect(item).to have_record_ref(record_ref)
245
+ end
246
+ end
247
+ end
@@ -4,6 +4,8 @@ require 'ostruct'
4
4
  module NetSuite
5
5
  module Records
6
6
  describe MatrixOptionList do
7
+ let(:list) { described_class.new }
8
+
7
9
  it "deals with hash properly" do
8
10
  hash = {:value=>{:@internal_id=>"1", :@type_id=>"36", :name=>"some value"}, :@script_id=>'cust_field_1'}
9
11
 
@@ -30,6 +32,30 @@ module NetSuite
30
32
  expect(option.name).to eq "some value 28"
31
33
  expect(option.script_id).to eq "cust_field_28"
32
34
  end
35
+
36
+ describe '#to_record' do
37
+ before do
38
+ list.options << OpenStruct.new(
39
+ type_id: 'TYPE',
40
+ value_id: 'VALUE',
41
+ script_id: 'SCRIPT',
42
+ name: 'NAME',
43
+ )
44
+ end
45
+
46
+ it 'can represent itself as a SOAP record' do
47
+ record = {
48
+ 'listAcct:matrixOption' => [{
49
+ '@scriptId' => 'SCRIPT',
50
+ 'platformCore:value' => {
51
+ '@internalId' => 'VALUE',
52
+ '@typeId' => 'TYPE',
53
+ },
54
+ }],
55
+ }
56
+ expect(list.to_record).to eql(record)
57
+ end
58
+ end
33
59
  end
34
60
  end
35
61
  end
@@ -5,38 +5,173 @@ describe NetSuite::Records::NonInventoryResaleItem do
5
5
 
6
6
  it 'has the right fields' do
7
7
  [
8
- :available_to_partners, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :country_of_manufacture, :created_date,
9
- :display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap,
10
- :featured_description, :handling_cost, :handling_cost_units, :include_children, :is_donation_item, :is_fulfillable,
11
- :is_gco_compliant, :is_inactive, :is_online, :is_taxable, :item_id, :last_modified_date, :manufacturer, :manufacturer_addr1,
12
- :manufacturer_city, :manufacturer_state, :manufacturer_tariff, :manufacturer_tax_id, :manufacturer_zip, :matrix_option_list,
13
- :matrix_type, :max_donation_amount, :meta_tag_html, :minimum_quantity, :minimum_quantity_units, :mpn,
14
- :mult_manufacture_addr, :nex_tag_category, :no_price_message, :offer_support, :on_special, :out_of_stock_behavior,
15
- :out_of_stock_message, :overall_quantity_pricing_type, :page_title, :preference_criterion, :presentation_item_list,
16
- :prices_include_tax, :producer, :product_feed_list, :rate, :related_items_description, :sales_description,
17
- :schedule_b_code, :schedule_b_number, :schedule_b_quantity, :search_keywords, :ship_individually, :shipping_cost,
18
- :shipping_cost_units, :shopping_dot_com_category, :shopzilla_category_id, :show_default_donation_amount,
19
- :site_category_list, :sitemap_priority, :soft_descriptor, :specials_description, :stock_description, :store_description,
20
- :store_detailed_description, :store_display_name, :translations_list, :upc_code, :url_component, :use_marginal_rates,
21
- :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount, :vsoe_price, :weight, :weight_unit, :weight_units
8
+ :amortization_period,
9
+ :available_to_partners,
10
+ :copy_description,
11
+ :cost,
12
+ :cost_estimate,
13
+ :cost_estimate_type,
14
+ :cost_estimate_units,
15
+ :cost_units,
16
+ :country_of_manufacture,
17
+ :created_date,
18
+ :currency,
19
+ :defer_rev_rec,
20
+ :direct_revenue_posting,
21
+ :display_name,
22
+ :dont_show_price,
23
+ :enforce_min_qty_internally,
24
+ :exclude_from_sitemap,
25
+ :featured_description,
26
+ :generate_accruals,
27
+ :handling_cost,
28
+ :handling_cost_units,
29
+ :hazmat_hazard_class,
30
+ :hazmat_id,
31
+ :hazmat_item_units,
32
+ :hazmat_item_units_qty,
33
+ :hazmat_packing_group,
34
+ :hazmat_shipping_name,
35
+ :include_children,
36
+ :is_donation_item,
37
+ :is_drop_ship_item,
38
+ :is_fulfillable,
39
+ :is_gco_compliant,
40
+ :is_hazmat_item,
41
+ :is_inactive,
42
+ :is_online,
43
+ :is_special_order_item,
44
+ :is_taxable,
45
+ :item_carrier,
46
+ :item_id,
47
+ :last_modified_date,
48
+ :manufacturer,
49
+ :manufacturer_addr1,
50
+ :manufacturer_city,
51
+ :manufacturer_state,
52
+ :manufacturer_tariff,
53
+ :manufacturer_tax_id,
54
+ :manufacturer_zip,
55
+ :matrix_item_name_template,
56
+ :matrix_type,
57
+ :max_donation_amount,
58
+ :maximum_quantity,
59
+ :meta_tag_html,
60
+ :minimum_quantity,
61
+ :minimum_quantity_units,
62
+ :mpn,
63
+ :mult_manufacture_addr,
64
+ :nex_tag_category,
65
+ :no_price_message,
66
+ :offer_support,
67
+ :on_special,
68
+ :out_of_stock_behavior,
69
+ :out_of_stock_message,
70
+ :overall_quantity_pricing_type,
71
+ :page_title,
72
+ :preference_criterion,
73
+ :prices_include_tax,
74
+ :producer,
75
+ :purchase_description,
76
+ :purchase_order_amount,
77
+ :purchase_order_quantity,
78
+ :purchase_order_quantity_diff,
79
+ :rate,
80
+ :receipt_amount,
81
+ :receipt_quantity,
82
+ :receipt_quantity_diff,
83
+ :related_items_description,
84
+ :residual,
85
+ :sales_description,
86
+ :schedule_b_code,
87
+ :schedule_b_number,
88
+ :schedule_b_quantity,
89
+ :search_keywords,
90
+ :ship_individually,
91
+ :shipping_cost,
92
+ :shipping_cost_units,
93
+ :shopping_dot_com_category,
94
+ :shopzilla_category_id,
95
+ :show_default_donation_amount,
96
+ :sitemap_priority,
97
+ :soft_descriptor,
98
+ :specials_description,
99
+ :stock_description,
100
+ :store_description,
101
+ :store_detailed_description,
102
+ :store_display_name,
103
+ :upc_code,
104
+ :url_component,
105
+ :use_marginal_rates,
106
+ :vendor_name,
107
+ :vsoe_deferral,
108
+ :vsoe_delivered,
109
+ :vsoe_permit_discount,
110
+ :vsoe_price,
111
+ :vsoe_sop_group,
112
+ :weight,
113
+ :weight_unit,
114
+ :weight_units,
22
115
  ].each do |field|
23
116
  expect(item).to have_field(field)
24
117
  end
118
+ end
25
119
 
26
- # TODO there is a probably a more robust way to test this
27
- expect(item.custom_field_list.class).to eq(NetSuite::Records::CustomFieldList)
28
- expect(item.pricing_matrix.class).to eq(NetSuite::Records::PricingMatrix)
29
- expect(item.subsidiary_list.class).to eq(NetSuite::Records::RecordRefList)
30
- expect(item.item_vendor_list.class).to eq(NetSuite::Records::ItemVendorList)
31
-
120
+ it 'has all the right fields with specific classes' do
121
+ {
122
+ custom_field_list: NetSuite::Records::CustomFieldList,
123
+ item_ship_method_list: NetSuite::Records::RecordRefList,
124
+ matrix_option_list: NetSuite::Records::MatrixOptionList,
125
+ pricing_matrix: NetSuite::Records::PricingMatrix,
126
+ subsidiary_list: NetSuite::Records::RecordRefList,
127
+ item_vendor_list: NetSuite::Records::ItemVendorList,
128
+ }.each do |field, klass|
129
+ expect(item).to have_field(field, klass)
130
+ end
32
131
  end
33
132
 
34
133
  it 'has the right record_refs' do
35
134
  [
36
- :billing_schedule, :cost_category, :custom_form, :deferred_revenue_account, :department, :income_account,
37
- :issue_product, :item_options_list, :klass, :location, :parent, :pricing_group, :purchase_tax_code,
38
- :quantity_pricing_schedule, :rev_rec_schedule, :sale_unit, :sales_tax_code, :ship_package, :store_display_image,
39
- :store_display_thumbnail, :store_item_template, :tax_schedule, :units_type, :expense_account
135
+ :amortization_template,
136
+ :bill_exch_rate_variance_acct,
137
+ :billing_schedule,
138
+ :bill_price_variance_acct,
139
+ :bill_qty_variance_acct,
140
+ :klass,
141
+ :consumption_unit,
142
+ :cost_category,
143
+ :create_revenue_plans_on,
144
+ :custom_form,
145
+ :default_item_ship_method,
146
+ :deferral_account,
147
+ :deferred_revenue_account,
148
+ :department,
149
+ :dropship_expense_account,
150
+ :expense_account,
151
+ :income_account,
152
+ :interco_expense_account,
153
+ :interco_income_account,
154
+ :issue_product,
155
+ :item_revenue_category,
156
+ :location,
157
+ :parent,
158
+ :pricing_group,
159
+ :purchase_tax_code,
160
+ :purchase_unit,
161
+ :quantity_pricing_schedule,
162
+ :revenue_allocation_group,
163
+ :revenue_recognition_rule,
164
+ :rev_rec_forecast_rule,
165
+ :rev_rec_schedule,
166
+ :sales_tax_code,
167
+ :sale_unit,
168
+ :ship_package,
169
+ :store_display_image,
170
+ :store_display_thumbnail,
171
+ :store_item_template,
172
+ :tax_schedule,
173
+ :units_type,
174
+ :vendor,
40
175
  ].each do |record_ref|
41
176
  expect(item).to have_record_ref(record_ref)
42
177
  end
@@ -5,36 +5,149 @@ describe NetSuite::Records::NonInventorySaleItem do
5
5
 
6
6
  it 'has the right fields' do
7
7
  [
8
- :available_to_partners, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :country_of_manufacture, :created_date,
9
- :direct_revenue_posting, :display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap,
10
- :featured_description, :handling_cost, :handling_cost_units, :include_children, :is_donation_item, :is_fulfillable,
11
- :is_gco_compliant, :is_inactive, :is_online, :is_taxable, :item_id, :last_modified_date, :manufacturer, :manufacturer_addr1,
12
- :manufacturer_city, :manufacturer_state, :manufacturer_tariff, :manufacturer_tax_id, :manufacturer_zip, :matrix_option_list,
13
- :matrix_type, :max_donation_amount, :meta_tag_html, :minimum_quantity, :minimum_quantity_units, :mpn,
14
- :mult_manufacture_addr, :nex_tag_category, :no_price_message, :offer_support, :on_special, :out_of_stock_behavior,
15
- :out_of_stock_message, :overall_quantity_pricing_type, :page_title, :preference_criterion, :presentation_item_list,
16
- :prices_include_tax, :producer, :product_feed_list, :rate, :related_items_description, :sales_description,
17
- :schedule_b_code, :schedule_b_number, :schedule_b_quantity, :search_keywords, :ship_individually, :shipping_cost,
18
- :shipping_cost_units, :shopping_dot_com_category, :shopzilla_category_id, :show_default_donation_amount,
19
- :site_category_list, :sitemap_priority, :soft_descriptor, :specials_description, :stock_description, :store_description,
20
- :store_detailed_description, :store_display_name, :translations_list, :upc_code, :url_component, :use_marginal_rates,
21
- :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount, :vsoe_price, :weight, :weight_unit, :weight_units
8
+ :available_to_partners,
9
+ :contingent_revenue_handling,
10
+ :cost_estimate,
11
+ :cost_estimate_type,
12
+ :cost_estimate_units,
13
+ :country_of_manufacture,
14
+ :created_date,
15
+ :defer_rev_rec,
16
+ :direct_revenue_posting,
17
+ :display_name,
18
+ :dont_show_price,
19
+ :enforce_min_qty_internally,
20
+ :exclude_from_sitemap,
21
+ :featured_description,
22
+ :handling_cost,
23
+ :handling_cost_units,
24
+ :hazmat_hazard_class,
25
+ :hazmat_id,
26
+ :hazmat_item_units,
27
+ :hazmat_item_units_qty,
28
+ :hazmat_packing_group,
29
+ :hazmat_shipping_name,
30
+ :include_children,
31
+ :is_donation_item,
32
+ :is_fulfillable,
33
+ :is_gco_compliant,
34
+ :is_hazmat_item,
35
+ :is_inactive,
36
+ :is_online,
37
+ :is_taxable,
38
+ :item_carrier,
39
+ :item_id,
40
+ :last_modified_date,
41
+ :manufacturer,
42
+ :manufacturer_addr1,
43
+ :manufacturer_city,
44
+ :manufacturer_state,
45
+ :manufacturer_tariff,
46
+ :manufacturer_tax_id,
47
+ :manufacturer_zip,
48
+ :matrix_item_name_template,
49
+ :matrix_type,
50
+ :max_donation_amount,
51
+ :maximum_quantity,
52
+ :meta_tag_html,
53
+ :minimum_quantity,
54
+ :minimum_quantity_units,
55
+ :mpn,
56
+ :mult_manufacture_addr,
57
+ :nex_tag_category,
58
+ :no_price_message,
59
+ :offer_support,
60
+ :on_special,
61
+ :out_of_stock_behavior,
62
+ :out_of_stock_message,
63
+ :overall_quantity_pricing_type,
64
+ :page_title,
65
+ :preference_criterion,
66
+ :prices_include_tax,
67
+ :producer,
68
+ :rate,
69
+ :related_items_description,
70
+ :sales_description,
71
+ :schedule_b_code,
72
+ :schedule_b_number,
73
+ :schedule_b_quantity,
74
+ :search_keywords,
75
+ :ship_individually,
76
+ :shipping_cost,
77
+ :shipping_cost_units,
78
+ :shopping_dot_com_category,
79
+ :shopzilla_category_id,
80
+ :show_default_donation_amount,
81
+ :sitemap_priority,
82
+ :soft_descriptor,
83
+ :specials_description,
84
+ :stock_description,
85
+ :store_description,
86
+ :store_detailed_description,
87
+ :store_display_name,
88
+ :upc_code,
89
+ :url_component,
90
+ :use_marginal_rates,
91
+ :vsoe_deferral,
92
+ :vsoe_delivered,
93
+ :vsoe_permit_discount,
94
+ :vsoe_price,
95
+ :vsoe_sop_group,
96
+ :weight,
97
+ :weight_unit,
98
+ :weight_units,
22
99
  ].each do |field|
23
100
  expect(item).to have_field(field)
24
101
  end
102
+ end
25
103
 
26
- # TODO there is a probably a more robust way to test this
27
- expect(item.custom_field_list.class).to eq(NetSuite::Records::CustomFieldList)
28
- expect(item.pricing_matrix.class).to eq(NetSuite::Records::PricingMatrix)
29
- expect(item.subsidiary_list.class).to eq(NetSuite::Records::RecordRefList)
104
+ it 'has all the right fields with specific classes' do
105
+ {
106
+ custom_field_list: NetSuite::Records::CustomFieldList,
107
+ item_ship_method_list: NetSuite::Records::RecordRefList,
108
+ matrix_option_list: NetSuite::Records::MatrixOptionList,
109
+ pricing_matrix: NetSuite::Records::PricingMatrix,
110
+ subsidiary_list: NetSuite::Records::RecordRefList,
111
+ }.each do |field, klass|
112
+ expect(item).to have_field(field, klass)
113
+ end
30
114
  end
31
115
 
32
116
  it 'has the right record_refs' do
33
117
  [
34
- :billing_schedule, :cost_category, :custom_form, :deferred_revenue_account, :department, :income_account, :issue_product,
35
- :item_options_list, :klass, :location, :parent, :pricing_group, :purchase_tax_code, :quantity_pricing_schedule,
36
- :rev_rec_schedule, :sale_unit, :sales_tax_code, :ship_package, :store_display_image, :store_display_thumbnail,
37
- :store_item_template, :tax_schedule, :units_type
118
+ :bill_exch_rate_variance_acct,
119
+ :billing_schedule,
120
+ :bill_price_variance_acct,
121
+ :bill_qty_variance_acct,
122
+ :klass,
123
+ :consumption_unit,
124
+ :cost_category,
125
+ :create_revenue_plans_on,
126
+ :custom_form,
127
+ :default_item_ship_method,
128
+ :deferred_revenue_account,
129
+ :department,
130
+ :income_account,
131
+ :issue_product,
132
+ :item_revenue_category,
133
+ :location,
134
+ :parent,
135
+ :pricing_group,
136
+ :purchase_tax_code,
137
+ :quantity_pricing_schedule,
138
+ :revenue_allocation_group,
139
+ :revenue_recognition_rule,
140
+ :rev_rec_forecast_rule,
141
+ :rev_reclass_f_x_account,
142
+ :rev_rec_schedule,
143
+ :sales_tax_code,
144
+ :sale_unit,
145
+ :ship_package,
146
+ :store_display_image,
147
+ :store_display_thumbnail,
148
+ :store_item_template,
149
+ :tax_schedule,
150
+ :units_type,
38
151
  ].each do |record_ref|
39
152
  expect(item).to have_record_ref(record_ref)
40
153
  end