netsuite 0.8.12 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/codeql-analysis.yml +3 -3
  3. data/Gemfile +7 -0
  4. data/HISTORY.md +24 -0
  5. data/README.md +26 -0
  6. data/lib/netsuite/actions/add.rb +2 -1
  7. data/lib/netsuite/actions/delete.rb +17 -0
  8. data/lib/netsuite/configuration.rb +37 -4
  9. data/lib/netsuite/records/assembly_item.rb +2 -1
  10. data/lib/netsuite/records/customer.rb +225 -23
  11. data/lib/netsuite/records/customer_refund.rb +1 -1
  12. data/lib/netsuite/records/description_item.rb +1 -1
  13. data/lib/netsuite/records/discount_item.rb +1 -1
  14. data/lib/netsuite/records/file.rb +1 -1
  15. data/lib/netsuite/records/gift_certificate_item.rb +1 -1
  16. data/lib/netsuite/records/item_availability.rb +46 -0
  17. data/lib/netsuite/records/item_fulfillment.rb +4 -1
  18. data/lib/netsuite/records/item_fulfillment_package_fed_ex.rb +28 -0
  19. data/lib/netsuite/records/item_fulfillment_package_fed_ex_list.rb +32 -0
  20. data/lib/netsuite/records/item_fulfillment_package_ups.rb +27 -0
  21. data/lib/netsuite/records/item_fulfillment_package_ups_list.rb +32 -0
  22. data/lib/netsuite/records/item_fulfillment_package_usps.rb +26 -0
  23. data/lib/netsuite/records/item_fulfillment_package_usps_list.rb +32 -0
  24. data/lib/netsuite/records/item_group.rb +1 -1
  25. data/lib/netsuite/records/kit_item.rb +1 -1
  26. data/lib/netsuite/records/lot_numbered_assembly_item.rb +1 -1
  27. data/lib/netsuite/records/non_inventory_purchase_item.rb +1 -1
  28. data/lib/netsuite/records/non_inventory_resale_item.rb +1 -1
  29. data/lib/netsuite/records/non_inventory_sale_item.rb +1 -1
  30. data/lib/netsuite/records/other_charge_sale_item.rb +1 -1
  31. data/lib/netsuite/records/payment_item.rb +1 -1
  32. data/lib/netsuite/records/sales_order.rb +1 -0
  33. data/lib/netsuite/records/sales_order_item.rb +2 -1
  34. data/lib/netsuite/records/serialized_assembly_item.rb +1 -1
  35. data/lib/netsuite/records/serialized_inventory_item.rb +1 -1
  36. data/lib/netsuite/records/service_resale_item.rb +1 -1
  37. data/lib/netsuite/records/service_sale_item.rb +1 -1
  38. data/lib/netsuite/records/{customer_subscription.rb → subscription.rb} +1 -1
  39. data/lib/netsuite/records/subscriptions_list.rb +10 -0
  40. data/lib/netsuite/records/subtotal_item.rb +1 -1
  41. data/lib/netsuite/support/sublist.rb +1 -1
  42. data/lib/netsuite/utilities.rb +35 -13
  43. data/lib/netsuite/version.rb +1 -1
  44. data/lib/netsuite.rb +9 -2
  45. data/netsuite.gemspec +6 -3
  46. data/spec/netsuite/actions/add_spec.rb +4 -2
  47. data/spec/netsuite/actions/delete_spec.rb +74 -14
  48. data/spec/netsuite/actions/get_select_value_spec.rb +43 -0
  49. data/spec/netsuite/configuration_spec.rb +62 -3
  50. data/spec/netsuite/records/customer_spec.rb +287 -20
  51. data/spec/netsuite/records/item_availability_spec.rb +59 -0
  52. data/spec/netsuite/records/item_fulfillment_package_fed_ex_list_spec.rb +27 -0
  53. data/spec/netsuite/records/item_fulfillment_package_ups_list_spec.rb +27 -0
  54. data/spec/netsuite/records/item_fulfillment_package_usps_list_spec.rb +27 -0
  55. data/spec/netsuite/records/sales_order_item_spec.rb +4 -3
  56. data/spec/netsuite/records/sales_order_spec.rb +17 -0
  57. data/spec/netsuite/records/{customer_subscription_spec.rb → subscription_spec.rb} +2 -2
  58. data/spec/netsuite/records/{customer_subscriptions_list_spec.rb → subscriptions_list_spec.rb} +2 -2
  59. data/spec/support/fixtures/add/add_invoice.xml +9 -5
  60. data/spec/support/fixtures/delete/delete_customer_error.xml +21 -0
  61. data/spec/support/fixtures/delete/delete_customer_multiple_errors.xml +25 -0
  62. data/spec/support/fixtures/get_item_availability/get_item_availability.xml +46 -0
  63. data/spec/support/fixtures/get_select_value/empty_result.xml +22 -0
  64. data/spec/support/fixtures/get_select_value/item_fulfillment_ship_method.xml +43 -0
  65. metadata +46 -9
  66. data/lib/netsuite/records/customer_subscriptions_list.rb +0 -10
@@ -0,0 +1,43 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Actions::GetSelectValue do
4
+ before(:all) { savon.mock! }
5
+ after(:all) { savon.unmock! }
6
+
7
+ describe 'fulfillment ship method' do
8
+ subject do
9
+ NetSuite::Records::BaseRefList.get_select_value(recordType: 'itemFulfillment', field: 'shipMethod')
10
+ end
11
+
12
+ let(:response) { File.read('spec/support/fixtures/get_select_value/item_fulfillment_ship_method.xml') }
13
+
14
+ before do
15
+ savon.expects(:get_select_value).with(:message => {
16
+ pageIndex: 1,
17
+ fieldDescription: {
18
+ 'platformCore:recordType' => 'itemFulfillment',
19
+ 'platformCore:field' => 'shipMethod'
20
+ }
21
+ }).returns(response)
22
+ end
23
+
24
+ it 'makes a valid request to the NetSuite API' do
25
+ subject
26
+ end
27
+
28
+ it 'returns a BaseRefList object' do
29
+ expect(subject).to be_kind_of(NetSuite::Records::BaseRefList)
30
+ expect(subject.base_refs[0].internal_id).to eq('94')
31
+ expect(subject.base_refs[0].name).to eq('Ground (Custom)')
32
+ end
33
+
34
+ context 'with empty result' do
35
+ let(:response) { File.read('spec/support/fixtures/get_select_value/empty_result.xml') }
36
+
37
+ it 'returns an empty list' do
38
+ expect(subject).to be_kind_of(NetSuite::Records::BaseRefList)
39
+ expect(subject.base_refs).to be_empty
40
+ end
41
+ end
42
+ end
43
+ end
@@ -14,6 +14,44 @@ describe NetSuite::Configuration do
14
14
  config.reset!
15
15
  expect(config.attributes).to be_empty
16
16
  end
17
+
18
+ it 'treats attributes as shared/global in default single tenant mode' do
19
+ config.attributes[:blah] = 'something'
20
+ expect(config.attributes[:blah]).to eq('something')
21
+
22
+ thread = Thread.new {
23
+ expect(config.attributes[:blah]).to eq('something')
24
+
25
+ config.attributes[:blah] = 'something_else'
26
+ expect(config.attributes[:blah]).to eq('something_else')
27
+ }
28
+
29
+ thread.join
30
+
31
+ expect(config.attributes[:blah]).to eq('something_else')
32
+ end
33
+
34
+ it 'treats attributes as thread-local in multi-tenant mode, which each thread starting with empty attributes' do
35
+ begin
36
+ config.multi_tenant!
37
+
38
+ config.attributes[:blah] = 'something'
39
+ expect(config.attributes[:blah]).to eq('something')
40
+
41
+ thread = Thread.new {
42
+ expect(config.attributes[:blah]).to be_nil
43
+
44
+ config.attributes[:blah] = 'something_else'
45
+ expect(config.attributes[:blah]).to eq('something_else')
46
+ }
47
+
48
+ thread.join
49
+
50
+ expect(config.attributes[:blah]).to eq('something')
51
+ ensure
52
+ config.instance_variable_set(:@multi_tenant, false)
53
+ end
54
+ end
17
55
  end
18
56
 
19
57
  describe '#filters' do
@@ -87,7 +125,7 @@ describe NetSuite::Configuration do
87
125
 
88
126
  context 'when the wsdl has not been set' do
89
127
  it 'returns a path to the WSDL to use for the API' do
90
- expect(config.wsdl).to eq("https://webservices.netsuite.com/wsdl/v2015_1_0/netsuite.wsdl")
128
+ expect(config.wsdl).to eq("https://webservices.netsuite.com/wsdl/v2016_2_0/netsuite.wsdl")
91
129
  end
92
130
  end
93
131
 
@@ -337,8 +375,8 @@ describe NetSuite::Configuration do
337
375
 
338
376
  describe '#api_version' do
339
377
  context 'when no api_version is defined' do
340
- it 'defaults to 2015_1' do
341
- expect(config.api_version).to eq('2015_1')
378
+ it 'defaults to 2016_2' do
379
+ expect(config.api_version).to eq('2016_2')
342
380
  end
343
381
  end
344
382
  end
@@ -476,4 +514,25 @@ describe NetSuite::Configuration do
476
514
  end
477
515
  end
478
516
 
517
+ describe '#proxy' do
518
+ it 'defaults to nil' do
519
+ expect(config.proxy).to be_nil
520
+ end
521
+
522
+ it 'can be set with proxy=' do
523
+ config.proxy = "https://my-proxy"
524
+
525
+ expect(config.proxy).to eql("https://my-proxy")
526
+
527
+ # ensure no exception is raised
528
+ config.connection
529
+ end
530
+
531
+ it 'can be set with proxy(value)' do
532
+ config.proxy("https://my-proxy")
533
+
534
+ expect(config.proxy).to eql("https://my-proxy")
535
+ end
536
+ end
537
+
479
538
  end
@@ -5,30 +5,268 @@ describe NetSuite::Records::Customer do
5
5
 
6
6
  it 'has all the right fields' do
7
7
  [
8
- :account_number, :aging, :alt_email, :alt_name, :alt_phone, :balance, :bill_pay,
9
- :buying_reason, :buying_time_frame, :campaign_category, :click_stream, :comments, :company_name,
10
- :consol_aging, :consol_balance, :consol_days_overdue, :consol_deposit_balance, :consol_overdue_balance,
11
- :consol_unbilled_orders, :contrib_pct, :credit_hold_override, :credit_limit,
12
- :date_created, :days_overdue, :default_address,
13
- :deposit_balance, :download_list, :email, :email_preference, :email_transactions, :end_date, :entity_id,
14
- :estimated_budget, :fax, :fax_transactions, :first_name, :first_visit, :give_access, :global_subscription_status,
15
- :group_pricing_list, :home_phone, :image, :is_budget_approved, :is_inactive, :is_person, :item_pricing_list, :keywords,
16
- :language, :last_modified_date, :last_name, :last_page_visited, :last_visit, :middle_name, :mobile_phone,
17
- :opening_balance, :opening_balance_account, :opening_balance_date, :overdue_balance,
18
- :password, :password2, :phone, :phonetic_name, :pref_cc_processor,:print_on_check_as,
19
- :print_transactions, :referrer, :reminder_days, :representing_subsidiary, :require_pwd_change, :resale_number,
20
- :sales_group, :sales_readiness, :salutation, :send_email, :ship_complete,
21
- :stage, :start_date, :sync_partner_teams, :tax_exempt, :taxable,
22
- :third_party_acct, :third_party_country, :third_party_zipcode, :title, :unbilled_orders, :url,
23
- :vat_reg_number, :visits, :web_lead
8
+ :account_number,
9
+ :aging,
10
+ :aging1,
11
+ :aging2,
12
+ :aging3,
13
+ :aging4,
14
+ :alcohol_recipient_type,
15
+ :alt_email,
16
+ :alt_name,
17
+ :alt_phone,
18
+ :bill_pay,
19
+ :click_stream,
20
+ :comments,
21
+ :company_name,
22
+ :consol_aging,
23
+ :consol_aging1,
24
+ :consol_aging2,
25
+ :consol_aging3,
26
+ :consol_aging4,
27
+ :consol_days_overdue,
28
+ :contrib_pct,
29
+ :credit_hold_override,
30
+ :credit_limit,
31
+ :date_created,
32
+ :days_overdue,
33
+ :default_address,
34
+ :default_order_priority,
35
+ :display_symbol,
36
+ :email,
37
+ :email_preference,
38
+ :email_transactions,
39
+ :end_date,
40
+ :entity_id,
41
+ :estimated_budget,
42
+ :fax,
43
+ :fax_transactions,
44
+ :first_name,
45
+ :first_visit,
46
+ :give_access,
47
+ :global_subscription_status,
48
+ :home_phone,
49
+ :is_budget_approved,
50
+ :is_inactive,
51
+ :is_person,
52
+ :keywords,
53
+ :language,
54
+ :last_modified_date,
55
+ :last_name,
56
+ :last_page_visited,
57
+ :last_visit,
58
+ :middle_name,
59
+ :mobile_phone,
60
+ :monthly_closing,
61
+ :negative_number_format,
62
+ :number_format,
63
+ :opening_balance,
64
+ :opening_balance_date,
65
+ :override_currency_format,
66
+ :password,
67
+ :password2,
68
+ :phone,
69
+ :phonetic_name,
70
+ :print_on_check_as,
71
+ :print_transactions,
72
+ :referrer,
73
+ :reminder_days,
74
+ :require_pwd_change,
75
+ :resale_number,
76
+ :salutation,
77
+ :send_email,
78
+ :ship_complete,
79
+ :stage,
80
+ :start_date,
81
+ :symbol_placement,
82
+ :sync_partner_teams,
83
+ :taxable,
84
+ :tax_exempt,
85
+ :third_party_acct,
86
+ :third_party_country,
87
+ :third_party_zipcode,
88
+ :title,
89
+ :url,
90
+ :vat_reg_number,
91
+ :visits,
92
+ :web_lead,
24
93
  ].each do |field|
25
94
  expect(customer).to have_field(field)
26
95
  end
27
96
  end
28
97
 
98
+ it 'has all the right fields with specific classes' do
99
+ {
100
+ addressbook_list: NetSuite::Records::CustomerAddressbookList,
101
+ contact_roles_list: NetSuite::Records::ContactAccessRolesList,
102
+ credit_cards_list: NetSuite::Records::CustomerCreditCardsList,
103
+ currency_list: NetSuite::Records::CustomerCurrencyList,
104
+ custom_field_list: NetSuite::Records::CustomFieldList,
105
+ # download_list: NetSuite::Records::CustomerDownloadList, # TODO Implement me
106
+ # group_pricing_list: NetSuite::Records::CustomerGroupPricingList, # TODO: Implement me
107
+ # item_pricing_list: NetSuite::Records::CustomerItemPricingList, # TODO: Implement me
108
+ partners_list: NetSuite::Records::CustomerPartnersList,
109
+ sales_team_list: NetSuite::Records::CustomerSalesTeamList,
110
+ subscriptions_list: NetSuite::Records::SubscriptionsList,
111
+ # tax_registration_list: NetSuite::Records::CustomerTaxRegistrationList, # TODO: Implement me
112
+ }.each do |field, klass|
113
+ expect(customer).to have_field(field, klass)
114
+ end
115
+ end
116
+
117
+ it 'has all the right read_only_fields' do
118
+ [
119
+ :balance,
120
+ :consol_balance,
121
+ :deposit_balance,
122
+ :consol_deposit_balance,
123
+ :overdue_balance,
124
+ :consol_overdue_balance,
125
+ :unbilled_orders,
126
+ :consol_unbilled_orders,
127
+ ].each do |field|
128
+ expect(NetSuite::Records::Customer).to have_read_only_field(field)
129
+ end
130
+ end
131
+
132
+ it 'has all the right search_only_fields' do
133
+ [
134
+ :address,
135
+ :address1,
136
+ :address2,
137
+ :address3,
138
+ :addressee,
139
+ :address_internal_id,
140
+ :address_label,
141
+ :address_phone,
142
+ :alt_contact,
143
+ :assigned_site,
144
+ :assigned_site_id,
145
+ :attention,
146
+ :available_offline,
147
+ :bill_address,
148
+ :bill_address1,
149
+ :bill_address2,
150
+ :bill_address3,
151
+ :bill_addressee,
152
+ :bill_attention,
153
+ :bill_city,
154
+ :bill_country,
155
+ :bill_country_code,
156
+ :bill_phone,
157
+ :bill_state,
158
+ :bill_zip_code,
159
+ :cc_customer_code,
160
+ :cc_default,
161
+ :cc_exp_date,
162
+ :cc_holder_name,
163
+ :cc_internal_id,
164
+ :cc_number,
165
+ :cc_state,
166
+ :cc_state_from,
167
+ :cc_type,
168
+ :city,
169
+ :contact,
170
+ :contribution,
171
+ :contribution_primary,
172
+ :conversion_date,
173
+ :country,
174
+ :country_code,
175
+ :credit_hold,
176
+ :date_closed,
177
+ :entity_number,
178
+ :explicit_conversion,
179
+ :first_order_date,
180
+ :first_sale_date,
181
+ :fx_balance,
182
+ :fx_consol_balance,
183
+ :fx_consol_unbilled_orders,
184
+ :fx_unbilled_orders,
185
+ :group_pricing_level,
186
+ :has_duplicates,
187
+ :is_default_billing,
188
+ :is_default_shipping,
189
+ :is_ship_address,
190
+ :item_pricing_level,
191
+ :item_pricing_unit_price,
192
+ :job_end_date,
193
+ :job_projected_end,
194
+ :job_start_date,
195
+ :job_type,
196
+ :last_order_date,
197
+ :last_sale_date,
198
+ :lead_date,
199
+ :level,
200
+ :manual_credit_hold,
201
+ :on_credit_hold,
202
+ :partner_contribution,
203
+ :partner_role,
204
+ :partner_team_member,
205
+ :pec,
206
+ :permission,
207
+ :pricing_group,
208
+ :pricing_item,
209
+ :prospect_date,
210
+ :role,
211
+ :sales_team_member,
212
+ :sales_team_role,
213
+ :ship_address,
214
+ :ship_address1,
215
+ :ship_address2,
216
+ :ship_address3,
217
+ :ship_addressee,
218
+ :ship_attention,
219
+ :ship_city,
220
+ :ship_country,
221
+ :ship_country_code,
222
+ :ship_phone,
223
+ :ship_state,
224
+ :ship_zip,
225
+ :source_site,
226
+ :source_site_id,
227
+ :state,
228
+ :subscription,
229
+ :subscription_date,
230
+ :subscription_status,
231
+ :zip_code,
232
+ ].each do |field|
233
+ expect(NetSuite::Records::Customer).to have_search_only_field(field)
234
+ end
235
+ end
236
+
29
237
  it 'has the right record_refs' do
30
238
  [
31
- :access_role, :currency, :custom_form, :entity_status, :partner, :sales_rep, :terms, :parent, :territory, :shipping_item, :tax_item
239
+ :access_role,
240
+ :assigned_web_site,
241
+ :buying_reason,
242
+ :buying_time_frame,
243
+ :campaign_category,
244
+ :category,
245
+ :currency,
246
+ :custom_form,
247
+ :default_allocation_strategy,
248
+ :default_tax_reg,
249
+ :dr_account,
250
+ :entity_status,
251
+ :fx_account,
252
+ :image,
253
+ :lead_source,
254
+ :opening_balance_account,
255
+ :parent,
256
+ :partner,
257
+ :pref_cc_processor,
258
+ :price_level,
259
+ :receivables_account,
260
+ :representing_subsidiary,
261
+ :sales_group,
262
+ :sales_readiness,
263
+ :sales_rep,
264
+ :shipping_item,
265
+ :source_web_site,
266
+ :subsidiary,
267
+ :tax_item,
268
+ :terms,
269
+ :territory,
32
270
  ].each do |record_ref|
33
271
  expect(customer).to have_record_ref(record_ref)
34
272
  end
@@ -115,12 +353,12 @@ describe NetSuite::Records::Customer do
115
353
  }
116
354
  ]
117
355
  }
118
- expect(customer.subscriptions_list).to be_kind_of(NetSuite::Records::CustomerSubscriptionsList)
356
+ expect(customer.subscriptions_list).to be_kind_of(NetSuite::Records::SubscriptionsList)
119
357
  expect(customer.subscriptions_list.subscriptions.length).to eql(1)
120
358
  end
121
359
 
122
- it 'can be set from a CustomerSubscriptionsList object' do
123
- customer_subscriptions_list = NetSuite::Records::CustomerSubscriptionsList.new
360
+ it 'can be set from a SubscriptionsList object' do
361
+ customer_subscriptions_list = NetSuite::Records::SubscriptionsList.new
124
362
  customer.subscriptions_list = customer_subscriptions_list
125
363
  expect(customer.subscriptions_list).to eql(customer_subscriptions_list)
126
364
  end
@@ -202,6 +440,35 @@ describe NetSuite::Records::Customer do
202
440
  end
203
441
  end
204
442
 
443
+ describe '#attach_file' do
444
+ let(:test_data) { { :email => 'test@example.com', :fax => '1234567890' } }
445
+ let(:file) { double('file') }
446
+
447
+ context 'when the response is successful' do
448
+ let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
449
+
450
+ it 'returns true' do
451
+ customer = NetSuite::Records::Customer.new(test_data)
452
+ expect(NetSuite::Actions::AttachFile).to receive(:call).
453
+ with([customer, file], {}).
454
+ and_return(response)
455
+ expect(customer.attach_file(file)).to be_truthy
456
+ end
457
+ end
458
+
459
+ context 'when the response is unsuccessful' do
460
+ let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
461
+
462
+ it 'returns false' do
463
+ customer = NetSuite::Records::Customer.new(test_data)
464
+ expect(NetSuite::Actions::AttachFile).to receive(:call).
465
+ with([customer, file], {}).
466
+ and_return(response)
467
+ expect(customer.attach_file(file)).to be_falsey
468
+ end
469
+ end
470
+ end
471
+
205
472
  describe '#to_record' do
206
473
  let(:customer) { NetSuite::Records::Customer.new(:entity_id => 'TEST CUSTOMER', :is_person => true) }
207
474
 
@@ -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
@@ -13,9 +13,10 @@ describe NetSuite::Records::SalesOrderItem do
13
13
  :quantity, :quantity_back_ordered, :quantity_billed,
14
14
  :quantity_committed, :quantity_fulfilled,
15
15
  :rate, :rev_rec_end_date, :rev_rec_start_date,
16
- :rev_rec_term_in_months, :serial_numbers, :tax1_amt, :tax_rate1,
17
- :tax_rate2, :vsoe_allocation, :vsoe_amount, :vsoe_deferral,
18
- :vsoe_delivered, :vsoe_permit_discount, :vsoe_price
16
+ :rev_rec_term_in_months, :serial_numbers, :ship_group,
17
+ :tax1_amt, :tax_rate1, :tax_rate2,
18
+ :vsoe_allocation, :vsoe_amount, :vsoe_deferral,
19
+ :vsoe_delivered, :vsoe_permit_discount, :vsoe_price,
19
20
  ].each do |field|
20
21
  expect(item).to have_field(field)
21
22
  end
@@ -23,6 +23,23 @@ describe NetSuite::Records::SalesOrder do
23
23
  end
24
24
  end
25
25
 
26
+ it 'has all the right fields with specific classes' do
27
+ {
28
+ billing_address: NetSuite::Records::Address,
29
+ custom_field_list: NetSuite::Records::CustomFieldList,
30
+ gift_cert_redemption_list: NetSuite::Records::GiftCertRedemptionList,
31
+ item_list: NetSuite::Records::SalesOrderItemList,
32
+ null_field_list: NetSuite::Records::NullFieldList,
33
+ promotions_list: NetSuite::Records::PromotionsList,
34
+ ship_group_list: NetSuite::Records::SalesOrderShipGroupList,
35
+ shipping_address: NetSuite::Records::Address,
36
+ transaction_bill_address: NetSuite::Records::BillAddress,
37
+ transaction_ship_address: NetSuite::Records::ShipAddress,
38
+ }.each do |field, klass|
39
+ expect(salesorder).to have_field(field, klass)
40
+ end
41
+ end
42
+
26
43
  it 'has all the right record refs' do
27
44
  [
28
45
  :account, :bill_address_list, :created_from, :currency, :custom_form, :department, :discount_item,
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe NetSuite::Records::CustomerSubscription do
3
+ describe NetSuite::Records::Subscription do
4
4
 
5
5
  before do
6
6
  NetSuite::Configuration.api_version = '2014_2'
@@ -16,7 +16,7 @@ describe NetSuite::Records::CustomerSubscription do
16
16
  }
17
17
  end
18
18
 
19
- let(:list) { NetSuite::Records::CustomerSubscription.new(attributes) }
19
+ let(:list) { NetSuite::Records::Subscription.new(attributes) }
20
20
 
21
21
  it 'has all the right fields' do
22
22
  [
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe NetSuite::Records::CustomerSubscriptionsList do
4
- let(:list) { NetSuite::Records::CustomerSubscriptionsList.new }
3
+ describe NetSuite::Records::SubscriptionsList do
4
+ let(:list) { NetSuite::Records::SubscriptionsList.new }
5
5
 
6
6
  it 'has a subscriptions attribute' do
7
7
  expect(list.subscriptions).to be_kind_of(Array)