netsuite 0.8.6 → 0.8.10

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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +20 -0
  3. data/.ruby-version +1 -1
  4. data/.tool-versions +1 -0
  5. data/Gemfile +1 -6
  6. data/HISTORY.md +38 -0
  7. data/README.md +42 -21
  8. data/Rakefile +1 -1
  9. data/lib/netsuite/configuration.rb +13 -0
  10. data/lib/netsuite/records/accounting_period.rb +2 -2
  11. data/lib/netsuite/records/assembly_unbuild.rb +1 -3
  12. data/lib/netsuite/records/contact.rb +1 -1
  13. data/lib/netsuite/records/cost_category.rb +28 -0
  14. data/lib/netsuite/records/credit_memo.rb +1 -1
  15. data/lib/netsuite/records/currency_rate.rb +1 -1
  16. data/lib/netsuite/records/custom_field_list.rb +9 -3
  17. data/lib/netsuite/records/customer_deposit.rb +5 -5
  18. data/lib/netsuite/records/customer_payment.rb +5 -2
  19. data/lib/netsuite/records/customer_payment_credit.rb +17 -0
  20. data/lib/netsuite/records/customer_payment_credit_list.rb +12 -0
  21. data/lib/netsuite/records/estimate.rb +95 -14
  22. data/lib/netsuite/records/inventory_item.rb +62 -1
  23. data/lib/netsuite/records/inventory_number.rb +1 -1
  24. data/lib/netsuite/records/inventory_transfer.rb +1 -0
  25. data/lib/netsuite/records/invoice.rb +98 -5
  26. data/lib/netsuite/records/invoice_item.rb +1 -1
  27. data/lib/netsuite/records/item_fulfillment_item.rb +1 -1
  28. data/lib/netsuite/records/item_receipt_item.rb +3 -2
  29. data/lib/netsuite/records/member_list.rb +0 -2
  30. data/lib/netsuite/records/non_inventory_purchase_item.rb +1 -1
  31. data/lib/netsuite/records/non_inventory_resale_item.rb +1 -1
  32. data/lib/netsuite/records/non_inventory_sale_item.rb +1 -1
  33. data/lib/netsuite/records/opportunity.rb +2 -2
  34. data/lib/netsuite/records/partner.rb +7 -5
  35. data/lib/netsuite/records/phone_call.rb +1 -1
  36. data/lib/netsuite/records/serialized_assembly_item.rb +3 -2
  37. data/lib/netsuite/records/service_resale_item.rb +1 -1
  38. data/lib/netsuite/records/service_sale_item.rb +1 -1
  39. data/lib/netsuite/records/transfer_order_item.rb +1 -1
  40. data/lib/netsuite/records/vendor.rb +6 -5
  41. data/lib/netsuite/records/vendor_currency.rb +26 -0
  42. data/lib/netsuite/records/vendor_currency_list.rb +9 -0
  43. data/lib/netsuite/support/fields.rb +17 -0
  44. data/lib/netsuite/support/records.rb +1 -1
  45. data/lib/netsuite/support/search_result.rb +23 -4
  46. data/lib/netsuite/utilities.rb +1 -0
  47. data/lib/netsuite/version.rb +1 -1
  48. data/lib/netsuite.rb +5 -0
  49. data/netsuite.gemspec +4 -2
  50. data/spec/netsuite/actions/search_spec.rb +22 -0
  51. data/spec/netsuite/configuration_spec.rb +33 -1
  52. data/spec/netsuite/records/basic_record_spec.rb +8 -1
  53. data/spec/netsuite/records/cost_category_spec.rb +105 -0
  54. data/spec/netsuite/records/custom_field_list_spec.rb +40 -2
  55. data/spec/netsuite/records/customer_payment_credit_list_spec.rb +26 -0
  56. data/spec/netsuite/records/customer_payment_spec.rb +1 -6
  57. data/spec/netsuite/records/estimate_spec.rb +103 -13
  58. data/spec/netsuite/records/inventory_item_spec.rb +65 -0
  59. data/spec/netsuite/records/invoice_spec.rb +94 -0
  60. data/spec/netsuite/records/partner_spec.rb +6 -4
  61. data/spec/netsuite/records/vendor_spec.rb +1 -1
  62. data/spec/netsuite/support/fields_spec.rb +36 -1
  63. data/spec/support/field_matcher.rb +8 -6
  64. data/spec/support/fixtures/custom_fields/multi_select.xml +47 -0
  65. data/spec/support/fixtures/search/saved_search_item.xml +55 -0
  66. data/spec/support/fixtures/search/saved_search_joined_custom_customer.xml +15 -1
  67. data/spec/support/search_only_field_matcher.rb +7 -0
  68. metadata +42 -16
  69. data/circle.yml +0 -36
@@ -168,9 +168,31 @@ describe NetSuite::Actions::Search do
168
168
 
169
169
  expect(search.results.size).to eq(2)
170
170
  expect(search.current_page).to eq(1)
171
+ expect(search.results.first.internal_id).to eq('123')
172
+ expect(search.results.first.external_id).to eq('456')
171
173
  expect(search.results.first.alt_name).to eq('A Awesome Name')
174
+ expect(search.results.first.custom_field_list.custitem_stringfield.value).to eq('sample string value')
175
+ expect(search.results.first.custom_field_list.custitem_apcategoryforsales.value.internal_id).to eq('4')
172
176
  expect(search.results.last.email).to eq('alessawesome@gmail.com')
173
177
  end
178
+
179
+ it "should handle an ID search with basic search only field result columns" do
180
+ response = File.read('spec/support/fixtures/search/saved_search_item.xml')
181
+ savon.expects(:search)
182
+ .with(message: {
183
+ "searchRecord"=>{
184
+ "@xsi:type" =>"listAcct:ItemSearchAdvanced",
185
+ "@savedSearchId" =>42,
186
+ :content! =>{"listAcct:criteria"=>{}},
187
+ }
188
+ }).returns(response)
189
+
190
+ search = NetSuite::Records::InventoryItem.search(saved: 42)
191
+
192
+ expect(search.results.first.location_quantity_available).to eq('3307.0')
193
+ expect(search.results.first.location_re_order_point).to eq('2565.0')
194
+ expect(search.results.first.location_quantity_on_order).to eq('40000.0')
195
+ end
174
196
  end
175
197
 
176
198
  context "advanced search" do
@@ -29,10 +29,12 @@ describe NetSuite::Configuration do
29
29
  end
30
30
 
31
31
  describe '#connection' do
32
+ EXAMPLE_ENDPOINT = 'https://1023.suitetalk.api.netsuite.com/services/NetSuitePort_2020_2'
32
33
  before(:each) do
33
34
  # reset clears out the password info
34
35
  config.email 'me@example.com'
35
36
  config.password 'me@example.com'
37
+ config.endpoint EXAMPLE_ENDPOINT
36
38
  config.account 1023
37
39
  config.wsdl "my_wsdl"
38
40
  config.api_version "2012_2"
@@ -57,6 +59,19 @@ describe NetSuite::Configuration do
57
59
 
58
60
  expect(config).to have_received(:cached_wsdl)
59
61
  end
62
+
63
+ it 'sets the endpoint on the Savon client' do
64
+ # this is ugly/brittle, but it's hard to see how else to test this
65
+ savon_configs = config.connection.globals.instance_eval {@options}
66
+ expect(savon_configs.fetch(:endpoint)).to eq(EXAMPLE_ENDPOINT)
67
+ end
68
+
69
+ it 'handles a nil endpoint' do
70
+ config.endpoint = nil
71
+ # this is ugly/brittle, but it's hard to see how else to test this
72
+ savon_configs = config.connection.globals.instance_eval {@options}
73
+ expect(savon_configs.fetch(:endpoint)).to eq(nil)
74
+ end
60
75
  end
61
76
 
62
77
  describe '#wsdl' do
@@ -166,6 +181,23 @@ describe NetSuite::Configuration do
166
181
  end
167
182
  end
168
183
 
184
+ describe '#endpoint' do
185
+ it 'can be set with endpoint=' do
186
+ config.endpoint = 42
187
+ expect(config.endpoint).to eq(42)
188
+ end
189
+
190
+ it 'can be set with just endpoint(value)' do
191
+ config.endpoint(42)
192
+ expect(config.endpoint).to eq(42)
193
+ end
194
+
195
+ it 'supports nil endpoints' do
196
+ config.endpoint = nil
197
+ expect(config.endpoint).to eq(nil)
198
+ end
199
+ end
200
+
169
201
  describe '#auth_header' do
170
202
  context 'when doing user authentication' do
171
203
  before do
@@ -369,7 +401,7 @@ describe NetSuite::Configuration do
369
401
 
370
402
  describe "#log" do
371
403
  it 'allows a file path to be set as the log destination' do
372
- file_path = Tempfile.new.path
404
+ file_path = Tempfile.new('tmplog').path
373
405
  config.log = file_path
374
406
  config.logger.info "foo"
375
407
 
@@ -1,6 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'basic records' do
4
+ # all records with internal IDs should be added to this list
4
5
  let(:basic_record_list) {
5
6
  [
6
7
  NetSuite::Records::Currency,
@@ -49,6 +50,7 @@ describe 'basic records' do
49
50
  NetSuite::Records::SerializedInventoryItem,
50
51
  NetSuite::Records::DepositApplication,
51
52
  NetSuite::Records::InventoryAdjustment,
53
+ NetSuite::Records::Vendor,
52
54
  NetSuite::Records::VendorReturnAuthorization,
53
55
  NetSuite::Records::AssemblyBuild,
54
56
  NetSuite::Records::AssemblyUnbuild,
@@ -61,6 +63,7 @@ describe 'basic records' do
61
63
  NetSuite::Records::BinTransfer,
62
64
  NetSuite::Records::SerializedAssemblyItem,
63
65
  NetSuite::Records::CustomerStatus,
66
+ NetSuite::Records::CustomerPayment,
64
67
  NetSuite::Records::TransactionBodyCustomField,
65
68
  NetSuite::Records::TransactionColumnCustomField,
66
69
  NetSuite::Records::EntityCustomField
@@ -108,8 +111,12 @@ describe 'basic records' do
108
111
 
109
112
  if !sublist_fields.empty?
110
113
  sublist_fields.each do |sublist_field|
114
+ sublist = record_instance.send(sublist_field)
115
+
111
116
  # TODO make a sublist entry with some fields valid for that sublist item
112
- record_instance.send(sublist_field) << {}
117
+ sublist << {}
118
+
119
+ expect(sublist.send(sublist.sublist_key).count).to be(1)
113
120
  end
114
121
  end
115
122
 
@@ -0,0 +1,105 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::CostCategory do
4
+ let(:cost_category) { described_class.new }
5
+
6
+ it 'has all the right fields' do
7
+ [
8
+ :is_inactive,
9
+ :item_cost_type,
10
+ :name,
11
+ ].each do |field|
12
+ expect(cost_category).to have_field(field)
13
+ end
14
+ end
15
+
16
+ it 'has all the right record refs' do
17
+ [
18
+ :account,
19
+ ].each do |record_ref|
20
+ expect(cost_category).to have_record_ref(record_ref)
21
+ end
22
+ end
23
+
24
+ describe '.get' do
25
+ context 'when the response is successful' do
26
+ let(:response) { NetSuite::Response.new(:success => true, :body => { :name => 'CostCategory 1' }) }
27
+
28
+ it 'returns a CostCategory instance populated with the data from the response object' do
29
+ expect(NetSuite::Actions::Get).to receive(:call).with([described_class, {:external_id => 1}], {}).and_return(response)
30
+ cost_category = described_class.get(:external_id => 1)
31
+ expect(cost_category).to be_kind_of(described_class)
32
+ expect(cost_category.name).to eql('CostCategory 1')
33
+ end
34
+ end
35
+
36
+ context 'when the response is unsuccessful' do
37
+ let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
38
+
39
+ it 'raises a RecordNotFound exception' do
40
+ expect(NetSuite::Actions::Get).to receive(:call).with([described_class, {:external_id => 1}], {}).and_return(response)
41
+ expect {
42
+ described_class.get(:external_id => 1)
43
+ }.to raise_error(NetSuite::RecordNotFound,
44
+ /NetSuite::Records::CostCategory with OPTIONS=(.*) could not be found/)
45
+ end
46
+ end
47
+ end
48
+
49
+ describe '#add' do
50
+ let(:test_data) { { :name => 'Test CostCategory' } }
51
+
52
+ context 'when the response is successful' do
53
+ let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
54
+
55
+ it 'returns true' do
56
+ cost_category = described_class.new(test_data)
57
+ expect(NetSuite::Actions::Add).to receive(:call).
58
+ with([cost_category], {}).
59
+ and_return(response)
60
+ expect(cost_category.add).to be_truthy
61
+ end
62
+ end
63
+
64
+ context 'when the response is unsuccessful' do
65
+ let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
66
+
67
+ it 'returns false' do
68
+ cost_category = described_class.new(test_data)
69
+ expect(NetSuite::Actions::Add).to receive(:call).
70
+ with([cost_category], {}).
71
+ and_return(response)
72
+ expect(cost_category.add).to be_falsey
73
+ end
74
+ end
75
+ end
76
+
77
+ describe '#delete' do
78
+ let(:test_data) { { :internal_id => '1' } }
79
+
80
+ context 'when the response is successful' do
81
+ let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
82
+
83
+ it 'returns true' do
84
+ cost_category = described_class.new(test_data)
85
+ expect(NetSuite::Actions::Delete).to receive(:call).
86
+ with([cost_category], {}).
87
+ and_return(response)
88
+ expect(cost_category.delete).to be_truthy
89
+ end
90
+ end
91
+
92
+ context 'when the response is unsuccessful' do
93
+ let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
94
+
95
+ it 'returns false' do
96
+ cost_category = described_class.new(test_data)
97
+ expect(NetSuite::Actions::Delete).to receive(:call).
98
+ with([cost_category], {}).
99
+ and_return(response)
100
+ expect(cost_category.delete).to be_falsey
101
+ end
102
+ end
103
+ end
104
+
105
+ end
@@ -3,17 +3,53 @@ require 'spec_helper'
3
3
  describe NetSuite::Records::CustomFieldList do
4
4
  let(:list) { NetSuite::Records::CustomFieldList.new }
5
5
 
6
+ before(:all) { savon.mock! }
7
+ after(:all) { savon.unmock! }
8
+
6
9
  it 'has a custom_fields attribute' do
7
10
  expect(list.custom_fields).to be_kind_of(Array)
8
11
  end
9
12
 
10
13
  it 'accepts a collection of CustomField records' do
11
- field = NetSuite::Records::CustomField.new({:value=>{:internal_id=>"5", :type_id=>"103"},
12
- :script_id=>"custitem_item_category", :"@xsi:type"=>"platformCore:SelectCustomFieldRef"})
14
+ field = NetSuite::Records::CustomField.new({
15
+ :value=>{:internal_id=>"5", :type_id=>"103"},
16
+ :script_id=>"custitem_item_category",
17
+ :"@xsi:type"=>"platformCore:SelectCustomFieldRef"
18
+ })
19
+
13
20
  list = described_class.new(custom_field: [field])
21
+
14
22
  expect(list.custom_fields).to eq([field])
15
23
  end
16
24
 
25
+ it 'properly decodes various custom field types' do
26
+ savon.
27
+ expects(:get).
28
+ with(message: {"platformMsgs:baseRef"=>{"@xsi:type"=>"platformCore:RecordRef", "@internalId"=>123, "@type"=>"creditMemo"}}).
29
+ returns(File.read('spec/support/fixtures/custom_fields/multi_select.xml'))
30
+
31
+ credit_memo_with_custom_fields = NetSuite::Records::CreditMemo.get(123)
32
+
33
+ expect(credit_memo_with_custom_fields.custom_field_list.custbody_standard_select.value.internal_id).to eq("2")
34
+ expect(credit_memo_with_custom_fields.custom_field_list.custbody_standard_select.value.attributes[:name]).to eq("Manual")
35
+
36
+ expect(credit_memo_with_custom_fields.custom_field_list.custbody_date_field.value).to be_a(DateTime)
37
+ expect(credit_memo_with_custom_fields.custom_field_list.custbody_date_field.value.to_s).to eq("2021-07-13T22:00:00-07:00")
38
+
39
+ expect(credit_memo_with_custom_fields.custom_field_list.custbody_string_field.value).to eq("a very nice string")
40
+ expect(credit_memo_with_custom_fields.custom_field_list.custbody_boolean_field.value).to eq(false)
41
+
42
+ # even if there's a single value, it should return an array
43
+ expect(credit_memo_with_custom_fields.custom_field_list.custbody_multi_select_field.value).to be_a(Array)
44
+ expect(credit_memo_with_custom_fields.custom_field_list.custbody_multi_select_field.value.size).to eq(1)
45
+ expect(credit_memo_with_custom_fields.custom_field_list.custbody_multi_select_field.value.first.attributes[:name]).to eq("selection value")
46
+
47
+ expect(credit_memo_with_custom_fields.custom_field_list.custbody_multi_select_with_multiple.value).to be_a(Array)
48
+ expect(credit_memo_with_custom_fields.custom_field_list.custbody_multi_select_with_multiple.value.size).to eq(2)
49
+ expect(credit_memo_with_custom_fields.custom_field_list.custbody_multi_select_with_multiple.value.first.attributes[:name]).to eq("selection value 1")
50
+ expect(credit_memo_with_custom_fields.custom_field_list.custbody_multi_select_with_multiple.value.last.attributes[:name]).to eq("selection value 2")
51
+ end
52
+
17
53
  context 'initializing with custom field attributes without a type' do
18
54
  it 'does not mutate the attributes' do
19
55
  field = {:value=>{:internal_id=>"5", :type_id=>"103"},
@@ -28,7 +64,9 @@ describe NetSuite::Records::CustomFieldList do
28
64
  it 'does not mutate the attributes' do
29
65
  field = {:value=>{:internal_id=>"5", :type_id=>"103"},
30
66
  :script_id=>"custitem_item_category", :"@xsi:type"=>"platformCore:SelectCustomFieldRef"}
67
+
31
68
  described_class.new(custom_field: [field])
69
+
32
70
  expect(field).to eq({:value=>{:internal_id=>"5", :type_id=>"103"},
33
71
  :script_id=>"custitem_item_category", :"@xsi:type"=>"platformCore:SelectCustomFieldRef"})
34
72
  end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::CustomerPaymentCreditList do
4
+ let(:list) { NetSuite::Records::CustomerPaymentCreditList.new }
5
+ let(:apply) { NetSuite::Records::CustomerPaymentCredit.new }
6
+
7
+ it 'can have credits be added to it' do
8
+ list.credits << apply
9
+ credit_list = list.credits
10
+ expect(credit_list).to be_kind_of(Array)
11
+ expect(credit_list.length).to eql(1)
12
+ credit_list.each { |i| expect(i).to be_kind_of(NetSuite::Records::CustomerPaymentCredit) }
13
+ end
14
+
15
+ describe '#to_record' do
16
+ it 'can represent itself as a SOAP record' do
17
+ record = {
18
+ 'tranCust:credit' => [{},{}]
19
+ }
20
+
21
+ list.credits.concat([apply, apply])
22
+ expect(list.to_record).to eql(record)
23
+ end
24
+ end
25
+
26
+ end
@@ -18,7 +18,7 @@ describe NetSuite::Records::CustomerPayment do
18
18
 
19
19
  it 'has all the right record refs' do
20
20
  [
21
- :account, :ar_acct, :credit_card, :credit_card_processor, :custom_form, :customer, :department, :klass, :location, :payment_method, :posting_period, :subsidiary
21
+ :account, :ar_acct, :credit_card, :credit_card_processor, :custom_form, :customer, :department, :klass, :location, :payment_method, :payment_option, :posting_period, :subsidiary
22
22
  ].each do |record_ref|
23
23
  expect(payment).to have_record_ref(record_ref)
24
24
  end
@@ -49,11 +49,6 @@ describe NetSuite::Records::CustomerPayment do
49
49
  it 'can be set from a CustomerPaymentApplyList object'
50
50
  end
51
51
 
52
- describe '#credit_list' do
53
- it 'can be set from attributes'
54
- it 'can be set from a CustomerPaymentCreditList object'
55
- end
56
-
57
52
  describe '#deposit_list' do
58
53
  it 'can be set from attributes'
59
54
  it 'can be set from a CustomerPaymentDepositList object'
@@ -7,27 +7,117 @@ describe NetSuite::Records::Estimate do
7
7
 
8
8
  it 'has all the right fields' do
9
9
  [
10
- :alt_handling_cost, :alt_shipping_cost,
11
- :balance, :bill_address, :created_date, :currency_name,
12
- :discount_rate, :email, :end_date, :est_gross_profit,
10
+ :alt_handling_cost,
11
+ :alt_sales_total,
12
+ :alt_shipping_cost,
13
+ :can_have_stackable,
14
+ :contrib_pct,
15
+ :created_date,
16
+ :currency_name,
17
+ :discount_rate,
18
+ :discount_total,
19
+ :due_date,
20
+ :email,
21
+ :end_date,
22
+ :est_gross_profit,
23
+ :est_gross_profit_percent,
13
24
  :exchange_rate,
14
- :handling_cost, :handling_tax1_rate, :is_taxable,
15
- :last_modified_date, :memo, :message, :other_ref_num,
16
- :shipping_cost, :shipping_tax1_rate,
17
- :source, :start_date, :status, :sync_partner_teams,
18
- :sync_sales_teams, :to_be_emailed, :to_be_faxed, :to_be_printed,
19
- :total_cost_estimate, :tran_date, :tran_id
25
+ :expected_close_date,
26
+ :fax,
27
+ :fob,
28
+ :handling_cost,
29
+ :handling_tax1_rate,
30
+ :handling_tax2_rate,
31
+ :include_in_forecast,
32
+ :is_taxable,
33
+ :last_modified_date,
34
+ :linked_tracking_numbers,
35
+ :memo,
36
+ :message,
37
+ :one_time,
38
+ :other_ref_num,
39
+ :probability,
40
+ :recur_annually,
41
+ :recur_monthly,
42
+ :recur_quarterly,
43
+ :recur_weekly,
44
+ :ship_date,
45
+ :ship_is_residential,
46
+ :shipping_cost,
47
+ :shipping_tax1_rate,
48
+ :shipping_tax2_rate,
49
+ :source,
50
+ :start_date,
51
+ :status,
52
+ :sub_total,
53
+ :sync_partner_teams,
54
+ :sync_sales_teams,
55
+ :tax2_total,
56
+ :tax_details_override,
57
+ :tax_point_date,
58
+ :tax_rate,
59
+ :tax_reg_override,
60
+ :tax_total,
61
+ :title,
62
+ :to_be_emailed,
63
+ :to_be_faxed,
64
+ :to_be_printed,
65
+ :total,
66
+ :total_cost_estimate,
67
+ :tracking_numbers,
68
+ :tran_date,
69
+ :tran_id,
70
+ :vat_reg_num,
71
+ :visible_to_customer,
20
72
  ].each do |field|
21
73
  expect(estimate).to have_field(field)
22
74
  end
23
75
  end
24
76
 
77
+ it 'has all the right fields with specific classes' do
78
+ {
79
+ billing_address: NetSuite::Records::Address,
80
+ custom_field_list: NetSuite::Records::CustomFieldList,
81
+ item_list: NetSuite::Records::EstimateItemList,
82
+ promotions_list: NetSuite::Records::PromotionsList,
83
+ shipping_address: NetSuite::Records::Address,
84
+ }.each do |field, klass|
85
+ expect(estimate).to have_field(field, klass)
86
+ end
87
+ end
88
+
25
89
  it 'has all the right record refs' do
26
90
  [
27
- :bill_address_list, :created_from, :currency, :custom_form, :department, :discount_item,
28
- :entity, :handling_tax_code, :job, :klass, :lead_source, :location, :message_sel,
29
- :opportunity, :partner, :promo_code, :sales_group, :sales_rep,
30
- :ship_method, :shipping_tax_code, :subsidiary
91
+ :bill_address_list,
92
+ :billing_schedule,
93
+ :klass,
94
+ :created_from,
95
+ :currency,
96
+ :custom_form,
97
+ :department,
98
+ :discount_item,
99
+ :entity,
100
+ :entity_status,
101
+ :entity_tax_reg_num,
102
+ :forecast_type,
103
+ :handling_tax_code,
104
+ :job,
105
+ :lead_source,
106
+ :location,
107
+ :message_sel,
108
+ :nexus,
109
+ :opportunity,
110
+ :partner,
111
+ :promo_code,
112
+ :sales_group,
113
+ :sales_rep,
114
+ :ship_address_list,
115
+ :ship_method,
116
+ :shipping_tax_code,
117
+ :subsidiary,
118
+ :subsidiary_tax_reg_num,
119
+ :tax_item,
120
+ :terms,
31
121
  ].each do |record_ref|
32
122
  expect(estimate).to have_record_ref(record_ref)
33
123
  end
@@ -31,6 +31,70 @@ describe NetSuite::Records::InventoryItem do
31
31
  end
32
32
  end
33
33
 
34
+ it 'has all the right search_only_fields' do
35
+ [
36
+ :acc_book_rev_rec_forecast_rule, :accounting_book,
37
+ :accounting_book_amortization, :accounting_book_create_plans_on,
38
+ :accounting_book_rev_rec_rule, :accounting_book_rev_rec_schedule,
39
+ :allowed_shipping_method, :atp_lead_time, :atp_method, :base_price,
40
+ :bin_number, :bin_on_hand_avail, :bin_on_hand_count, :bom_quantity,
41
+ :build_entire_assembly, :build_time, :buy_it_now_price, :category,
42
+ :category_preferred, :component_yield, :correlated_item,
43
+ :correlated_item_correlation, :correlated_item_count,
44
+ :correlated_item_lift, :correlated_item_purchase_rate,
45
+ :cost_accounting_status, :created, :create_job,
46
+ :cust_return_variance_account, :date_viewed, :days_before_expiration,
47
+ :default_shipping_method, :deferred_expense_account,
48
+ :departmentnohierarchy, :display_ine_bay_store, :e_bay_item_description,
49
+ :e_bay_item_subtitle, :e_bay_item_title, :ebay_relisting_option,
50
+ :effective_bom_control, :effective_date, :effective_revision,
51
+ :end_auctions_when_out_of_stock, :feed_description, :feed_name,
52
+ :froogle_product_feed, :fx_cost, :generate_accruals, :gift_cert_auth_code,
53
+ :gift_cert_email, :gift_cert_expiration_date, :gift_cert_from,
54
+ :gift_cert_message, :gift_cert_original_amount, :gift_cert_recipient,
55
+ :hierarchy_node, :hierarchy_version, :hits, :image_url,
56
+ :interco_expense_account, :inventory_location, :is_available,
57
+ :is_fulfillable, :is_lot_item, :is_serial_item,
58
+ :is_special_work_order_item, :is_vsoe_bundle, :is_wip, :item_url,
59
+ :last_quantity_available_change, :liability_account, :listing_duration,
60
+ :location_allow_store_pickup, :location_atp_lead_time,
61
+ :location_average_cost, :location_bin_quantity_available,
62
+ :location_build_time, :location_cost, :location_cost_accounting_status,
63
+ :location_default_return_cost, :location_demand_source,
64
+ :location_demand_time_fence, :location_fixed_lot_size,
65
+ :location_inventory_cost_template, :location_invt_classification,
66
+ :location_invt_count_interval, :location_last_invt_count_date,
67
+ :location_lead_time, :location_next_invt_count_date,
68
+ :location_periodic_lot_size_days, :location_periodic_lot_size_type,
69
+ :location_preferred_stock_level, :location_qty_avail_for_store_pickup,
70
+ :location_quantity_available, :location_quantity_back_ordered,
71
+ :location_quantity_committed, :location_quantity_in_transit,
72
+ :location_quantity_on_hand, :location_quantity_on_order,
73
+ :location_re_order_point, :location_reschedule_in_days,
74
+ :location_reschedule_out_days, :location_safety_stock_level,
75
+ :location_store_pickup_buffer_stock, :location_supply_lot_sizing_method,
76
+ :location_supply_time_fence, :location_supply_type, :location_total_value,
77
+ :loc_backward_consumption_days, :loc_forward_consumption_days,
78
+ :manufacturing_charge_item, :member_item, :member_quantity, :modified,
79
+ :moss_applies, :nextag_product_feed, :num_active_listings,
80
+ :number_allowed_downloads, :num_currently_listed, :obsolete_date,
81
+ :obsolete_revision, :online_customer_price, :online_price, :other_prices,
82
+ :other_vendor, :overhead_type, :preferred_bin, :primary_category,
83
+ :prod_price_variance_acct, :prod_qty_variance_acct,
84
+ :reserve_price,
85
+ :same_as_primary_book_amortization, :same_as_primary_book_rev_rec,
86
+ :scrap_acct, :sell_on_ebay, :serial_number, :serial_number_location,
87
+ :shipping_carrier, :shipping_rate, :shopping_product_feed,
88
+ :shopzilla_product_feed, :starting_price, :subsidiary,
89
+ :sub_type, :thumb_nail_url, :type, :unbuild_variance_account,
90
+ :use_component_yield, :vendor_code, :vendor_cost, :vendor_cost_entered,
91
+ :vendor_price_currency, :vendor_schedule, :vend_return_variance_account,
92
+ :web_site, :wip_acct, :wip_variance_acct, :yahoo_product_feed,
93
+ ].each do |field|
94
+ expect(NetSuite::Records::InventoryItem).to have_search_only_field(field)
95
+ end
96
+ end
97
+
34
98
  it 'has all the right record refs' do
35
99
  [
36
100
  :alternate_demand_source_item, :asset_account, :bill_exch_rate_variance_acct, :bill_price_variance_acct, :bill_qty_variance_acct, :billing_schedule, :cogs_account, :cost_category, :custom_form, :deferred_revenue_account, :demand_source, :department, :expense_account, :gain_loss_account, :income_account, :issue_product, :klass, :location, :parent, :preferred_location, :pricing_group, :purchase_price_variance_acct, :purchase_tax_code, :purchase_unit, :quantity_pricing_schedule, :rev_rec_schedule, :sale_unit, :sales_tax_code, :ship_package, :soft_descriptor, :stock_unit, :store_display_image, :store_display_thumbnail, :store_item_template, :supply_lot_sizing_method, :supply_replenishment_method, :supply_type, :tax_schedule, :units_type, :vendor
@@ -215,6 +279,7 @@ describe NetSuite::Records::InventoryItem do
215
279
  before do
216
280
  item.cost = 100
217
281
  item.is_inactive = false
282
+ item.location_quantity_available = '1.0' # Search only, excluded
218
283
  end
219
284
  it 'can represent itself as a SOAP record' do
220
285
  record = {
@@ -41,6 +41,99 @@ describe NetSuite::Records::Invoice do
41
41
  end
42
42
  end
43
43
 
44
+ it 'has all the right search_only_fields' do
45
+ [
46
+ :abbrev, :account_type, :acct_corp_card_exp, :actual_production_end_date,
47
+ :actual_production_start_date, :actual_ship_date, :alt_sales_amount,
48
+ :alt_sales_net_amount, :amount, :amount_unbilled,
49
+ :applied_to_foreign_amount, :applied_to_is_fx_variance,
50
+ :applied_to_link_amount, :applied_to_link_type, :applied_to_transaction,
51
+ :applying_foreign_amount, :applying_is_fx_variance, :applying_link_amount,
52
+ :applying_link_type, :applying_transaction, :auth_code,
53
+ :auto_calculate_lag, :avs_street_match, :avs_zip_match, :billable,
54
+ :bill_address, :bill_address1, :bill_address2, :bill_address3,
55
+ :bill_addressee, :bill_attention, :bill_city, :bill_country,
56
+ :bill_country_code, :billed_date, :billing_amount, :billing_transaction,
57
+ :bill_phone, :bill_state, :bill_variance_status, :bill_zip, :bin_number,
58
+ :bin_number_quantity, :bom_quantity, :build_entire_assembly,
59
+ :build_variance, :built, :can_have_stackable_promotions, :catch_up_period,
60
+ :cc_customer_code, :cc_exp_date, :cc_holder_name, :cc_number, :cc_street,
61
+ :cc_zip_code, :cleared, :closed, :close_date, :cogs_amount,
62
+ :commission_effective_date, :commit, :component_yield,
63
+ :confirmation_number, :contribution, :contribution_primary,
64
+ :cost_component_amount, :cost_component_category, :cost_component_item,
65
+ :cost_component_quantity, :cost_component_standard_cost, :cost_estimate,
66
+ :cost_estimate_rate, :cost_estimate_type, :created_by, :credit_amount,
67
+ :csc_match, :custom_gl, :cust_type, :date_created, :days_open,
68
+ :days_overdue, :debit_amount, :defer_rev_rec, :deposit_date,
69
+ :deposit_transaction, :doc_unit, :dr_account, :effective_rate,
70
+ :entity_status, :est_gross_profit_pct, :exclude_from_rate_request,
71
+ :expected_close_date, :expected_receipt_date, :expense_category,
72
+ :expense_date, :firmed, :forecast_type, :fulfilling_transaction,
73
+ :fx_account, :fx_amount, :fx_cost_estimate, :fx_cost_estimate_rate,
74
+ :fx_est_gross_profit, :fx_tran_cost_estimate, :fx_vsoe_allocation,
75
+ :fx_vsoe_amount, :fx_vsoe_price, :gco_availabel_to_charge,
76
+ :gco_available_to_refund, :gco_avs_street_match, :gco_avs_zip_match,
77
+ :gco_buyer_account_age, :gco_buyer_ip, :gco_charge_amount,
78
+ :gco_chargeback_amount, :gco_confirmed_charged_total,
79
+ :gco_confirmed_refunded_total, :gco_creditcard_number, :gco_csc_match,
80
+ :gco_financial_state, :gco_fulfillment_state, :gco_order_id,
81
+ :gco_order_total, :gco_promotion_amount, :gco_promotion_name,
82
+ :gco_refund_amount, :gco_shipping_total, :gco_state_changed_detail,
83
+ :gift_cert, :gross_amount, :include_in_forecast, :incoterm,
84
+ :interco_status, :interco_transaction, :inventory_location,
85
+ :inventory_subsidiary, :in_vsoe_bundle, :is_allocation, :is_backflush,
86
+ :is_gco_chargeback, :is_gco_charge_confirmed, :is_gco_payment_guaranteed,
87
+ :is_gco_refund_confirmed, :is_inside_delivery, :is_inside_pickup,
88
+ :is_intercompany_adjustment, :is_in_transit_payment, :is_multi_ship_to,
89
+ :is_reversal, :is_rev_rec_transaction, :is_scrap, :is_ship_address,
90
+ :is_transfer_price_costing, :is_wip, :item, :item_fulfillment_choice,
91
+ :item_revision, :landed_cost_per_line, :line, :line_sequence_number,
92
+ :line_unique_key, :location_auto_assigned, :main_line, :main_name,
93
+ :manufacturing_routing, :match_bill_to_receipt, :memo_main, :memorized,
94
+ :merchant_account, :multi_subsidiary, :net_amount, :net_amount_no_tax,
95
+ :next_bill_date, :no_auto_assign_location, :non_reimbursable,
96
+ :one_time_total, :options, :order_allocation_strategy, :order_priority,
97
+ :originator, :overhead_parent_item,
98
+ :override_installments, :package_count, :paid_amount, :paid_transaction,
99
+ :partner_contribution, :partner_role, :partner_team_member,
100
+ :paying_amount, :paying_transaction, :payment_approved,
101
+ :payment_event_date, :payment_event_hold_reason,
102
+ :payment_event_purchase_card_used, :payment_event_purchase_data_sent,
103
+ :payment_event_result, :payment_event_type, :payment_hold,
104
+ :payment_method, :payment_option, :pay_pal_pending, :pay_pal_status,
105
+ :pay_pal_tran_id, :payroll_batch, :pn_ref_num, :po_rate, :posting,
106
+ :price_level, :print, :probability, :projected_amount, :project_task,
107
+ :purchase_order, :quantity, :quantity_billed, :quantity_committed,
108
+ :quantity_packed, :quantity_picked, :quantity_rev_committed,
109
+ :quantity_ship_recv, :quantity_uom, :rate,
110
+ :realized_gain_posting_transaction, :recur_annually_total,
111
+ :recur_monthly_total, :recur_quarterly_total, :recur_weekly_total,
112
+ :ref_number, :requested_date, :rev_commit_status,
113
+ :rev_committing_transaction, :reversal_date, :reversal_number,
114
+ :rg_account, :rg_amount, :sales_order, :sales_team_member,
115
+ :sales_team_role, :scheduling_method, :serial_number, :serial_number_cost,
116
+ :serial_number_cost_adjustment, :serial_number_quantity, :serial_numbers,
117
+ :ship_address, :ship_address1, :ship_address2, :ship_address3,
118
+ :ship_addressee, :ship_attention, :ship_carrier, :ship_city,
119
+ :ship_complete, :ship_country, :ship_country_code, :ship_group,
120
+ :ship_phone, :shipping_amount, :ship_recv_status_line, :ship_state,
121
+ :ship_to, :ship_zip, :signed_amount, :subscription, :subscription_line,
122
+ :tax_amount, :tax_code, :tax_line, :tax_period, :term_in_months,
123
+ :terms_of_sale, :title, :to_subsidiary, :tran_est_gross_profit,
124
+ :tran_fx_est_gross_profit, :transaction_discount, :transaction_line_type,
125
+ :transaction_number, :transfer_location, :transfer_order_item_line,
126
+ :transfer_order_quantity_committed, :transfer_order_quantity_packed,
127
+ :transfer_order_quantity_picked, :transfer_order_quantity_received,
128
+ :transfer_order_quantity_shipped, :type, :unit, :unit_cost_override,
129
+ :vend_type, :visible_to_customer, :vsoe_allocation, :vsoe_amount,
130
+ :vsoe_deferral, :vsoe_delivered, :vsoe_permit_discount, :vsoe_price,
131
+ :web_site,
132
+ ].each do |field|
133
+ expect(NetSuite::Records::Invoice).to have_search_only_field(field)
134
+ end
135
+ end
136
+
44
137
  it 'has the right record_refs' do
45
138
  [
46
139
  :account, :bill_address_list, :job, :custom_form, :department, :entity, :klass, :posting_period, :ship_address_list, :terms,
@@ -329,6 +422,7 @@ describe NetSuite::Records::Invoice do
329
422
  before do
330
423
  invoice.email = 'something@example.com'
331
424
  invoice.tran_id = '4'
425
+ invoice.close_date = '2021-08-04' # Search only, excluded
332
426
  end
333
427
  it 'can represent itself as a SOAP record' do
334
428
  record = {