netsuite 0.8.1 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.ruby-version +1 -1
  4. data/Gemfile +7 -2
  5. data/README.md +111 -31
  6. data/circle.yml +33 -13
  7. data/lib/netsuite.rb +40 -19
  8. data/lib/netsuite/actions/login.rb +25 -2
  9. data/lib/netsuite/actions/search.rb +1 -6
  10. data/lib/netsuite/actions/update.rb +6 -2
  11. data/lib/netsuite/actions/update_list.rb +109 -0
  12. data/lib/netsuite/actions/upsert.rb +2 -0
  13. data/lib/netsuite/configuration.rb +21 -4
  14. data/lib/netsuite/errors.rb +3 -0
  15. data/lib/netsuite/passports/token.rb +1 -1
  16. data/lib/netsuite/records/assembly_build.rb +4 -1
  17. data/lib/netsuite/records/assembly_item.rb +1 -0
  18. data/lib/netsuite/records/assembly_unbuild.rb +3 -0
  19. data/lib/netsuite/records/bin_number.rb +18 -0
  20. data/lib/netsuite/records/bin_number_list.rb +1 -20
  21. data/lib/netsuite/records/bin_transfer.rb +38 -0
  22. data/lib/netsuite/records/bin_transfer_inventory.rb +20 -0
  23. data/lib/netsuite/records/bin_transfer_inventory_list.rb +10 -0
  24. data/lib/netsuite/records/cash_refund.rb +3 -1
  25. data/lib/netsuite/records/cash_refund_item.rb +1 -1
  26. data/lib/netsuite/records/classification.rb +5 -2
  27. data/lib/netsuite/records/contact.rb +2 -1
  28. data/lib/netsuite/records/contact_addressbook.rb +64 -0
  29. data/lib/netsuite/records/contact_addressbook_list.rb +11 -0
  30. data/lib/netsuite/records/custom_field_list.rb +10 -2
  31. data/lib/netsuite/records/custom_record.rb +3 -3
  32. data/lib/netsuite/records/custom_record_ref.rb +1 -0
  33. data/lib/netsuite/records/customer.rb +5 -4
  34. data/lib/netsuite/records/customer_credit_cards.rb +36 -0
  35. data/lib/netsuite/records/customer_credit_cards_list.rb +10 -0
  36. data/lib/netsuite/records/customer_deposit.rb +5 -2
  37. data/lib/netsuite/records/customer_payment.rb +1 -0
  38. data/lib/netsuite/records/customer_sales_team.rb +24 -0
  39. data/lib/netsuite/records/customer_sales_team_list.rb +9 -0
  40. data/lib/netsuite/records/customer_status.rb +29 -0
  41. data/lib/netsuite/records/customer_subscription.rb +18 -0
  42. data/lib/netsuite/records/customer_subscriptions_list.rb +10 -0
  43. data/lib/netsuite/records/employee.rb +2 -2
  44. data/lib/netsuite/records/entity_custom_field.rb +53 -0
  45. data/lib/netsuite/records/estimate.rb +42 -0
  46. data/lib/netsuite/records/estimate_item.rb +40 -0
  47. data/lib/netsuite/records/estimate_item_list.rb +11 -0
  48. data/lib/netsuite/records/inbound_shipment.rb +33 -0
  49. data/lib/netsuite/records/inbound_shipment_item.rb +39 -0
  50. data/lib/netsuite/records/inbound_shipment_item_list.rb +11 -0
  51. data/lib/netsuite/records/inter_company_journal_entry.rb +48 -0
  52. data/lib/netsuite/records/inter_company_journal_entry_line.rb +28 -0
  53. data/lib/netsuite/records/inter_company_journal_entry_line_list.rb +14 -0
  54. data/lib/netsuite/records/inventory_adjustment.rb +1 -1
  55. data/lib/netsuite/records/inventory_adjustment_inventory.rb +1 -1
  56. data/lib/netsuite/records/inventory_item.rb +2 -2
  57. data/lib/netsuite/records/invoice.rb +1 -1
  58. data/lib/netsuite/records/item_fulfillment.rb +1 -1
  59. data/lib/netsuite/records/lot_numbered_assembly_item.rb +64 -0
  60. data/lib/netsuite/records/lot_numbered_inventory_item.rb +116 -0
  61. data/lib/netsuite/records/matrix_option_list.rb +12 -4
  62. data/lib/netsuite/records/message.rb +30 -0
  63. data/lib/netsuite/records/non_inventory_resale_item.rb +3 -2
  64. data/lib/netsuite/records/non_inventory_sale_item.rb +2 -1
  65. data/lib/netsuite/records/other_charge_sale_item.rb +2 -2
  66. data/lib/netsuite/records/partner.rb +1 -1
  67. data/lib/netsuite/records/price.rb +17 -0
  68. data/lib/netsuite/records/price_level.rb +26 -0
  69. data/lib/netsuite/records/price_list.rb +9 -0
  70. data/lib/netsuite/records/pricing.rb +20 -0
  71. data/lib/netsuite/records/pricing_matrix.rb +2 -2
  72. data/lib/netsuite/records/promotions.rb +26 -0
  73. data/lib/netsuite/records/promotions_list.rb +9 -0
  74. data/lib/netsuite/records/return_authorization_item.rb +1 -1
  75. data/lib/netsuite/records/sales_order.rb +1 -0
  76. data/lib/netsuite/records/sales_order_item.rb +12 -5
  77. data/lib/netsuite/records/sales_role.rb +26 -0
  78. data/lib/netsuite/records/sales_tax_item.rb +3 -1
  79. data/lib/netsuite/records/serialized_assembly_item.rb +239 -0
  80. data/lib/netsuite/records/service_resale_item.rb +1 -1
  81. data/lib/netsuite/records/service_sale_item.rb +2 -1
  82. data/lib/netsuite/records/support_case.rb +1 -1
  83. data/lib/netsuite/records/support_case_type.rb +26 -0
  84. data/lib/netsuite/records/task.rb +2 -1
  85. data/lib/netsuite/records/tax_group.rb +2 -2
  86. data/lib/netsuite/records/transaction_body_custom_field.rb +61 -0
  87. data/lib/netsuite/records/transaction_column_custom_field.rb +59 -0
  88. data/lib/netsuite/records/transfer_order_item.rb +2 -2
  89. data/lib/netsuite/records/vendor_credit.rb +2 -0
  90. data/lib/netsuite/records/work_order.rb +8 -0
  91. data/lib/netsuite/support/actions.rb +2 -0
  92. data/lib/netsuite/support/country.rb +27 -15
  93. data/lib/netsuite/support/search_result.rb +20 -5
  94. data/lib/netsuite/utilities.rb +86 -21
  95. data/lib/netsuite/version.rb +2 -2
  96. data/netsuite.gemspec +5 -4
  97. data/spec/netsuite/actions/login_spec.rb +23 -0
  98. data/spec/netsuite/actions/update_list_spec.rb +107 -0
  99. data/spec/netsuite/actions/update_spec.rb +42 -0
  100. data/spec/netsuite/configuration_spec.rb +79 -6
  101. data/spec/netsuite/records/address_spec.rb +10 -0
  102. data/spec/netsuite/records/basic_record_spec.rb +12 -1
  103. data/spec/netsuite/records/bin_number_spec.rb +23 -0
  104. data/spec/netsuite/records/classification_spec.rb +10 -1
  105. data/spec/netsuite/records/custom_field_list_spec.rb +39 -4
  106. data/spec/netsuite/records/custom_record_spec.rb +1 -1
  107. data/spec/netsuite/records/customer_credit_cards_list_spec.rb +23 -0
  108. data/spec/netsuite/records/customer_sales_team_list_spec.rb +41 -0
  109. data/spec/netsuite/records/customer_spec.rb +44 -2
  110. data/spec/netsuite/records/customer_subscription_spec.rb +41 -0
  111. data/spec/netsuite/records/customer_subscriptions_list_spec.rb +19 -0
  112. data/spec/netsuite/records/employee_spec.rb +2 -2
  113. data/spec/netsuite/records/entity_custom_field_spec.rb +34 -0
  114. data/spec/netsuite/records/estimate_item_list_spec.rb +26 -0
  115. data/spec/netsuite/records/estimate_item_spec.rb +40 -0
  116. data/spec/netsuite/records/estimate_spec.rb +216 -0
  117. data/spec/netsuite/records/inter_company_journal_entry_line_list_spec.rb +26 -0
  118. data/spec/netsuite/records/inter_company_journal_entry_line_spec.rb +60 -0
  119. data/spec/netsuite/records/inter_company_journal_entry_spec.rb +156 -0
  120. data/spec/netsuite/records/inventory_item_spec.rb +57 -0
  121. data/spec/netsuite/records/invoice_spec.rb +2 -2
  122. data/spec/netsuite/records/matrix_option_list_spec.rb +15 -5
  123. data/spec/netsuite/records/message_spec.rb +49 -0
  124. data/spec/netsuite/records/non_inventory_resale_item_spec.rb +165 -0
  125. data/spec/netsuite/records/non_inventory_sale_item_spec.rb +1 -1
  126. data/spec/netsuite/records/partner_spec.rb +141 -0
  127. data/spec/netsuite/records/price_level_spec.rb +16 -0
  128. data/spec/netsuite/records/pricing_matrix_spec.rb +15 -13
  129. data/spec/netsuite/records/return_authorization_item_list_spec.rb +2 -2
  130. data/spec/netsuite/records/return_authorization_item_spec.rb +1 -1
  131. data/spec/netsuite/records/sales_order_item_spec.rb +11 -5
  132. data/spec/netsuite/records/service_resale_item_spec.rb +134 -0
  133. data/spec/netsuite/records/support_case_type_spec.rb +22 -0
  134. data/spec/netsuite/records/transaction_body_custom_field_spec.rb +32 -0
  135. data/spec/netsuite/records/transaction_column_custom_field_spec.rb +32 -0
  136. data/spec/netsuite/records/vendor_credit_spec.rb +29 -0
  137. data/spec/netsuite/support/search_result_spec.rb +24 -0
  138. data/spec/netsuite/utilities_spec.rb +44 -6
  139. data/spec/spec_helper.rb +5 -4
  140. data/spec/support/fixtures/update_list/update_list_items.xml +22 -0
  141. data/spec/support/fixtures/update_list/update_list_one_item.xml +18 -0
  142. data/spec/support/fixtures/update_list/update_list_with_errors.xml +32 -0
  143. metadata +104 -8
@@ -134,6 +134,16 @@ describe NetSuite::Records::Address do
134
134
  expect(addressbook.country.to_record).to eql ""
135
135
  expect(addressbook.to_record["platformCommon:country"]).to eql ""
136
136
  end
137
+
138
+ it 'changes the netsuite identifier based on the current API version' do
139
+ NetSuite::Configuration.api_version = '2015_1'
140
+ addressbook = NetSuite::Records::Address.new country: "GB"
141
+ expect(addressbook.to_record["platformCommon:country"]).to eql "_unitedKingdomGB"
142
+ NetSuite::Configuration.api_version = '2018_1'
143
+
144
+ addressbook = NetSuite::Records::Address.new country: "GB"
145
+ expect(addressbook.to_record["platformCommon:country"]).to eql "_unitedKingdom"
146
+ end
137
147
  end
138
148
 
139
149
  end
@@ -25,6 +25,7 @@ describe 'basic records' do
25
25
  NetSuite::Records::CustomerDeposit,
26
26
  NetSuite::Records::NonInventoryPurchaseItem,
27
27
  NetSuite::Records::NonInventoryResaleItem,
28
+ NetSuite::Records::LotNumberedInventoryItem,
28
29
  NetSuite::Records::TaxGroup,
29
30
  NetSuite::Records::Folder,
30
31
  NetSuite::Records::CustomerCategory,
@@ -52,7 +53,17 @@ describe 'basic records' do
52
53
  NetSuite::Records::AssemblyBuild,
53
54
  NetSuite::Records::AssemblyUnbuild,
54
55
  NetSuite::Records::AssemblyComponent,
55
- NetSuite::Records::InventoryNumber
56
+ NetSuite::Records::InventoryNumber,
57
+ NetSuite::Records::PriceLevel,
58
+ NetSuite::Records::LotNumberedAssemblyItem,
59
+ NetSuite::Records::InboundShipment,
60
+ NetSuite::Records::InterCompanyJournalEntry,
61
+ NetSuite::Records::BinTransfer,
62
+ NetSuite::Records::SerializedAssemblyItem,
63
+ NetSuite::Records::CustomerStatus,
64
+ NetSuite::Records::TransactionBodyCustomField,
65
+ NetSuite::Records::TransactionColumnCustomField,
66
+ NetSuite::Records::EntityCustomField
56
67
  ]
57
68
  }
58
69
 
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::BinNumber do
4
+ it "has all the right fields" do
5
+ bin_number = described_class.new
6
+
7
+ [:preferred_bin, :location].each do |field|
8
+ expect(bin_number).to have_field(field)
9
+ end
10
+ end
11
+
12
+ it "has all the right record refs" do
13
+ bin_number = described_class.new
14
+
15
+ expect(bin_number).to have_record_ref(:bin_number)
16
+ end
17
+
18
+ it "has the right namespace" do
19
+ bin_number = described_class.new
20
+
21
+ expect(bin_number.record_namespace).to eq('listAcct')
22
+ end
23
+ end
@@ -5,12 +5,21 @@ describe NetSuite::Records::Classification do
5
5
 
6
6
  it 'has all the right fields' do
7
7
  [
8
- :name, :include_children, :is_inactive, :class_translation_list, :custom_field_list
8
+ :name, :include_children, :is_inactive, :class_translation_list
9
9
  ].each do |field|
10
10
  expect(classification).to have_field(field)
11
11
  end
12
12
 
13
13
  expect(classification.subsidiary_list.class).to eq(NetSuite::Records::RecordRefList)
14
+ expect(classification.custom_field_list.class).to eq(NetSuite::Records::CustomFieldList)
15
+ end
16
+
17
+ it 'has all the right record refs' do
18
+ [
19
+ :parent
20
+ ].each do |record_ref|
21
+ expect(classification).to have_record_ref(record_ref)
22
+ end
14
23
  end
15
24
 
16
25
  describe '.get' do
@@ -37,9 +37,11 @@ describe NetSuite::Records::CustomFieldList do
37
37
  context 'writing convience methods' do
38
38
  it "should create a custom field entry when none exists" do
39
39
  list.custrecord_somefield = 'a value'
40
- list.custom_fields.size.should == 1
41
- list.custom_fields.first.value.should == 'a value'
42
- list.custom_fields.first.type.should == 'platformCore:StringCustomFieldRef'
40
+ custom_fields = list.custom_fields
41
+
42
+ expect(custom_fields.size).to eq(1)
43
+ expect(custom_fields.first.value).to eq('a value')
44
+ expect(custom_fields.first.type).to eq('platformCore:StringCustomFieldRef')
43
45
  end
44
46
 
45
47
  # https://github.com/NetSweet/netsuite/issues/325
@@ -116,7 +118,7 @@ describe NetSuite::Records::CustomFieldList do
116
118
  end
117
119
 
118
120
  it "should raise an error if custom field entry does not exist" do
119
- expect{ list.nonexisting_custom_field }.to raise_error
121
+ expect{ list.nonexisting_custom_field }.to raise_error(NoMethodError)
120
122
  end
121
123
  end
122
124
  end
@@ -180,6 +182,20 @@ describe NetSuite::Records::CustomFieldList do
180
182
  script_id: "custbody_salesclassification",
181
183
  type: "platformCore:StringCustomFieldRef",
182
184
  value: "foobar"
185
+ },
186
+ {
187
+ script_id: 'custbody_multipleselectfield',
188
+ type: "platformCore:MultiSelectCustomFieldRef",
189
+ value: [
190
+ {
191
+ internal_id: 405,
192
+ type_id: 157
193
+ },
194
+ {
195
+ internal_id: 419,
196
+ type_id: 157
197
+ }
198
+ ]
183
199
  }
184
200
  ]
185
201
  }
@@ -200,9 +216,28 @@ describe NetSuite::Records::CustomFieldList do
200
216
  "@xsi:type" => "platformCore:StringCustomFieldRef",
201
217
  "platformCore:value" => "foobar",
202
218
  },
219
+ {
220
+ '@scriptId' => 'custbody_multipleselectfield',
221
+ '@xsi:type' => 'platformCore:MultiSelectCustomFieldRef',
222
+ 'platformCore:value' => [
223
+ {
224
+ :@internalId => 405,
225
+ :@typeId => "157"
226
+ },
227
+ {
228
+ :@internalId => 419,
229
+ :@typeId => "157"
230
+ }
231
+ ]
232
+ }
203
233
  ]
204
234
  }
205
235
 
236
+ # field accessors are tested elsewhere, but let's run tests here to check various field types
237
+ expect(list).to respond_to(:custbody_multipleselectfield)
238
+ expect(list).to respond_to(:custbody_salesclassification)
239
+ expect(list).to respond_to(:custentity_registeredonline)
240
+
206
241
  expect(list.to_record).to eql(record)
207
242
  expect(list.to_record.length).to eq(1)
208
243
  end
@@ -18,7 +18,7 @@ describe NetSuite::Records::CustomRecord do
18
18
 
19
19
  it 'has all the right record_refs' do
20
20
  [
21
- :custom_form, :owner
21
+ :custom_form, :owner, :rec_type, :parent
22
22
  ].each do |record_ref|
23
23
  expect(record).to have_record_ref(record_ref)
24
24
  end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::CustomerCreditCardsList do
4
+ let(:list) { NetSuite::Records::CustomerCreditCardsList.new }
5
+
6
+ it 'has a credit_cards attribute' do
7
+ expect(list.credit_cards).to be_kind_of(Array)
8
+ end
9
+
10
+ describe '#to_record' do
11
+ it 'can represent itself as a SOAP record' do
12
+ list.replace_all = true
13
+
14
+ record = {
15
+ 'listRel:creditCards' => [],
16
+ 'listRel:replaceAll' => true
17
+ }
18
+
19
+ expect(list.to_record).to eql(record)
20
+ end
21
+ end
22
+
23
+ end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::CustomerSalesTeamList do
4
+ let(:list) { NetSuite::Records::CustomerSalesTeamList.new }
5
+
6
+ it 'has an customer_sales_team attribute' do
7
+ expect(list.sales_team).to be_kind_of(Array)
8
+ end
9
+
10
+ describe '#to_record' do
11
+ it 'can represent itself as a SOAP record' do
12
+ list.replace_all = true
13
+
14
+ record = {
15
+ 'listRel:salesTeam' => [],
16
+ 'listRel:replaceAll' => true
17
+ }
18
+ expect(list.to_record).to eql(record)
19
+ end
20
+ end
21
+
22
+ describe "#replace_all" do
23
+ it "can be changed via accessor" do
24
+ list.replace_all = false
25
+
26
+ expect(list.replace_all).to eql(false)
27
+ end
28
+
29
+ it "coerces to a boolean" do
30
+ list.replace_all = "goober"
31
+
32
+ record = {
33
+ 'listRel:salesTeam' => [],
34
+ 'listRel:replaceAll' => true
35
+ }
36
+
37
+ expect(list.to_record).to eql(record)
38
+ end
39
+ end
40
+
41
+ end
@@ -8,7 +8,7 @@ describe NetSuite::Records::Customer do
8
8
  :account_number, :aging, :alt_email, :alt_name, :alt_phone, :balance, :bill_pay,
9
9
  :buying_reason, :buying_time_frame, :campaign_category, :click_stream, :comments, :company_name,
10
10
  :consol_aging, :consol_balance, :consol_days_overdue, :consol_deposit_balance, :consol_overdue_balance,
11
- :consol_unbilled_orders, :contrib_pct, :credit_cards_list, :credit_hold_override, :credit_limit,
11
+ :consol_unbilled_orders, :contrib_pct, :credit_hold_override, :credit_limit,
12
12
  :date_created, :days_overdue, :default_address,
13
13
  :deposit_balance, :download_list, :email, :email_preference, :email_transactions, :end_date, :entity_id,
14
14
  :estimated_budget, :fax, :fax_transactions, :first_name, :first_visit, :give_access, :global_subscription_status,
@@ -17,7 +17,7 @@ describe NetSuite::Records::Customer do
17
17
  :opening_balance, :opening_balance_account, :opening_balance_date, :overdue_balance,
18
18
  :password, :password2, :phone, :phonetic_name, :pref_cc_processor,:print_on_check_as,
19
19
  :print_transactions, :referrer, :reminder_days, :representing_subsidiary, :require_pwd_change, :resale_number,
20
- :sales_group, :sales_readiness, :sales_team_list, :salutation, :send_email, :ship_complete,
20
+ :sales_group, :sales_readiness, :salutation, :send_email, :ship_complete,
21
21
  :stage, :start_date, :sync_partner_teams, :tax_exempt, :taxable,
22
22
  :third_party_acct, :third_party_country, :third_party_zipcode, :title, :unbilled_orders, :url,
23
23
  :vat_reg_number, :visits, :web_lead
@@ -65,6 +65,27 @@ describe NetSuite::Records::Customer do
65
65
  end
66
66
  end
67
67
 
68
+ describe '#credit_cards_list' do
69
+ it 'can be set from attributes' do
70
+ customer.credit_cards_list = {
71
+ :credit_cards => {
72
+ :internal_id => '1234567',
73
+ :cc_default => true,
74
+ :cc_expire_date => '2099-12-01T00:00:00.000-08:00'
75
+ }
76
+ }
77
+
78
+ expect(customer.credit_cards_list).to be_kind_of(NetSuite::Records::CustomerCreditCardsList)
79
+ expect(customer.credit_cards_list.credit_cards.length).to eql(1)
80
+ end
81
+
82
+ it 'can be set from a CustomerCreditCardsList object' do
83
+ customer_credit_cards_list = NetSuite::Records::CustomerCreditCardsList.new
84
+ customer.credit_cards_list = customer_credit_cards_list
85
+ expect(customer.credit_cards_list).to eql(customer_credit_cards_list)
86
+ end
87
+ end
88
+
68
89
  describe '#custom_field_list' do
69
90
  it 'can be set from attributes' do
70
91
  attributes = {
@@ -85,6 +106,27 @@ describe NetSuite::Records::Customer do
85
106
  end
86
107
  end
87
108
 
109
+ describe '#subscriptions_list' do
110
+ it 'can be set from attributes' do
111
+ customer.subscriptions_list = {
112
+ subscriptions: [
113
+ {
114
+ :subscribed => true
115
+ }
116
+ ]
117
+ }
118
+ expect(customer.subscriptions_list).to be_kind_of(NetSuite::Records::CustomerSubscriptionsList)
119
+ expect(customer.subscriptions_list.subscriptions.length).to eql(1)
120
+ end
121
+
122
+ it 'can be set from a CustomerSubscriptionsList object' do
123
+ customer_subscriptions_list = NetSuite::Records::CustomerSubscriptionsList.new
124
+ customer.subscriptions_list = customer_subscriptions_list
125
+ expect(customer.subscriptions_list).to eql(customer_subscriptions_list)
126
+ end
127
+ end
128
+
129
+
88
130
  describe '.get' do
89
131
  context 'when the response is successful' do
90
132
  let(:response) { NetSuite::Response.new(:success => true, :body => { :is_person => true }) }
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::CustomerSubscription do
4
+
5
+ before do
6
+ NetSuite::Configuration.api_version = '2014_2'
7
+ end
8
+
9
+ let(:attributes) do
10
+ {
11
+ :subscription => {
12
+ :subscribed => true,
13
+ :subscription => NetSuite::Records::RecordRef.new(internal_id: '123123', name: 'My Sub'),
14
+ :last_modified_date => DateTime.new(2018, 1, 1, 0, 0, 0)
15
+ }
16
+ }
17
+ end
18
+
19
+ let(:list) { NetSuite::Records::CustomerSubscription.new(attributes) }
20
+
21
+ it 'has all the right fields' do
22
+ [
23
+ :subscribed, :last_modified_date
24
+ ].each do |field|
25
+ expect(list).to have_field(field)
26
+ end
27
+
28
+ expect(list.subscription).to_not be_nil
29
+ end
30
+
31
+ describe '#initialize' do
32
+ context 'when taking in a hash of attributes' do
33
+ it 'sets the attributes for the object given the attributes hash' do
34
+ expect(list.subscription.subscribed).to eql(true)
35
+ expect(list.subscription.subscription.internal_id).to eql('123123')
36
+ expect(list.subscription.subscription.name).to eql('My Sub')
37
+ expect(list.subscription.last_modified_date).to_not be_nil
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::CustomerSubscriptionsList do
4
+ let(:list) { NetSuite::Records::CustomerSubscriptionsList.new }
5
+
6
+ it 'has a subscriptions attribute' do
7
+ expect(list.subscriptions).to be_kind_of(Array)
8
+ end
9
+
10
+ describe '#to_record' do
11
+ it 'can represent itself as a SOAP record' do
12
+
13
+ record = {
14
+ 'listRel:subscriptions' => []
15
+ }
16
+ expect(list.to_record).to eql(record)
17
+ end
18
+ end
19
+ end
@@ -21,7 +21,7 @@ describe NetSuite::Records::Employee do
21
21
 
22
22
  it 'has all the right record refs' do
23
23
  [
24
- :location, :employee_status, :employee_type
24
+ :currency, :department, :location, :sales_role, :subsidiary, :employee_type, :employee_status, :supervisor
25
25
  ].each do |record_ref|
26
26
  expect(employee).to have_record_ref(record_ref)
27
27
  end
@@ -144,7 +144,7 @@ describe NetSuite::Records::Employee do
144
144
 
145
145
  it 'has the right record_refs' do
146
146
  [
147
- :currency, :department, :location, :subsidiary
147
+ :currency, :department, :location, :sales_role, :subsidiary, :employee_type, :employee_status, :supervisor
148
148
  ].each do |record_ref|
149
149
  expect(employee).to have_record_ref(record_ref)
150
150
  end
@@ -0,0 +1,34 @@
1
+ require "spec_helper"
2
+
3
+ describe NetSuite::Records::EntityCustomField do
4
+ describe ".get" do
5
+ context "success" do
6
+ let(:internal_id) { 1 }
7
+ let(:response) do
8
+ NetSuite::Response.new(
9
+ success: true,
10
+ body: {
11
+ access_level: "_edit",
12
+ field_type: "_integerNumber",
13
+ label: "Salesforce Customer ID",
14
+ show_in_list: true,
15
+ }
16
+ )
17
+ end
18
+
19
+ it "returns a EntityCustomField instance with populated fields" do
20
+ expect(NetSuite::Actions::Get)
21
+ .to receive(:call)
22
+ .with([NetSuite::Records::EntityCustomField, internal_id: internal_id], {})
23
+ .and_return(response)
24
+
25
+ record = NetSuite::Records::EntityCustomField.get(internal_id: internal_id)
26
+
27
+ expect(record.access_level).to eql("_edit")
28
+ expect(record.field_type).to eql("_integerNumber")
29
+ expect(record.label).to eql("Salesforce Customer ID")
30
+ expect(record.show_in_list).to eq(true)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe NetSuite::Records::EstimateItemList do
4
+ let(:list) { NetSuite::Records::EstimateItemList.new }
5
+
6
+ it 'has a items attribute' do
7
+ expect(list.items).to be_kind_of(Array)
8
+ end
9
+
10
+ describe '#to_record' do
11
+ before do
12
+ list.items << NetSuite::Records::EstimateItem.new(
13
+ :rate => 10
14
+ )
15
+ end
16
+
17
+ it 'can represent itself as a SOAP record' do
18
+ record = {
19
+ 'tranSales:item' => [{
20
+ 'tranSales:rate' => 10
21
+ }]
22
+ }
23
+ expect(list.to_record).to eql(record)
24
+ end
25
+ end
26
+ end