netsuite 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -0
  3. data/README.md +3 -2
  4. data/circle.yml +3 -2
  5. data/lib/netsuite.rb +17 -0
  6. data/lib/netsuite/actions/login.rb +11 -0
  7. data/lib/netsuite/actions/update.rb +6 -2
  8. data/lib/netsuite/errors.rb +1 -0
  9. data/lib/netsuite/records/assembly_build.rb +4 -1
  10. data/lib/netsuite/records/assembly_item.rb +1 -0
  11. data/lib/netsuite/records/assembly_unbuild.rb +3 -0
  12. data/lib/netsuite/records/bin_number.rb +18 -0
  13. data/lib/netsuite/records/bin_number_list.rb +1 -20
  14. data/lib/netsuite/records/classification.rb +1 -1
  15. data/lib/netsuite/records/custom_field_list.rb +10 -2
  16. data/lib/netsuite/records/custom_record.rb +2 -2
  17. data/lib/netsuite/records/custom_record_ref.rb +1 -0
  18. data/lib/netsuite/records/customer.rb +3 -3
  19. data/lib/netsuite/records/customer_deposit.rb +5 -2
  20. data/lib/netsuite/records/customer_sales_team.rb +24 -0
  21. data/lib/netsuite/records/customer_sales_team_list.rb +9 -0
  22. data/lib/netsuite/records/customer_status.rb +29 -0
  23. data/lib/netsuite/records/customer_subscription.rb +18 -0
  24. data/lib/netsuite/records/customer_subscriptions_list.rb +10 -0
  25. data/lib/netsuite/records/entity_custom_field.rb +53 -0
  26. data/lib/netsuite/records/non_inventory_resale_item.rb +2 -2
  27. data/lib/netsuite/records/price.rb +17 -0
  28. data/lib/netsuite/records/price_list.rb +9 -0
  29. data/lib/netsuite/records/pricing.rb +20 -0
  30. data/lib/netsuite/records/pricing_matrix.rb +2 -2
  31. data/lib/netsuite/records/promotions.rb +26 -0
  32. data/lib/netsuite/records/promotions_list.rb +9 -0
  33. data/lib/netsuite/records/sales_order.rb +1 -0
  34. data/lib/netsuite/records/sales_role.rb +26 -0
  35. data/lib/netsuite/records/sales_tax_item.rb +3 -1
  36. data/lib/netsuite/records/serialized_assembly_item.rb +239 -0
  37. data/lib/netsuite/records/service_sale_item.rb +1 -1
  38. data/lib/netsuite/records/tax_group.rb +2 -2
  39. data/lib/netsuite/records/transaction_body_custom_field.rb +61 -0
  40. data/lib/netsuite/records/transaction_column_custom_field.rb +59 -0
  41. data/lib/netsuite/records/vendor_credit.rb +2 -0
  42. data/lib/netsuite/records/work_order.rb +8 -0
  43. data/lib/netsuite/support/country.rb +27 -15
  44. data/lib/netsuite/utilities.rb +45 -20
  45. data/lib/netsuite/version.rb +1 -1
  46. data/spec/netsuite/actions/login_spec.rb +23 -0
  47. data/spec/netsuite/actions/update_spec.rb +42 -0
  48. data/spec/netsuite/records/address_spec.rb +10 -0
  49. data/spec/netsuite/records/basic_record_spec.rb +6 -1
  50. data/spec/netsuite/records/bin_number_spec.rb +23 -0
  51. data/spec/netsuite/records/custom_field_list_spec.rb +33 -0
  52. data/spec/netsuite/records/customer_sales_team_list_spec.rb +41 -0
  53. data/spec/netsuite/records/customer_spec.rb +22 -1
  54. data/spec/netsuite/records/customer_subscription_spec.rb +41 -0
  55. data/spec/netsuite/records/customer_subscriptions_list_spec.rb +19 -0
  56. data/spec/netsuite/records/entity_custom_field_spec.rb +34 -0
  57. data/spec/netsuite/records/pricing_matrix_spec.rb +15 -13
  58. data/spec/netsuite/records/transaction_body_custom_field_spec.rb +32 -0
  59. data/spec/netsuite/records/transaction_column_custom_field_spec.rb +32 -0
  60. data/spec/netsuite/records/vendor_credit_spec.rb +29 -0
  61. data/spec/netsuite/utilities_spec.rb +15 -3
  62. data/spec/spec_helper.rb +5 -4
  63. metadata +34 -2
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::VendorCredit do
4
+ describe '.get' do
5
+ context 'when the response is successful' do
6
+ let(:response) { NetSuite::Response.new(:success => true, :body => { :@internal_id => '1', :@external_id =>'some_id' }) }
7
+
8
+ it 'returns a VendorCredit instance populated with the data from the response object' do
9
+ expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::VendorCredit, external_id: 'some_id'], {}).and_return(response)
10
+ vendor_credit = NetSuite::Records::VendorCredit.get(external_id: 'some_id')
11
+ expect(vendor_credit).to be_kind_of(NetSuite::Records::VendorCredit)
12
+ expect(vendor_credit.internal_id).to eq('1')
13
+ expect(vendor_credit.external_id).to eq('some_id')
14
+ end
15
+ end
16
+
17
+ context 'when the response is unsuccessful' do
18
+ let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
19
+
20
+ it 'raises a RecordNotFound exception' do
21
+ expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::VendorCredit, external_id: 'some_id'], {}).and_return(response)
22
+ expect {
23
+ NetSuite::Records::VendorCredit.get(external_id: 'some_id')
24
+ }.to raise_error(NetSuite::RecordNotFound,
25
+ /NetSuite::Records::VendorCredit with OPTIONS=(.*) could not be found/)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -10,20 +10,27 @@ describe NetSuite::Utilities do
10
10
  no_dst_stamp = DateTime.parse('Sun, November 6 2017 00:00:00 -0000')
11
11
  formatted_date = NetSuite::Utilities.normalize_time_to_netsuite_date(no_dst_stamp.to_time.to_i)
12
12
  expect(formatted_date).to eq('2017-11-06T00:00:00-08:00')
13
+
14
+ no_dst_stamp_with_time = DateTime.parse('Sun, November 6 2017 12:11:10 -0000')
15
+ formatted_date = NetSuite::Utilities.normalize_time_to_netsuite_date(no_dst_stamp_with_time.to_time.to_i)
16
+ expect(formatted_date).to eq('2017-11-06T00:00:00-08:00')
13
17
  end
14
18
  end
15
19
 
16
20
  it "#netsuite_data_center_urls" do
17
21
  domains = NetSuite::Utilities.netsuite_data_center_urls('TSTDRV1576318')
18
- expect(domains[:webservices_domain]).to eq('https://webservices.na1.netsuite.com')
22
+ expect(domains[:webservices_domain]).to eq('https://webservices.netsuite.com')
23
+ expect(domains[:system_domain]).to eq('https://system.netsuite.com')
19
24
 
25
+ # ensure domains returned don't change when sandbox is enabled
20
26
  NetSuite.configure do
21
27
  reset!
22
28
  sandbox true
23
29
  end
24
30
 
25
31
  domains = NetSuite::Utilities.netsuite_data_center_urls('TSTDRV1576318')
26
- expect(domains[:webservices_domain]).to eq('https://webservices.na1.netsuite.com')
32
+ expect(domains[:webservices_domain]).to eq('https://webservices.netsuite.com')
33
+ expect(domains[:system_domain]).to eq('https://system.netsuite.com')
27
34
 
28
35
  NetSuite.configure do
29
36
  reset!
@@ -31,7 +38,12 @@ describe NetSuite::Utilities do
31
38
  end
32
39
 
33
40
  domains = NetSuite::Utilities.netsuite_data_center_urls('TSTDRV1576318')
34
- expect(domains[:webservices_domain]).to eq('https://webservices.na1.netsuite.com')
41
+ expect(domains[:webservices_domain]).to eq('https://webservices.netsuite.com')
42
+ expect(domains[:system_domain]).to eq('https://system.netsuite.com')
43
+
44
+ domains = NetSuite::Utilities.netsuite_data_center_urls('4810331')
45
+ expect(domains[:webservices_domain]).to eq('https://4810331.suitetalk.api.netsuite.com')
46
+ expect(domains[:system_domain]).to eq('https://4810331.app.netsuite.com')
35
47
  end
36
48
 
37
49
  describe '#get_record' do
@@ -1,5 +1,10 @@
1
1
  $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..') ))
2
2
 
3
+ require "rubygems"
4
+ require "bundler/setup"
5
+
6
+ Bundler.require
7
+
3
8
  # https://circleci.com/docs/code-coverage
4
9
  if ENV['CIRCLE_ARTIFACTS']
5
10
  require 'simplecov'
@@ -8,10 +13,6 @@ if ENV['CIRCLE_ARTIFACTS']
8
13
  SimpleCov.start
9
14
  end
10
15
 
11
- require 'rspec'
12
- require 'netsuite'
13
- require 'pry'
14
-
15
16
  # Requires supporting ruby files with custom matchers and macros, etc,
16
17
  # in spec/support/ and its subdirectories.
17
18
  Dir['spec/support/**/*.rb'].each { |f| require f }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netsuite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Moran
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-12-06 00:00:00.000000000 Z
12
+ date: 2019-03-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: savon
@@ -111,6 +111,7 @@ files:
111
111
  - lib/netsuite/records/billing_schedule_recurrence.rb
112
112
  - lib/netsuite/records/billing_schedule_recurrence_list.rb
113
113
  - lib/netsuite/records/bin.rb
114
+ - lib/netsuite/records/bin_number.rb
114
115
  - lib/netsuite/records/bin_number_list.rb
115
116
  - lib/netsuite/records/bin_transfer.rb
116
117
  - lib/netsuite/records/bin_transfer_inventory.rb
@@ -164,6 +165,11 @@ files:
164
165
  - lib/netsuite/records/customer_refund_apply_list.rb
165
166
  - lib/netsuite/records/customer_refund_deposit.rb
166
167
  - lib/netsuite/records/customer_refund_deposit_list.rb
168
+ - lib/netsuite/records/customer_sales_team.rb
169
+ - lib/netsuite/records/customer_sales_team_list.rb
170
+ - lib/netsuite/records/customer_status.rb
171
+ - lib/netsuite/records/customer_subscription.rb
172
+ - lib/netsuite/records/customer_subscriptions_list.rb
167
173
  - lib/netsuite/records/department.rb
168
174
  - lib/netsuite/records/deposit.rb
169
175
  - lib/netsuite/records/deposit_application.rb
@@ -177,6 +183,7 @@ files:
177
183
  - lib/netsuite/records/discount_item.rb
178
184
  - lib/netsuite/records/duration.rb
179
185
  - lib/netsuite/records/employee.rb
186
+ - lib/netsuite/records/entity_custom_field.rb
180
187
  - lib/netsuite/records/file.rb
181
188
  - lib/netsuite/records/folder.rb
182
189
  - lib/netsuite/records/gift_cert_redemption.rb
@@ -243,9 +250,14 @@ files:
243
250
  - lib/netsuite/records/payment_method.rb
244
251
  - lib/netsuite/records/payroll_item.rb
245
252
  - lib/netsuite/records/phone_call.rb
253
+ - lib/netsuite/records/price.rb
246
254
  - lib/netsuite/records/price_level.rb
255
+ - lib/netsuite/records/price_list.rb
256
+ - lib/netsuite/records/pricing.rb
247
257
  - lib/netsuite/records/pricing_matrix.rb
248
258
  - lib/netsuite/records/promotion_code.rb
259
+ - lib/netsuite/records/promotions.rb
260
+ - lib/netsuite/records/promotions_list.rb
249
261
  - lib/netsuite/records/purchase_order.rb
250
262
  - lib/netsuite/records/purchase_order_item.rb
251
263
  - lib/netsuite/records/purchase_order_item_list.rb
@@ -262,7 +274,9 @@ files:
262
274
  - lib/netsuite/records/sales_order_item.rb
263
275
  - lib/netsuite/records/sales_order_item_list.rb
264
276
  - lib/netsuite/records/sales_order_ship_group_list.rb
277
+ - lib/netsuite/records/sales_role.rb
265
278
  - lib/netsuite/records/sales_tax_item.rb
279
+ - lib/netsuite/records/serialized_assembly_item.rb
266
280
  - lib/netsuite/records/serialized_inventory_item.rb
267
281
  - lib/netsuite/records/serialized_inventory_item_location.rb
268
282
  - lib/netsuite/records/serialized_inventory_item_locations_list.rb
@@ -280,6 +294,8 @@ files:
280
294
  - lib/netsuite/records/tax_type.rb
281
295
  - lib/netsuite/records/term.rb
282
296
  - lib/netsuite/records/time_bill.rb
297
+ - lib/netsuite/records/transaction_body_custom_field.rb
298
+ - lib/netsuite/records/transaction_column_custom_field.rb
283
299
  - lib/netsuite/records/transaction_ship_group.rb
284
300
  - lib/netsuite/records/transfer_order.rb
285
301
  - lib/netsuite/records/transfer_order_item.rb
@@ -352,6 +368,7 @@ files:
352
368
  - spec/netsuite/records/billing_schedule_recurrence_list_spec.rb
353
369
  - spec/netsuite/records/billing_schedule_recurrence_spec.rb
354
370
  - spec/netsuite/records/billing_schedule_spec.rb
371
+ - spec/netsuite/records/bin_number_spec.rb
355
372
  - spec/netsuite/records/campaign_spec.rb
356
373
  - spec/netsuite/records/cash_refund_item_list_spec.rb
357
374
  - spec/netsuite/records/cash_refund_item_spec.rb
@@ -381,12 +398,16 @@ files:
381
398
  - spec/netsuite/records/customer_refund_deposit_list_spec.rb
382
399
  - spec/netsuite/records/customer_refund_deposit_spec.rb
383
400
  - spec/netsuite/records/customer_refund_spec.rb
401
+ - spec/netsuite/records/customer_sales_team_list_spec.rb
384
402
  - spec/netsuite/records/customer_spec.rb
403
+ - spec/netsuite/records/customer_subscription_spec.rb
404
+ - spec/netsuite/records/customer_subscriptions_list_spec.rb
385
405
  - spec/netsuite/records/department_spec.rb
386
406
  - spec/netsuite/records/deposit_spec.rb
387
407
  - spec/netsuite/records/discount_item_spec.rb
388
408
  - spec/netsuite/records/duration_spec.rb
389
409
  - spec/netsuite/records/employee_spec.rb
410
+ - spec/netsuite/records/entity_custom_field_spec.rb
390
411
  - spec/netsuite/records/file_spec.rb
391
412
  - spec/netsuite/records/folder_spec.rb
392
413
  - spec/netsuite/records/gift_cert_redemption_list_spec.rb
@@ -439,6 +460,8 @@ files:
439
460
  - spec/netsuite/records/support_case_spec.rb
440
461
  - spec/netsuite/records/tax_type_spec.rb
441
462
  - spec/netsuite/records/term_spec.rb
463
+ - spec/netsuite/records/transaction_body_custom_field_spec.rb
464
+ - spec/netsuite/records/transaction_column_custom_field_spec.rb
442
465
  - spec/netsuite/records/units_type_spec.rb
443
466
  - spec/netsuite/records/units_type_uom_list_spec.rb
444
467
  - spec/netsuite/records/units_type_uom_spec.rb
@@ -447,6 +470,7 @@ files:
447
470
  - spec/netsuite/records/vendor_bill_item_list_spec.rb
448
471
  - spec/netsuite/records/vendor_bill_item_spec.rb
449
472
  - spec/netsuite/records/vendor_bill_spec.rb
473
+ - spec/netsuite/records/vendor_credit_spec.rb
450
474
  - spec/netsuite/records/vendor_payment_apply_list_spec.rb
451
475
  - spec/netsuite/records/vendor_payment_apply_spec.rb
452
476
  - spec/netsuite/records/vendor_payment_spec.rb
@@ -554,6 +578,7 @@ test_files:
554
578
  - spec/netsuite/records/billing_schedule_recurrence_list_spec.rb
555
579
  - spec/netsuite/records/billing_schedule_recurrence_spec.rb
556
580
  - spec/netsuite/records/billing_schedule_spec.rb
581
+ - spec/netsuite/records/bin_number_spec.rb
557
582
  - spec/netsuite/records/campaign_spec.rb
558
583
  - spec/netsuite/records/cash_refund_item_list_spec.rb
559
584
  - spec/netsuite/records/cash_refund_item_spec.rb
@@ -583,12 +608,16 @@ test_files:
583
608
  - spec/netsuite/records/customer_refund_deposit_list_spec.rb
584
609
  - spec/netsuite/records/customer_refund_deposit_spec.rb
585
610
  - spec/netsuite/records/customer_refund_spec.rb
611
+ - spec/netsuite/records/customer_sales_team_list_spec.rb
586
612
  - spec/netsuite/records/customer_spec.rb
613
+ - spec/netsuite/records/customer_subscription_spec.rb
614
+ - spec/netsuite/records/customer_subscriptions_list_spec.rb
587
615
  - spec/netsuite/records/department_spec.rb
588
616
  - spec/netsuite/records/deposit_spec.rb
589
617
  - spec/netsuite/records/discount_item_spec.rb
590
618
  - spec/netsuite/records/duration_spec.rb
591
619
  - spec/netsuite/records/employee_spec.rb
620
+ - spec/netsuite/records/entity_custom_field_spec.rb
592
621
  - spec/netsuite/records/file_spec.rb
593
622
  - spec/netsuite/records/folder_spec.rb
594
623
  - spec/netsuite/records/gift_cert_redemption_list_spec.rb
@@ -641,6 +670,8 @@ test_files:
641
670
  - spec/netsuite/records/support_case_spec.rb
642
671
  - spec/netsuite/records/tax_type_spec.rb
643
672
  - spec/netsuite/records/term_spec.rb
673
+ - spec/netsuite/records/transaction_body_custom_field_spec.rb
674
+ - spec/netsuite/records/transaction_column_custom_field_spec.rb
644
675
  - spec/netsuite/records/units_type_spec.rb
645
676
  - spec/netsuite/records/units_type_uom_list_spec.rb
646
677
  - spec/netsuite/records/units_type_uom_spec.rb
@@ -649,6 +680,7 @@ test_files:
649
680
  - spec/netsuite/records/vendor_bill_item_list_spec.rb
650
681
  - spec/netsuite/records/vendor_bill_item_spec.rb
651
682
  - spec/netsuite/records/vendor_bill_spec.rb
683
+ - spec/netsuite/records/vendor_credit_spec.rb
652
684
  - spec/netsuite/records/vendor_payment_apply_list_spec.rb
653
685
  - spec/netsuite/records/vendor_payment_apply_spec.rb
654
686
  - spec/netsuite/records/vendor_payment_spec.rb