netsuite 0.8.2 → 0.8.7
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.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/.tool-versions +1 -0
- data/Gemfile +4 -3
- data/README.md +129 -38
- data/circle.yml +36 -13
- data/lib/netsuite.rb +40 -19
- data/lib/netsuite/actions/login.rb +20 -1
- data/lib/netsuite/actions/search.rb +1 -6
- data/lib/netsuite/actions/update.rb +6 -2
- data/lib/netsuite/actions/update_list.rb +109 -0
- data/lib/netsuite/actions/upsert.rb +2 -0
- data/lib/netsuite/configuration.rb +34 -4
- data/lib/netsuite/errors.rb +1 -0
- data/lib/netsuite/records/accounting_period.rb +2 -2
- data/lib/netsuite/records/assembly_build.rb +4 -1
- data/lib/netsuite/records/assembly_item.rb +1 -0
- data/lib/netsuite/records/assembly_unbuild.rb +3 -0
- data/lib/netsuite/records/bin_number.rb +18 -0
- data/lib/netsuite/records/bin_number_list.rb +1 -20
- data/lib/netsuite/records/bin_transfer.rb +38 -0
- data/lib/netsuite/records/bin_transfer_inventory.rb +20 -0
- data/lib/netsuite/records/bin_transfer_inventory_list.rb +10 -0
- data/lib/netsuite/records/cash_refund_item.rb +1 -1
- data/lib/netsuite/records/classification.rb +5 -2
- data/lib/netsuite/records/contact.rb +1 -1
- data/lib/netsuite/records/credit_memo.rb +1 -1
- data/lib/netsuite/records/custom_field_list.rb +10 -2
- data/lib/netsuite/records/custom_record.rb +3 -3
- data/lib/netsuite/records/custom_record_ref.rb +1 -0
- data/lib/netsuite/records/customer.rb +5 -4
- data/lib/netsuite/records/customer_credit_cards.rb +36 -0
- data/lib/netsuite/records/customer_credit_cards_list.rb +10 -0
- data/lib/netsuite/records/customer_deposit.rb +9 -6
- data/lib/netsuite/records/customer_payment.rb +6 -2
- data/lib/netsuite/records/customer_payment_credit.rb +17 -0
- data/lib/netsuite/records/customer_payment_credit_list.rb +12 -0
- data/lib/netsuite/records/customer_sales_team.rb +24 -0
- data/lib/netsuite/records/customer_sales_team_list.rb +9 -0
- data/lib/netsuite/records/customer_status.rb +29 -0
- data/lib/netsuite/records/customer_subscription.rb +18 -0
- data/lib/netsuite/records/customer_subscriptions_list.rb +10 -0
- data/lib/netsuite/records/employee.rb +1 -1
- data/lib/netsuite/records/entity_custom_field.rb +53 -0
- data/lib/netsuite/records/estimate.rb +42 -0
- data/lib/netsuite/records/estimate_item.rb +40 -0
- data/lib/netsuite/records/estimate_item_list.rb +11 -0
- data/lib/netsuite/records/inbound_shipment.rb +33 -0
- data/lib/netsuite/records/inbound_shipment_item.rb +39 -0
- data/lib/netsuite/records/inbound_shipment_item_list.rb +11 -0
- data/lib/netsuite/records/inter_company_journal_entry.rb +48 -0
- data/lib/netsuite/records/inter_company_journal_entry_line.rb +28 -0
- data/lib/netsuite/records/inter_company_journal_entry_line_list.rb +14 -0
- data/lib/netsuite/records/inventory_item.rb +3 -2
- data/lib/netsuite/records/invoice.rb +1 -1
- data/lib/netsuite/records/item_fulfillment.rb +1 -1
- data/lib/netsuite/records/lot_numbered_inventory_item.rb +116 -0
- data/lib/netsuite/records/matrix_option_list.rb +12 -4
- data/lib/netsuite/records/message.rb +30 -0
- data/lib/netsuite/records/non_inventory_resale_item.rb +3 -2
- data/lib/netsuite/records/non_inventory_sale_item.rb +1 -1
- data/lib/netsuite/records/other_charge_sale_item.rb +2 -2
- data/lib/netsuite/records/partner.rb +7 -5
- data/lib/netsuite/records/price.rb +17 -0
- data/lib/netsuite/records/price_level.rb +26 -0
- data/lib/netsuite/records/price_list.rb +9 -0
- data/lib/netsuite/records/pricing.rb +20 -0
- data/lib/netsuite/records/pricing_matrix.rb +2 -2
- data/lib/netsuite/records/promotions.rb +26 -0
- data/lib/netsuite/records/promotions_list.rb +9 -0
- data/lib/netsuite/records/return_authorization_item.rb +1 -1
- data/lib/netsuite/records/sales_order.rb +1 -0
- data/lib/netsuite/records/sales_order_item.rb +12 -5
- data/lib/netsuite/records/sales_role.rb +26 -0
- data/lib/netsuite/records/sales_tax_item.rb +3 -1
- data/lib/netsuite/records/serialized_assembly_item.rb +239 -0
- data/lib/netsuite/records/service_resale_item.rb +1 -1
- data/lib/netsuite/records/service_sale_item.rb +1 -1
- data/lib/netsuite/records/support_case.rb +1 -1
- data/lib/netsuite/records/support_case_type.rb +26 -0
- data/lib/netsuite/records/tax_group.rb +2 -2
- data/lib/netsuite/records/transaction_body_custom_field.rb +61 -0
- data/lib/netsuite/records/transaction_column_custom_field.rb +59 -0
- data/lib/netsuite/records/vendor.rb +2 -1
- data/lib/netsuite/records/vendor_credit.rb +2 -0
- data/lib/netsuite/records/vendor_currency.rb +26 -0
- data/lib/netsuite/records/vendor_currency_list.rb +9 -0
- data/lib/netsuite/records/work_order.rb +8 -0
- data/lib/netsuite/support/actions.rb +2 -0
- data/lib/netsuite/support/country.rb +27 -15
- data/lib/netsuite/support/search_result.rb +20 -5
- data/lib/netsuite/utilities.rb +83 -21
- data/lib/netsuite/version.rb +1 -1
- data/netsuite.gemspec +4 -3
- data/spec/netsuite/actions/login_spec.rb +23 -0
- data/spec/netsuite/actions/update_list_spec.rb +107 -0
- data/spec/netsuite/actions/update_spec.rb +42 -0
- data/spec/netsuite/configuration_spec.rb +111 -6
- data/spec/netsuite/records/address_spec.rb +10 -0
- data/spec/netsuite/records/basic_record_spec.rb +19 -2
- data/spec/netsuite/records/bin_number_spec.rb +23 -0
- data/spec/netsuite/records/classification_spec.rb +10 -1
- data/spec/netsuite/records/custom_field_list_spec.rb +39 -4
- data/spec/netsuite/records/custom_record_spec.rb +1 -1
- data/spec/netsuite/records/customer_credit_cards_list_spec.rb +23 -0
- data/spec/netsuite/records/customer_payment_credit_list_spec.rb +26 -0
- data/spec/netsuite/records/customer_payment_spec.rb +1 -6
- data/spec/netsuite/records/customer_sales_team_list_spec.rb +41 -0
- data/spec/netsuite/records/customer_spec.rb +44 -2
- data/spec/netsuite/records/customer_subscription_spec.rb +41 -0
- data/spec/netsuite/records/customer_subscriptions_list_spec.rb +19 -0
- data/spec/netsuite/records/employee_spec.rb +2 -2
- data/spec/netsuite/records/entity_custom_field_spec.rb +34 -0
- data/spec/netsuite/records/estimate_item_list_spec.rb +26 -0
- data/spec/netsuite/records/estimate_item_spec.rb +40 -0
- data/spec/netsuite/records/estimate_spec.rb +216 -0
- data/spec/netsuite/records/inter_company_journal_entry_line_list_spec.rb +26 -0
- data/spec/netsuite/records/inter_company_journal_entry_line_spec.rb +60 -0
- data/spec/netsuite/records/inter_company_journal_entry_spec.rb +156 -0
- data/spec/netsuite/records/inventory_item_spec.rb +57 -0
- data/spec/netsuite/records/matrix_option_list_spec.rb +15 -5
- data/spec/netsuite/records/message_spec.rb +49 -0
- data/spec/netsuite/records/non_inventory_resale_item_spec.rb +165 -0
- data/spec/netsuite/records/non_inventory_sale_item_spec.rb +1 -1
- data/spec/netsuite/records/partner_spec.rb +143 -0
- data/spec/netsuite/records/price_level_spec.rb +16 -0
- data/spec/netsuite/records/pricing_matrix_spec.rb +15 -13
- data/spec/netsuite/records/return_authorization_item_spec.rb +1 -1
- data/spec/netsuite/records/sales_order_item_spec.rb +11 -5
- data/spec/netsuite/records/service_resale_item_spec.rb +134 -0
- data/spec/netsuite/records/support_case_type_spec.rb +22 -0
- data/spec/netsuite/records/transaction_body_custom_field_spec.rb +32 -0
- data/spec/netsuite/records/transaction_column_custom_field_spec.rb +32 -0
- data/spec/netsuite/records/vendor_credit_spec.rb +29 -0
- data/spec/netsuite/records/vendor_spec.rb +1 -1
- data/spec/netsuite/support/search_result_spec.rb +24 -0
- data/spec/netsuite/utilities_spec.rb +44 -6
- data/spec/spec_helper.rb +5 -4
- data/spec/support/fixtures/update_list/update_list_items.xml +22 -0
- data/spec/support/fixtures/update_list/update_list_one_item.xml +18 -0
- data/spec/support/fixtures/update_list/update_list_with_errors.xml +32 -0
- metadata +111 -11
|
@@ -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
|
|
@@ -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,
|
|
@@ -25,6 +26,7 @@ describe 'basic records' do
|
|
|
25
26
|
NetSuite::Records::CustomerDeposit,
|
|
26
27
|
NetSuite::Records::NonInventoryPurchaseItem,
|
|
27
28
|
NetSuite::Records::NonInventoryResaleItem,
|
|
29
|
+
NetSuite::Records::LotNumberedInventoryItem,
|
|
28
30
|
NetSuite::Records::TaxGroup,
|
|
29
31
|
NetSuite::Records::Folder,
|
|
30
32
|
NetSuite::Records::CustomerCategory,
|
|
@@ -48,12 +50,23 @@ describe 'basic records' do
|
|
|
48
50
|
NetSuite::Records::SerializedInventoryItem,
|
|
49
51
|
NetSuite::Records::DepositApplication,
|
|
50
52
|
NetSuite::Records::InventoryAdjustment,
|
|
53
|
+
NetSuite::Records::Vendor,
|
|
51
54
|
NetSuite::Records::VendorReturnAuthorization,
|
|
52
55
|
NetSuite::Records::AssemblyBuild,
|
|
53
56
|
NetSuite::Records::AssemblyUnbuild,
|
|
54
57
|
NetSuite::Records::AssemblyComponent,
|
|
55
58
|
NetSuite::Records::InventoryNumber,
|
|
56
|
-
NetSuite::Records::
|
|
59
|
+
NetSuite::Records::PriceLevel,
|
|
60
|
+
NetSuite::Records::LotNumberedAssemblyItem,
|
|
61
|
+
NetSuite::Records::InboundShipment,
|
|
62
|
+
NetSuite::Records::InterCompanyJournalEntry,
|
|
63
|
+
NetSuite::Records::BinTransfer,
|
|
64
|
+
NetSuite::Records::SerializedAssemblyItem,
|
|
65
|
+
NetSuite::Records::CustomerStatus,
|
|
66
|
+
NetSuite::Records::CustomerPayment,
|
|
67
|
+
NetSuite::Records::TransactionBodyCustomField,
|
|
68
|
+
NetSuite::Records::TransactionColumnCustomField,
|
|
69
|
+
NetSuite::Records::EntityCustomField
|
|
57
70
|
]
|
|
58
71
|
}
|
|
59
72
|
|
|
@@ -98,8 +111,12 @@ describe 'basic records' do
|
|
|
98
111
|
|
|
99
112
|
if !sublist_fields.empty?
|
|
100
113
|
sublist_fields.each do |sublist_field|
|
|
114
|
+
sublist = record_instance.send(sublist_field)
|
|
115
|
+
|
|
101
116
|
# TODO make a sublist entry with some fields valid for that sublist item
|
|
102
|
-
|
|
117
|
+
sublist << {}
|
|
118
|
+
|
|
119
|
+
expect(sublist.send(sublist.sublist_key).count).to be(1)
|
|
103
120
|
end
|
|
104
121
|
end
|
|
105
122
|
|
|
@@ -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
|
|
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
|
|
41
|
-
|
|
42
|
-
|
|
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
|
|
@@ -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,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'
|
|
@@ -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, :
|
|
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, :
|
|
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
|