netsuite 0.8.10 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +1 -0
- data/.github/dependabot.yml +14 -0
- data/.github/workflows/codeql-analysis.yml +70 -0
- data/.github/workflows/main.yml +7 -4
- data/Gemfile +5 -3
- data/HISTORY.md +56 -2
- data/README.md +94 -38
- data/lib/netsuite/actions/add.rb +7 -2
- data/lib/netsuite/actions/attach_file.rb +87 -0
- data/lib/netsuite/actions/delete.rb +18 -1
- data/lib/netsuite/actions/delete_list.rb +1 -1
- data/lib/netsuite/actions/get.rb +1 -1
- data/lib/netsuite/actions/get_deleted.rb +1 -1
- data/lib/netsuite/actions/get_list.rb +1 -1
- data/lib/netsuite/actions/initialize.rb +2 -2
- data/lib/netsuite/actions/search.rb +20 -7
- data/lib/netsuite/configuration.rb +16 -3
- data/lib/netsuite/records/account.rb +0 -1
- data/lib/netsuite/records/accounting_period.rb +1 -1
- data/lib/netsuite/records/assembly_component.rb +0 -2
- data/lib/netsuite/records/assembly_item.rb +2 -2
- data/lib/netsuite/records/assembly_unbuild.rb +0 -1
- data/lib/netsuite/records/cash_refund.rb +0 -1
- data/lib/netsuite/records/cash_refund_item.rb +1 -1
- data/lib/netsuite/records/cash_sale.rb +1 -2
- data/lib/netsuite/records/contact.rb +0 -1
- data/lib/netsuite/records/credit_memo.rb +1 -1
- data/lib/netsuite/records/currency_rate.rb +0 -1
- data/lib/netsuite/records/custom_record.rb +1 -1
- data/lib/netsuite/records/customer.rb +224 -23
- data/lib/netsuite/records/customer_deposit.rb +0 -1
- data/lib/netsuite/records/customer_payment.rb +0 -1
- data/lib/netsuite/records/customer_refund.rb +1 -2
- data/lib/netsuite/records/deposit.rb +0 -1
- data/lib/netsuite/records/deposit_application.rb +0 -1
- data/lib/netsuite/records/description_item.rb +3 -3
- data/lib/netsuite/records/discount_item.rb +1 -1
- data/lib/netsuite/records/employee.rb +1 -1
- data/lib/netsuite/records/estimate.rb +0 -1
- data/lib/netsuite/records/file.rb +1 -1
- data/lib/netsuite/records/gift_certificate_item.rb +1 -1
- data/lib/netsuite/records/inbound_shipment.rb +0 -1
- data/lib/netsuite/records/inventory_item.rb +237 -38
- data/lib/netsuite/records/inventory_number.rb +0 -1
- data/lib/netsuite/records/invoice.rb +2 -2
- data/lib/netsuite/records/item_availability.rb +46 -0
- data/lib/netsuite/records/item_fulfillment.rb +4 -2
- data/lib/netsuite/records/item_fulfillment_package_fed_ex.rb +28 -0
- data/lib/netsuite/records/item_fulfillment_package_fed_ex_list.rb +32 -0
- data/lib/netsuite/records/item_fulfillment_package_ups.rb +27 -0
- data/lib/netsuite/records/item_fulfillment_package_ups_list.rb +32 -0
- data/lib/netsuite/records/item_fulfillment_package_usps.rb +26 -0
- data/lib/netsuite/records/item_fulfillment_package_usps_list.rb +32 -0
- data/lib/netsuite/records/item_group.rb +3 -3
- data/lib/netsuite/records/item_option_custom_field.rb +52 -0
- data/lib/netsuite/records/item_receipt.rb +0 -1
- data/lib/netsuite/records/item_vendor.rb +10 -1
- data/lib/netsuite/records/job.rb +0 -1
- data/lib/netsuite/records/kit_item.rb +2 -2
- data/lib/netsuite/records/location.rb +0 -1
- data/lib/netsuite/records/lot_numbered_assembly_item.rb +1 -1
- data/lib/netsuite/records/lot_numbered_inventory_item.rb +226 -82
- data/lib/netsuite/records/matrix_option_list.rb +16 -0
- data/lib/netsuite/records/non_inventory_purchase_item.rb +1 -1
- data/lib/netsuite/records/non_inventory_resale_item.rb +157 -21
- data/lib/netsuite/records/non_inventory_sale_item.rb +134 -22
- data/lib/netsuite/records/null_field_list.rb +15 -0
- data/lib/netsuite/records/opportunity.rb +0 -1
- data/lib/netsuite/records/other_charge_sale_item.rb +2 -2
- data/lib/netsuite/records/payment_item.rb +3 -3
- data/lib/netsuite/records/payroll_item.rb +0 -1
- data/lib/netsuite/records/purchase_order.rb +0 -1
- data/lib/netsuite/records/record_ref.rb +1 -1
- data/lib/netsuite/records/return_authorization.rb +1 -0
- data/lib/netsuite/records/sales_order.rb +2 -2
- data/lib/netsuite/records/sales_order_item.rb +2 -1
- data/lib/netsuite/records/serialized_assembly_item.rb +1 -1
- data/lib/netsuite/records/serialized_inventory_item.rb +2 -2
- data/lib/netsuite/records/serialized_inventory_item_location.rb +0 -1
- data/lib/netsuite/records/service_resale_item.rb +125 -21
- data/lib/netsuite/records/service_sale_item.rb +1 -2
- data/lib/netsuite/records/{customer_subscription.rb → subscription.rb} +1 -1
- data/lib/netsuite/records/subscriptions_list.rb +10 -0
- data/lib/netsuite/records/subsidiary.rb +0 -1
- data/lib/netsuite/records/subtotal_item.rb +3 -4
- data/lib/netsuite/records/transfer_order.rb +0 -1
- data/lib/netsuite/records/translation.rb +17 -0
- data/lib/netsuite/records/translation_list.rb +11 -0
- data/lib/netsuite/records/vendor.rb +0 -1
- data/lib/netsuite/records/vendor_bill.rb +0 -1
- data/lib/netsuite/records/work_order.rb +0 -1
- data/lib/netsuite/records/work_order_item.rb +0 -1
- data/lib/netsuite/support/actions.rb +2 -0
- data/lib/netsuite/support/fields.rb +2 -0
- data/lib/netsuite/support/records.rb +22 -5
- data/lib/netsuite/support/sublist.rb +2 -2
- data/lib/netsuite/utilities/strings.rb +15 -0
- data/lib/netsuite/utilities.rb +25 -13
- data/lib/netsuite/version.rb +1 -1
- data/lib/netsuite.rb +15 -3
- data/netsuite.gemspec +5 -2
- data/spec/netsuite/actions/add_spec.rb +39 -1
- data/spec/netsuite/actions/attach_file_spec.rb +59 -0
- data/spec/netsuite/actions/delete_spec.rb +74 -14
- data/spec/netsuite/actions/get_select_value_spec.rb +43 -0
- data/spec/netsuite/actions/search_spec.rb +205 -0
- data/spec/netsuite/configuration_spec.rb +35 -0
- data/spec/netsuite/records/cash_refund_item_spec.rb +1 -1
- data/spec/netsuite/records/credit_memo_spec.rb +14 -0
- data/spec/netsuite/records/customer_spec.rb +287 -20
- data/spec/netsuite/records/inventory_item_spec.rb +239 -22
- data/spec/netsuite/records/invoice_spec.rb +43 -0
- data/spec/netsuite/records/item_availability_spec.rb +59 -0
- data/spec/netsuite/records/item_fulfillment_package_fed_ex_list_spec.rb +27 -0
- data/spec/netsuite/records/item_fulfillment_package_ups_list_spec.rb +27 -0
- data/spec/netsuite/records/item_fulfillment_package_usps_list_spec.rb +27 -0
- data/spec/netsuite/records/item_option_custom_field_spec.rb +27 -0
- data/spec/netsuite/records/item_vendor_list_spec.rb +2 -5
- data/spec/netsuite/records/item_vendor_spec.rb +14 -2
- data/spec/netsuite/records/lot_numbered_inventory_item_spec.rb +247 -0
- data/spec/netsuite/records/matrix_option_list_spec.rb +26 -0
- data/spec/netsuite/records/non_inventory_resale_item_spec.rb +159 -24
- data/spec/netsuite/records/non_inventory_sale_item_spec.rb +135 -22
- data/spec/netsuite/records/null_field_list_spec.rb +30 -0
- data/spec/netsuite/records/return_authorization_spec.rb +62 -0
- data/spec/netsuite/records/sales_order_item_spec.rb +4 -3
- data/spec/netsuite/records/sales_order_spec.rb +46 -0
- data/spec/netsuite/records/service_resale_item_spec.rb +122 -17
- data/spec/netsuite/records/{customer_subscription_spec.rb → subscription_spec.rb} +2 -2
- data/spec/netsuite/records/{customer_subscriptions_list_spec.rb → subscriptions_list_spec.rb} +2 -2
- data/spec/netsuite/records/translation_list_spec.rb +34 -0
- data/spec/netsuite/records/translation_spec.rb +28 -0
- data/spec/netsuite/support/fields_spec.rb +16 -4
- data/spec/netsuite/support/records_spec.rb +33 -7
- data/spec/netsuite/support/search_result_spec.rb +12 -0
- data/spec/netsuite/utilities_spec.rb +10 -2
- data/spec/support/fixtures/add/add_file.xml +20 -0
- data/spec/support/fixtures/add/add_invoice.xml +9 -5
- data/spec/support/fixtures/attach/attach_file_to_sales_order.xml +16 -0
- data/spec/support/fixtures/attach/attach_file_to_sales_order_error.xml +20 -0
- data/spec/support/fixtures/delete/delete_customer_error.xml +21 -0
- data/spec/support/fixtures/delete/delete_customer_multiple_errors.xml +25 -0
- data/spec/support/fixtures/get_item_availability/get_item_availability.xml +46 -0
- data/spec/support/fixtures/get_select_value/empty_result.xml +22 -0
- data/spec/support/fixtures/get_select_value/item_fulfillment_ship_method.xml +43 -0
- data/spec/support/fixtures/search/basic_search_contact.xml +39 -0
- data/spec/support/fixtures/search/single_search_result.xml +46 -0
- metadata +78 -17
- data/lib/netsuite/core_ext/string/lower_camelcase.rb +0 -9
- data/lib/netsuite/records/customer_subscriptions_list.rb +0 -10
@@ -5,27 +5,169 @@ describe NetSuite::Records::InventoryItem do
|
|
5
5
|
|
6
6
|
it 'has all the right fields' do
|
7
7
|
[
|
8
|
-
:auto_lead_time,
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
17
|
-
:
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:
|
23
|
-
:
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:
|
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
|
+
:contingent_revenue_handling,
|
15
|
+
:conversion_rate,
|
16
|
+
:copy_description,
|
17
|
+
:cost,
|
18
|
+
:cost_estimate,
|
19
|
+
:cost_estimate_type,
|
20
|
+
:cost_estimate_units,
|
21
|
+
:costing_method,
|
22
|
+
:costing_method_display,
|
23
|
+
:cost_units,
|
24
|
+
:country_of_manufacture,
|
25
|
+
:created_date,
|
26
|
+
:currency,
|
27
|
+
:date_converted_to_inv,
|
28
|
+
:default_return_cost,
|
29
|
+
:defer_rev_rec,
|
30
|
+
:demand_modifier,
|
31
|
+
:demand_time_fence,
|
32
|
+
:direct_revenue_posting,
|
33
|
+
:display_name,
|
34
|
+
:dont_show_price,
|
35
|
+
:enable_catch_weight,
|
36
|
+
:enforce_min_qty_internally,
|
37
|
+
:exclude_from_sitemap,
|
38
|
+
:featured_description,
|
39
|
+
:fixed_lot_size,
|
40
|
+
:forward_consumption_days,
|
41
|
+
:fraud_risk,
|
42
|
+
:future_horizon,
|
43
|
+
:handling_cost,
|
44
|
+
:handling_cost_units,
|
45
|
+
:hazmat_hazard_class,
|
46
|
+
:hazmat_id,
|
47
|
+
:hazmat_item_units,
|
48
|
+
:hazmat_item_units_qty,
|
49
|
+
:hazmat_packing_group,
|
50
|
+
:hazmat_shipping_name,
|
51
|
+
:include_children,
|
52
|
+
:invt_classification,
|
53
|
+
:invt_count_interval,
|
54
|
+
:is_donation_item,
|
55
|
+
:is_drop_ship_item,
|
56
|
+
:is_gco_compliant,
|
57
|
+
:is_hazmat_item,
|
58
|
+
:is_inactive,
|
59
|
+
:is_online,
|
60
|
+
:is_special_order_item,
|
61
|
+
:is_store_pickup_allowed,
|
62
|
+
:is_taxable,
|
63
|
+
:item_carrier,
|
64
|
+
:item_id,
|
65
|
+
:last_invt_count_date,
|
66
|
+
:last_modified_date,
|
67
|
+
:last_purchase_price,
|
68
|
+
:lead_time,
|
69
|
+
:lower_warning_limit,
|
70
|
+
:manufacturer,
|
71
|
+
:manufacturer_addr1,
|
72
|
+
:manufacturer_city,
|
73
|
+
:manufacturer_state,
|
74
|
+
:manufacturer_tariff,
|
75
|
+
:manufacturer_tax_id,
|
76
|
+
:manufacturer_zip,
|
77
|
+
:match_bill_to_receipt,
|
78
|
+
:matrix_item_name_template,
|
79
|
+
:matrix_type,
|
80
|
+
:max_donation_amount,
|
81
|
+
:maximum_quantity,
|
82
|
+
:meta_tag_html,
|
83
|
+
:minimum_quantity,
|
84
|
+
:minimum_quantity_units,
|
85
|
+
:mpn,
|
86
|
+
:mult_manufacture_addr,
|
87
|
+
:nex_tag_category,
|
88
|
+
:next_invt_count_date,
|
89
|
+
:no_price_message,
|
90
|
+
:offer_support,
|
91
|
+
:on_hand_value_mli,
|
92
|
+
:on_special,
|
93
|
+
:original_item_subtype,
|
94
|
+
:original_item_type,
|
95
|
+
:out_of_stock_behavior,
|
96
|
+
:out_of_stock_message,
|
97
|
+
:overall_quantity_pricing_type,
|
98
|
+
:page_title,
|
99
|
+
:periodic_lot_size_days,
|
100
|
+
:periodic_lot_size_type,
|
101
|
+
:preference_criterion,
|
102
|
+
:preferred_stock_level,
|
103
|
+
:preferred_stock_level_days,
|
104
|
+
:preferred_stock_level_units,
|
105
|
+
:prices_include_tax,
|
106
|
+
:producer,
|
107
|
+
:purchase_description,
|
108
|
+
:purchase_order_amount,
|
109
|
+
:purchase_order_quantity,
|
110
|
+
:purchase_order_quantity_diff,
|
111
|
+
:quantity_available,
|
112
|
+
:quantity_available_units,
|
113
|
+
:quantity_back_ordered,
|
114
|
+
:quantity_committed,
|
115
|
+
:quantity_committed_units,
|
116
|
+
:quantity_on_hand,
|
117
|
+
:quantity_on_hand_units,
|
118
|
+
:quantity_on_order,
|
119
|
+
:quantity_on_order_units,
|
120
|
+
:quantity_reorder_units,
|
121
|
+
:rate,
|
122
|
+
:receipt_amount,
|
123
|
+
:receipt_quantity,
|
124
|
+
:receipt_quantity_diff,
|
125
|
+
:related_items_description,
|
126
|
+
:reorder_multiple,
|
127
|
+
:reorder_point,
|
128
|
+
:reorder_point_units,
|
129
|
+
:reschedule_in_days,
|
130
|
+
:reschedule_out_days,
|
131
|
+
:round_up_as_component,
|
132
|
+
:safety_stock_level,
|
133
|
+
:safety_stock_level_days,
|
134
|
+
:safety_stock_level_units,
|
135
|
+
:sales_description,
|
136
|
+
:schedule_b_code,
|
137
|
+
:schedule_b_number,
|
138
|
+
:schedule_b_quantity,
|
139
|
+
:search_keywords,
|
140
|
+
:seasonal_demand,
|
141
|
+
:ship_individually,
|
142
|
+
:shipping_cost,
|
143
|
+
:shipping_cost_units,
|
144
|
+
:shopping_dot_com_category,
|
145
|
+
:shopzilla_category_id,
|
146
|
+
:show_default_donation_amount,
|
147
|
+
:sitemap_priority,
|
148
|
+
:specials_description,
|
149
|
+
:stock_description,
|
150
|
+
:store_description,
|
151
|
+
:store_detailed_description,
|
152
|
+
:store_display_name,
|
153
|
+
:supply_time_fence,
|
154
|
+
:total_value,
|
155
|
+
:track_landed_cost,
|
156
|
+
:transfer_price,
|
157
|
+
:upc_code,
|
158
|
+
:upper_warning_limit,
|
159
|
+
:url_component,
|
160
|
+
:use_bins,
|
161
|
+
:use_marginal_rates,
|
162
|
+
:vendor_name,
|
163
|
+
:vsoe_deferral,
|
164
|
+
:vsoe_delivered,
|
165
|
+
:vsoe_permit_discount,
|
166
|
+
:vsoe_price,
|
167
|
+
:vsoe_sop_group,
|
168
|
+
:weight,
|
169
|
+
:weight_unit,
|
170
|
+
:weight_units,
|
29
171
|
].each do |field|
|
30
172
|
expect(item).to have_field(field)
|
31
173
|
end
|
@@ -95,9 +237,84 @@ describe NetSuite::Records::InventoryItem do
|
|
95
237
|
end
|
96
238
|
end
|
97
239
|
|
240
|
+
it 'has all the right fields with specific classes' do
|
241
|
+
{
|
242
|
+
bin_number_list: NetSuite::Records::BinNumberList,
|
243
|
+
custom_field_list: NetSuite::Records::CustomFieldList,
|
244
|
+
item_ship_method_list: NetSuite::Records::RecordRefList,
|
245
|
+
item_vendor_list: NetSuite::Records::ItemVendorList,
|
246
|
+
locations_list: NetSuite::Records::LocationsList,
|
247
|
+
matrix_option_list: NetSuite::Records::MatrixOptionList,
|
248
|
+
pricing_matrix: NetSuite::Records::PricingMatrix,
|
249
|
+
subsidiary_list: NetSuite::Records::RecordRefList,
|
250
|
+
}.each do |field, klass|
|
251
|
+
expect(item).to have_field(field, klass)
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
98
255
|
it 'has all the right record refs' do
|
99
256
|
[
|
100
|
-
:alternate_demand_source_item,
|
257
|
+
:alternate_demand_source_item,
|
258
|
+
:asset_account,
|
259
|
+
:bill_exch_rate_variance_acct,
|
260
|
+
:billing_schedule,
|
261
|
+
:bill_price_variance_acct,
|
262
|
+
:bill_qty_variance_acct,
|
263
|
+
:klass,
|
264
|
+
:cogs_account,
|
265
|
+
:consumption_unit,
|
266
|
+
:cost_category,
|
267
|
+
:create_revenue_plans_on,
|
268
|
+
:custom_form,
|
269
|
+
:default_item_ship_method,
|
270
|
+
:deferred_revenue_account,
|
271
|
+
:demand_source,
|
272
|
+
:department,
|
273
|
+
:distribution_category,
|
274
|
+
:distribution_network,
|
275
|
+
:dropship_expense_account,
|
276
|
+
:expense_account,
|
277
|
+
:gain_loss_account,
|
278
|
+
:income_account,
|
279
|
+
:interco_cogs_account,
|
280
|
+
:interco_def_rev_account,
|
281
|
+
:interco_income_account,
|
282
|
+
:issue_product,
|
283
|
+
:item_revenue_category,
|
284
|
+
:location,
|
285
|
+
:parent,
|
286
|
+
:planning_item_category,
|
287
|
+
:preferred_location,
|
288
|
+
:pricing_group,
|
289
|
+
:purchase_price_variance_acct,
|
290
|
+
:purchase_tax_code,
|
291
|
+
:purchase_unit,
|
292
|
+
:quantity_pricing_schedule,
|
293
|
+
:revenue_allocation_group,
|
294
|
+
:revenue_recognition_rule,
|
295
|
+
:rev_rec_forecast_rule,
|
296
|
+
:rev_reclass_f_x_account,
|
297
|
+
:rev_rec_schedule,
|
298
|
+
:sales_tax_code,
|
299
|
+
:sale_unit,
|
300
|
+
:secondary_base_unit,
|
301
|
+
:secondary_consumption_unit,
|
302
|
+
:secondary_purchase_unit,
|
303
|
+
:secondary_sale_unit,
|
304
|
+
:secondary_stock_unit,
|
305
|
+
:secondary_units_type,
|
306
|
+
:ship_package,
|
307
|
+
:soft_descriptor,
|
308
|
+
:stock_unit,
|
309
|
+
:store_display_image,
|
310
|
+
:store_display_thumbnail,
|
311
|
+
:store_item_template,
|
312
|
+
:supply_lot_sizing_method,
|
313
|
+
:supply_replenishment_method,
|
314
|
+
:supply_type,
|
315
|
+
:tax_schedule,
|
316
|
+
:units_type,
|
317
|
+
:vendor,
|
101
318
|
].each do |record_ref|
|
102
319
|
expect(item).to have_record_ref(record_ref)
|
103
320
|
end
|
@@ -32,6 +32,20 @@ describe NetSuite::Records::Invoice do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
it 'has all the right fields with specific classes' do
|
36
|
+
{
|
37
|
+
transaction_bill_address: NetSuite::Records::BillAddress,
|
38
|
+
transaction_ship_address: NetSuite::Records::ShipAddress,
|
39
|
+
item_list: NetSuite::Records::InvoiceItemList,
|
40
|
+
custom_field_list: NetSuite::Records::CustomFieldList,
|
41
|
+
shipping_address: NetSuite::Records::Address,
|
42
|
+
billing_address: NetSuite::Records::Address,
|
43
|
+
null_field_list: NetSuite::Records::NullFieldList,
|
44
|
+
}.each do |field, klass|
|
45
|
+
expect(invoice).to have_field(field, klass)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
35
49
|
it 'has all the right read_only_fields' do
|
36
50
|
[
|
37
51
|
:sub_total, :discount_total, :total, :alt_handling_cost, :alt_shipping_cost, :gift_cert_applied,
|
@@ -392,6 +406,35 @@ describe NetSuite::Records::Invoice do
|
|
392
406
|
end
|
393
407
|
end
|
394
408
|
|
409
|
+
describe '#attach_file' do
|
410
|
+
let(:test_data) { { :email => 'test@example.com', :fax => '1234567890' } }
|
411
|
+
let(:file) { double('file') }
|
412
|
+
|
413
|
+
context 'when the response is successful' do
|
414
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
415
|
+
|
416
|
+
it 'returns true' do
|
417
|
+
invoice = NetSuite::Records::Invoice.new(test_data)
|
418
|
+
expect(NetSuite::Actions::AttachFile).to receive(:call).
|
419
|
+
with([invoice, file], {}).
|
420
|
+
and_return(response)
|
421
|
+
expect(invoice.attach_file(file)).to be_truthy
|
422
|
+
end
|
423
|
+
end
|
424
|
+
|
425
|
+
context 'when the response is unsuccessful' do
|
426
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
427
|
+
|
428
|
+
it 'returns false' do
|
429
|
+
invoice = NetSuite::Records::Invoice.new(test_data)
|
430
|
+
expect(NetSuite::Actions::AttachFile).to receive(:call).
|
431
|
+
with([invoice, file], {}).
|
432
|
+
and_return(response)
|
433
|
+
expect(invoice.attach_file(file)).to be_falsey
|
434
|
+
end
|
435
|
+
end
|
436
|
+
end
|
437
|
+
|
395
438
|
describe '#delete' do
|
396
439
|
context 'when the response is successful' do
|
397
440
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NetSuite::Records::ItemAvailability do
|
4
|
+
before(:all) { savon.mock! }
|
5
|
+
after(:all) { savon.unmock! }
|
6
|
+
|
7
|
+
let(:item_availability) { NetSuite::Records::ItemAvailability.new }
|
8
|
+
|
9
|
+
it 'has all the right fields' do
|
10
|
+
[
|
11
|
+
:quantity_on_hand,
|
12
|
+
:on_hand_value_mli,
|
13
|
+
:reorder_point,
|
14
|
+
:quantity_on_order,
|
15
|
+
:quantity_committed,
|
16
|
+
:quantity_available,
|
17
|
+
].each do |field|
|
18
|
+
expect(item_availability).to have_field(field)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
it { expect(item_availability).to have_field(:item, NetSuite::Records::InventoryItem) }
|
23
|
+
it { expect(item_availability).to have_field(:location_id, NetSuite::Records::Location) }
|
24
|
+
|
25
|
+
describe 'get_item_availability' do
|
26
|
+
let(:inventory_item_ref_list) {
|
27
|
+
NetSuite::Records::RecordRefList.new(
|
28
|
+
record_ref: [
|
29
|
+
NetSuite::Records::RecordRef.new(internal_id: 57)
|
30
|
+
]
|
31
|
+
)
|
32
|
+
}
|
33
|
+
let(:result) { NetSuite::Records::ItemAvailability.get_item_availability(inventory_item_ref_list) }
|
34
|
+
|
35
|
+
before do
|
36
|
+
savon.expects(:get_item_availability).with(:message => {
|
37
|
+
"platformMsgs:itemAvailabilityFilter" => {
|
38
|
+
"platformCore:item"=>{"platformCore:recordRef"=>[{:@internalId=>57}]}
|
39
|
+
}
|
40
|
+
}).returns(File.read('spec/support/fixtures/get_item_availability/get_item_availability.xml'))
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'returns ItemAvailability records' do
|
44
|
+
expect(result).to be_kind_of(Array)
|
45
|
+
expect(result).not_to be_empty
|
46
|
+
expect(result[0]).to be_kind_of(NetSuite::Records::ItemAvailability)
|
47
|
+
expect(result[0]).to have_attributes(
|
48
|
+
item: be_kind_of(NetSuite::Records::InventoryItem),
|
49
|
+
location_id: NetSuite::Records::Location,
|
50
|
+
quantity_on_hand: '264.0',
|
51
|
+
on_hand_value_mli: '129.36',
|
52
|
+
reorder_point: '50.0',
|
53
|
+
quantity_on_order: '0.0',
|
54
|
+
quantity_committed: '0.0',
|
55
|
+
quantity_available: '264.0',
|
56
|
+
)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NetSuite::Records::ItemFulfillmentPackageFedExList do
|
4
|
+
let(:list) { NetSuite::Records::ItemFulfillmentPackageFedExList.new }
|
5
|
+
|
6
|
+
it 'has a packages attribute' do
|
7
|
+
expect(list.packages).to be_kind_of(Array)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#to_record' do
|
11
|
+
before do
|
12
|
+
list.packages << NetSuite::Records::ItemFulfillmentPackageFedEx.new(
|
13
|
+
:package_tracking_number_fed_ex => '1Z12354645757686786'
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'can represent itself as a SOAP record' do
|
18
|
+
record = {
|
19
|
+
'tranSales:packageFedEx' => [
|
20
|
+
'tranSales:packageTrackingNumberFedEx' => '1Z12354645757686786'
|
21
|
+
]
|
22
|
+
}
|
23
|
+
|
24
|
+
expect(list.to_record).to eql(record)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NetSuite::Records::ItemFulfillmentPackageUpsList do
|
4
|
+
let(:list) { NetSuite::Records::ItemFulfillmentPackageUpsList.new }
|
5
|
+
|
6
|
+
it 'has a packages attribute' do
|
7
|
+
expect(list.packages).to be_kind_of(Array)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#to_record' do
|
11
|
+
before do
|
12
|
+
list.packages << NetSuite::Records::ItemFulfillmentPackageUps.new(
|
13
|
+
:package_tracking_number_ups => '1Z12354645757686786'
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'can represent itself as a SOAP record' do
|
18
|
+
record = {
|
19
|
+
'tranSales:packageUps' => [
|
20
|
+
'tranSales:packageTrackingNumberUps' => '1Z12354645757686786'
|
21
|
+
]
|
22
|
+
}
|
23
|
+
|
24
|
+
expect(list.to_record).to eql(record)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NetSuite::Records::ItemFulfillmentPackageUspsList do
|
4
|
+
let(:list) { NetSuite::Records::ItemFulfillmentPackageUspsList.new }
|
5
|
+
|
6
|
+
it 'has a packages attribute' do
|
7
|
+
expect(list.packages).to be_kind_of(Array)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#to_record' do
|
11
|
+
before do
|
12
|
+
list.packages << NetSuite::Records::ItemFulfillmentPackageUsps.new(
|
13
|
+
:package_tracking_number_usps => '1Z12354645757686786'
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'can represent itself as a SOAP record' do
|
18
|
+
record = {
|
19
|
+
'tranSales:packageUsps' => [
|
20
|
+
'tranSales:packageTrackingNumberUsps' => '1Z12354645757686786'
|
21
|
+
]
|
22
|
+
}
|
23
|
+
|
24
|
+
expect(list.to_record).to eql(record)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NetSuite::Records::ItemOptionCustomField do
|
4
|
+
|
5
|
+
describe ".get" do
|
6
|
+
let(:response) do
|
7
|
+
NetSuite::Response.new(
|
8
|
+
success: true,
|
9
|
+
body: {
|
10
|
+
label: "Value of Label",
|
11
|
+
}
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "returns a ItemOptionCustomField instance with populated fields" do
|
16
|
+
expect(NetSuite::Actions::Get)
|
17
|
+
.to receive(:call)
|
18
|
+
.with([NetSuite::Records::ItemOptionCustomField, internal_id: 1], {})
|
19
|
+
.and_return(response)
|
20
|
+
|
21
|
+
record = NetSuite::Records::ItemOptionCustomField.get(internal_id: 1)
|
22
|
+
|
23
|
+
expect(record.label).to eql("Value of Label")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -10,17 +10,14 @@ describe NetSuite::Records::ItemVendorList do
|
|
10
10
|
describe '#to_record' do
|
11
11
|
before do
|
12
12
|
list.item_vendors << NetSuite::Records::ItemVendor.new(
|
13
|
-
:
|
13
|
+
:vendor_code => 'Spring Water',
|
14
14
|
)
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'can represent itself as a SOAP record' do
|
18
18
|
record = {
|
19
19
|
"listAcct:itemVendor"=>[
|
20
|
-
{"listAcct:
|
21
|
-
:name=>"Spring Water"
|
22
|
-
}
|
23
|
-
}
|
20
|
+
{"listAcct:vendorCode"=>"Spring Water"}
|
24
21
|
]
|
25
22
|
}
|
26
23
|
|
@@ -5,11 +5,23 @@ describe NetSuite::Records::ItemVendor do
|
|
5
5
|
|
6
6
|
it 'has all the right fields' do
|
7
7
|
[
|
8
|
-
:
|
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
|