netsuite 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/netsuite.rb +0 -1
- data/lib/netsuite/actions/search.rb +5 -0
- data/lib/netsuite/records/file.rb +3 -8
- data/lib/netsuite/support/country.rb +2 -2
- data/lib/netsuite/version.rb +1 -1
- data/netsuite.gemspec +1 -1
- data/spec/netsuite/actions/add_spec.rb +14 -14
- data/spec/netsuite/actions/delete_spec.rb +2 -2
- data/spec/netsuite/actions/get_spec.rb +3 -3
- data/spec/netsuite/actions/initialize_spec.rb +2 -2
- data/spec/netsuite/actions/search_spec.rb +6 -6
- data/spec/netsuite/actions/update_spec.rb +16 -16
- data/spec/netsuite/actions/upsert_list_spec.rb +4 -4
- data/spec/netsuite/actions/upsert_spec.rb +14 -14
- data/spec/netsuite/configuration_spec.rb +21 -21
- data/spec/netsuite/records/account_spec.rb +16 -16
- data/spec/netsuite/records/accounting_period_spec.rb +16 -16
- data/spec/netsuite/records/assembly_item_spec.rb +2 -2
- data/spec/netsuite/records/bill_address_spec.rb +3 -3
- data/spec/netsuite/records/billing_schedule_milestone_list_spec.rb +4 -4
- data/spec/netsuite/records/billing_schedule_milestone_spec.rb +6 -6
- data/spec/netsuite/records/billing_schedule_recurrence_list_spec.rb +4 -4
- data/spec/netsuite/records/billing_schedule_recurrence_spec.rb +6 -6
- data/spec/netsuite/records/billing_schedule_spec.rb +20 -20
- data/spec/netsuite/records/campaign_spec.rb +7 -7
- data/spec/netsuite/records/classification_spec.rb +10 -10
- data/spec/netsuite/records/credit_memo_apply_list_spec.rb +2 -2
- data/spec/netsuite/records/credit_memo_apply_spec.rb +1 -1
- data/spec/netsuite/records/credit_memo_item_list_spec.rb +2 -2
- data/spec/netsuite/records/credit_memo_item_spec.rb +2 -2
- data/spec/netsuite/records/credit_memo_spec.rb +26 -26
- data/spec/netsuite/records/custom_field_list_spec.rb +10 -10
- data/spec/netsuite/records/custom_list_spec.rb +3 -3
- data/spec/netsuite/records/custom_record_spec.rb +20 -20
- data/spec/netsuite/records/custom_record_type_spec.rb +16 -16
- data/spec/netsuite/records/customer_addressbook_list_spec.rb +2 -2
- data/spec/netsuite/records/customer_addressbook_spec.rb +38 -28
- data/spec/netsuite/records/customer_payment_spec.rb +23 -23
- data/spec/netsuite/records/customer_refund_apply_list_spec.rb +2 -2
- data/spec/netsuite/records/customer_refund_apply_spec.rb +1 -1
- data/spec/netsuite/records/customer_refund_deposit_list_spec.rb +2 -2
- data/spec/netsuite/records/customer_refund_deposit_spec.rb +1 -1
- data/spec/netsuite/records/customer_refund_spec.rb +28 -28
- data/spec/netsuite/records/customer_spec.rb +24 -24
- data/spec/netsuite/records/department_spec.rb +16 -16
- data/spec/netsuite/records/deposit_spec.rb +24 -24
- data/spec/netsuite/records/discount_item_spec.rb +19 -19
- data/spec/netsuite/records/duration_spec.rb +1 -1
- data/spec/netsuite/records/inventory_item_spec.rb +18 -18
- data/spec/netsuite/records/inventory_transfer_spec.rb +5 -5
- data/spec/netsuite/records/invoice_item_list_spec.rb +4 -4
- data/spec/netsuite/records/invoice_item_spec.rb +11 -11
- data/spec/netsuite/records/invoice_spec.rb +32 -32
- data/spec/netsuite/records/item_fulfillment_package_list_spec.rb +2 -2
- data/spec/netsuite/records/job_spec.rb +31 -31
- data/spec/netsuite/records/journal_entry_line_list_spec.rb +2 -2
- data/spec/netsuite/records/journal_entry_line_spec.rb +7 -7
- data/spec/netsuite/records/journal_entry_spec.rb +25 -25
- data/spec/netsuite/records/location_spec.rb +8 -8
- data/spec/netsuite/records/non_inventory_sale_item_spec.rb +20 -20
- data/spec/netsuite/records/payment_method_spec.rb +8 -8
- data/spec/netsuite/records/phone_call_spec.rb +2 -2
- data/spec/netsuite/records/pomo_code_spec.rb +7 -7
- data/spec/netsuite/records/record_ref_spec.rb +12 -12
- data/spec/netsuite/records/rev_rec_template_spec.rb +7 -7
- data/spec/netsuite/records/sales_order_item_list_spec.rb +2 -2
- data/spec/netsuite/records/sales_order_item_spec.rb +2 -2
- data/spec/netsuite/records/sales_order_spec.rb +23 -23
- data/spec/netsuite/records/sales_tax_item_spec.rb +2 -2
- data/spec/netsuite/records/service_sale_item_spec.rb +20 -20
- data/spec/netsuite/records/ship_address_spec.rb +3 -3
- data/spec/netsuite/records/site_category_spec.rb +8 -8
- data/spec/netsuite/records/subsidiary_spec.rb +2 -2
- data/spec/netsuite/records/support_case_spec.rb +25 -25
- data/spec/netsuite/records/tax_type_spec.rb +1 -1
- data/spec/netsuite/records/term_spec.rb +15 -15
- data/spec/netsuite/records/units_type_spec.rb +4 -4
- data/spec/netsuite/records/units_type_uom_list_spec.rb +4 -4
- data/spec/netsuite/records/units_type_uom_spec.rb +1 -1
- data/spec/netsuite/records/work_order_item_list_spec.rb +2 -2
- data/spec/netsuite/records/work_order_item_spec.rb +4 -4
- data/spec/netsuite/records/work_order_spec.rb +13 -13
- data/spec/netsuite/response_spec.rb +4 -4
- data/spec/netsuite/support/fields_spec.rb +6 -6
- data/spec/netsuite/support/record_refs_spec.rb +1 -1
- data/spec/netsuite/support/records_spec.rb +2 -2
- data/spec/netsuite/support/requests_spec.rb +6 -6
- data/spec/netsuite_spec.rb +4 -4
- data/spec/spec_helper.rb +0 -2
- data/spec/support/read_only_field_matcher.rb +1 -1
- data/spec/support/record_ref_matcher.rb +2 -2
- metadata +4 -4
data/README.md
CHANGED
@@ -86,7 +86,7 @@ customer_support_reps = [12345, 12346]
|
|
86
86
|
|
87
87
|
task = NetSuite::Records::Task.new(
|
88
88
|
:title => 'Take Care of a Customer',
|
89
|
-
:assigned => NetSuite::Records::RecordRef.new(customer_support_reps.sample),
|
89
|
+
:assigned => NetSuite::Records::RecordRef.new(internal_id: customer_support_reps.sample),
|
90
90
|
:due_date => DateTime.now + 1,
|
91
91
|
:message => "Take care of this"
|
92
92
|
)
|
data/lib/netsuite.rb
CHANGED
@@ -91,7 +91,6 @@ module NetSuite
|
|
91
91
|
autoload :Customer, 'netsuite/records/customer'
|
92
92
|
autoload :CustomerAddressbook, 'netsuite/records/customer_addressbook'
|
93
93
|
autoload :CustomerAddressbookList, 'netsuite/records/customer_addressbook_list'
|
94
|
-
autoload :CustomerCategory, 'netsuite/records/customer_category'
|
95
94
|
autoload :CustomerDeposit, 'netsuite/records/customer_deposit'
|
96
95
|
autoload :CustomerPayment, 'netsuite/records/customer_payment'
|
97
96
|
autoload :CustomerPaymentApply, 'netsuite/records/customer_payment_apply'
|
@@ -124,6 +124,11 @@ module NetSuite
|
|
124
124
|
}
|
125
125
|
}
|
126
126
|
|
127
|
+
# https://github.com/NetSweet/netsuite/commit/54d7b011d9485dad33504135dfe8153c86cae9a0#commitcomment-8443976
|
128
|
+
if NetSuite::Configuration.api_version < "2013_2"
|
129
|
+
h[element_name][:attributes!]['platformCore:customField']['internalId'] = h[element_name][:attributes!]['platformCore:customField'].delete('scriptId')
|
130
|
+
end
|
131
|
+
|
127
132
|
# === END CUSTOM FIELD
|
128
133
|
else
|
129
134
|
if condition[:value].is_a?(Array) && condition[:value].first.respond_to?(:to_record)
|
@@ -1,9 +1,7 @@
|
|
1
1
|
module NetSuite
|
2
2
|
module Records
|
3
|
-
class File
|
4
|
-
include Support::Fields
|
3
|
+
class File < NetSuite::Support::Base
|
5
4
|
include Support::RecordRefs
|
6
|
-
include Support::Records
|
7
5
|
include Support::Actions
|
8
6
|
include Namespaces::FileCabinet
|
9
7
|
|
@@ -17,11 +15,8 @@ module NetSuite
|
|
17
15
|
|
18
16
|
read_only_fields :url
|
19
17
|
|
20
|
-
|
21
|
-
|
22
|
-
@external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
|
23
|
-
initialize_from_attributes_hash(attributes)
|
24
|
-
end
|
18
|
+
attr_reader :internal_id
|
19
|
+
attr_accessor :external_id
|
25
20
|
end
|
26
21
|
end
|
27
22
|
end
|
@@ -252,8 +252,8 @@ module NetSuite
|
|
252
252
|
'ZW' => '_zimbabwe'
|
253
253
|
}
|
254
254
|
|
255
|
-
def initialize(iso_or_name)
|
256
|
-
if iso_or_name =~
|
255
|
+
def initialize(iso_or_name = '')
|
256
|
+
if iso_or_name =~ /^[A-Z]{2}/
|
257
257
|
@id = ISO_TO_NETSUITE.fetch(iso_or_name)
|
258
258
|
else
|
259
259
|
@id = iso_or_name
|
data/lib/netsuite/version.rb
CHANGED
data/netsuite.gemspec
CHANGED
@@ -27,8 +27,8 @@ describe NetSuite::Actions::Add do
|
|
27
27
|
|
28
28
|
it 'returns a valid Response object' do
|
29
29
|
response = NetSuite::Actions::Add.call([customer])
|
30
|
-
response.
|
31
|
-
response.
|
30
|
+
expect(response).to be_kind_of(NetSuite::Response)
|
31
|
+
expect(response).to be_success
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -55,8 +55,8 @@ describe NetSuite::Actions::Add do
|
|
55
55
|
|
56
56
|
it 'returns a valid Response object' do
|
57
57
|
response = NetSuite::Actions::Add.call([invoice])
|
58
|
-
response.
|
59
|
-
response.
|
58
|
+
expect(response).to be_kind_of(NetSuite::Response)
|
59
|
+
expect(response).to be_success
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -76,15 +76,15 @@ describe NetSuite::Actions::Add do
|
|
76
76
|
invoice.add
|
77
77
|
error = invoice.errors.first
|
78
78
|
|
79
|
-
error.
|
80
|
-
error.type.
|
81
|
-
error.code.
|
82
|
-
error.message.
|
79
|
+
expect(error).to be_kind_of(NetSuite::Error)
|
80
|
+
expect(error.type).to eq('ERROR')
|
81
|
+
expect(error.code).to eq('INVALID_INITIALIZE_REF')
|
82
|
+
expect(error.message).to eq('You can not initialize invoice: invalid reference 7281.')
|
83
83
|
end
|
84
84
|
|
85
85
|
it 'provides an error method on the response' do
|
86
86
|
response = NetSuite::Actions::Add.call([invoice])
|
87
|
-
response.errors.first.
|
87
|
+
expect(response.errors.first).to be_kind_of(NetSuite::Error)
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -102,14 +102,14 @@ describe NetSuite::Actions::Add do
|
|
102
102
|
|
103
103
|
it 'provides an error method on the object with details about the error' do
|
104
104
|
invoice.add
|
105
|
-
invoice.errors.length.
|
105
|
+
expect(invoice.errors.length).to eq(2)
|
106
106
|
|
107
107
|
error = invoice.errors.first
|
108
108
|
|
109
|
-
error.
|
110
|
-
error.type.
|
111
|
-
error.code.
|
112
|
-
error.message.
|
109
|
+
expect(error).to be_kind_of(NetSuite::Error)
|
110
|
+
expect(error.type).to eq('ERROR')
|
111
|
+
expect(error.code).to eq('ERROR')
|
112
|
+
expect(error.message).to eq('Some message')
|
113
113
|
end
|
114
114
|
end
|
115
115
|
end
|
@@ -25,8 +25,8 @@ describe NetSuite::Actions::Delete do
|
|
25
25
|
|
26
26
|
it 'returns a valid Response object' do
|
27
27
|
response = NetSuite::Actions::Delete.call([customer])
|
28
|
-
response.
|
29
|
-
response.
|
28
|
+
expect(response).to be_kind_of(NetSuite::Response)
|
29
|
+
expect(response).to be_success
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -24,7 +24,7 @@ describe NetSuite::Actions::Get do
|
|
24
24
|
|
25
25
|
it 'returns a valid Response object' do
|
26
26
|
response = NetSuite::Actions::Get.call([NetSuite::Records::Customer, :external_id => 1])
|
27
|
-
response.
|
27
|
+
expect(response).to be_kind_of(NetSuite::Response)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -43,7 +43,7 @@ describe NetSuite::Actions::Get do
|
|
43
43
|
|
44
44
|
it "makes a valid request to the NetSuite API" do
|
45
45
|
customer = NetSuite::Records::Customer.get(1)
|
46
|
-
customer.balance.
|
46
|
+
expect(customer.balance).to eq('100.0')
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -65,7 +65,7 @@ describe NetSuite::Actions::Get do
|
|
65
65
|
|
66
66
|
it 'returns a valid Response object' do
|
67
67
|
response = NetSuite::Actions::Get.call([NetSuite::Records::Invoice, :external_id => 1])
|
68
|
-
response.
|
68
|
+
expect(response).to be_kind_of(NetSuite::Response)
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -27,8 +27,8 @@ describe NetSuite::Actions::Initialize do
|
|
27
27
|
|
28
28
|
it 'returns a valid Response object' do
|
29
29
|
response = NetSuite::Actions::Initialize.call([NetSuite::Records::Customer, customer])
|
30
|
-
response.
|
31
|
-
response.
|
30
|
+
expect(response).to be_kind_of(NetSuite::Response)
|
31
|
+
expect(response).to be_success
|
32
32
|
end
|
33
33
|
|
34
34
|
end
|
@@ -30,8 +30,8 @@ describe NetSuite::Actions::Search do
|
|
30
30
|
|
31
31
|
it "should handle a ID only search" do
|
32
32
|
result = NetSuite::Records::Customer.search(saved: 500)
|
33
|
-
result.results.size.
|
34
|
-
result.results.first.email.
|
33
|
+
expect(result.results.size).to eq(1)
|
34
|
+
expect(result.results.first.email).to eq('aemail@gmail.com')
|
35
35
|
end
|
36
36
|
|
37
37
|
it "merges preferences gracefully" do
|
@@ -81,7 +81,7 @@ describe NetSuite::Actions::Search do
|
|
81
81
|
|
82
82
|
:attributes! => {
|
83
83
|
"platformCore:customField" => {
|
84
|
-
"
|
84
|
+
"internalId" => ["custentity_customerandcontacttypelist", "custentity_relatedthing"],
|
85
85
|
"operator" => ["anyOf", "anyOf"],
|
86
86
|
"xsi:type" => ["platformCore:SearchMultiSelectCustomField", "platformCore:SearchMultiSelectCustomField"]
|
87
87
|
}
|
@@ -137,9 +137,9 @@ describe NetSuite::Actions::Search do
|
|
137
137
|
]
|
138
138
|
})
|
139
139
|
|
140
|
-
search.results.size.
|
141
|
-
search.results.first.alt_name.
|
142
|
-
search.results.last.email.
|
140
|
+
expect(search.results.size).to eq(2)
|
141
|
+
expect(search.results.first.alt_name).to eq('A Awesome Name')
|
142
|
+
expect(search.results.last.email).to eq('alessawesome@gmail.com')
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|
@@ -32,8 +32,8 @@ describe NetSuite::Actions::Update do
|
|
32
32
|
|
33
33
|
it 'returns a valid Response object' do
|
34
34
|
response = NetSuite::Actions::Update.call([NetSuite::Records::Customer, attributes])
|
35
|
-
response.
|
36
|
-
response.
|
35
|
+
expect(response).to be_kind_of(NetSuite::Response)
|
36
|
+
expect(response).to be_success
|
37
37
|
end
|
38
38
|
|
39
39
|
end
|
@@ -48,15 +48,15 @@ describe NetSuite::Actions::Update do
|
|
48
48
|
customer.update(attributes)
|
49
49
|
error = customer.errors.first
|
50
50
|
|
51
|
-
error.
|
52
|
-
error.type.
|
53
|
-
error.code.
|
54
|
-
error.message.
|
51
|
+
expect(error).to be_kind_of(NetSuite::Error)
|
52
|
+
expect(error.type).to eq('ERROR')
|
53
|
+
expect(error.code).to eq('INSUFFICIENT_PERMISSION')
|
54
|
+
expect(error.message).to eq('You do not have permissions to set a value for element addrtext due to one of the following reasons: 1) The field is read-only; 2) An associated feature is disabled; 3) The field is available either when a record is created or updated, but not in both cases.')
|
55
55
|
end
|
56
56
|
|
57
57
|
it 'provides an errors method on the response' do
|
58
58
|
response = NetSuite::Actions::Update.call([NetSuite::Records::Customer, attributes])
|
59
|
-
response.errors.first.
|
59
|
+
expect(response.errors.first).to be_kind_of(NetSuite::Error)
|
60
60
|
end
|
61
61
|
|
62
62
|
end
|
@@ -69,19 +69,19 @@ describe NetSuite::Actions::Update do
|
|
69
69
|
|
70
70
|
it 'provides an errors method on the object with details about the errors' do
|
71
71
|
customer.update(attributes)
|
72
|
-
customer.errors.length.
|
72
|
+
expect(customer.errors.length).to eq(2)
|
73
73
|
|
74
74
|
first_error = customer.errors.first
|
75
|
-
first_error.
|
76
|
-
first_error.type.
|
77
|
-
first_error.code.
|
78
|
-
first_error.message.
|
75
|
+
expect(first_error).to be_kind_of(NetSuite::Error)
|
76
|
+
expect(first_error.type).to eq('ERROR')
|
77
|
+
expect(first_error.code).to eq('First error code')
|
78
|
+
expect(first_error.message).to eq('First error message')
|
79
79
|
|
80
80
|
second_error = customer.errors.last
|
81
|
-
second_error.
|
82
|
-
second_error.type.
|
83
|
-
second_error.code.
|
84
|
-
second_error.message.
|
81
|
+
expect(second_error).to be_kind_of(NetSuite::Error)
|
82
|
+
expect(second_error.type).to eq('WARNING')
|
83
|
+
expect(second_error.code).to eq('Second error code')
|
84
|
+
expect(second_error.message).to eq('Second error message')
|
85
85
|
|
86
86
|
end
|
87
87
|
end
|
@@ -30,8 +30,8 @@ describe NetSuite::Actions::UpsertList do
|
|
30
30
|
|
31
31
|
it 'returns a valid Response object' do
|
32
32
|
response = NetSuite::Actions::UpsertList.call(customers)
|
33
|
-
response.
|
34
|
-
response.
|
33
|
+
expect(response).to be_kind_of(NetSuite::Response)
|
34
|
+
expect(response).to be_success
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -68,8 +68,8 @@ describe NetSuite::Actions::UpsertList do
|
|
68
68
|
|
69
69
|
it 'returns a valid Response object' do
|
70
70
|
response = NetSuite::Actions::UpsertList.call(customers)
|
71
|
-
response.
|
72
|
-
response.
|
71
|
+
expect(response).to be_kind_of(NetSuite::Response)
|
72
|
+
expect(response).to be_success
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
@@ -27,8 +27,8 @@ describe NetSuite::Actions::Upsert do
|
|
27
27
|
|
28
28
|
it 'returns a valid Response object' do
|
29
29
|
response = NetSuite::Actions::Upsert.call([customer])
|
30
|
-
response.
|
31
|
-
response.
|
30
|
+
expect(response).to be_kind_of(NetSuite::Response)
|
31
|
+
expect(response).to be_success
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -55,8 +55,8 @@ describe NetSuite::Actions::Upsert do
|
|
55
55
|
|
56
56
|
it 'returns a valid Response object' do
|
57
57
|
response = NetSuite::Actions::Upsert.call([invoice])
|
58
|
-
response.
|
59
|
-
response.
|
58
|
+
expect(response).to be_kind_of(NetSuite::Response)
|
59
|
+
expect(response).to be_success
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -76,15 +76,15 @@ describe NetSuite::Actions::Upsert do
|
|
76
76
|
invoice.upsert
|
77
77
|
error = invoice.errors.first
|
78
78
|
|
79
|
-
error.
|
80
|
-
error.type.
|
81
|
-
error.code.
|
82
|
-
error.message.
|
79
|
+
expect(error).to be_kind_of(NetSuite::Error)
|
80
|
+
expect(error.type).to eq('ERROR')
|
81
|
+
expect(error.code).to eq('INVALID_KEY_OR_REF')
|
82
|
+
expect(error.message).to eq('The specified key is invalid.')
|
83
83
|
end
|
84
84
|
|
85
85
|
it 'provides an error method on the response' do
|
86
86
|
response = NetSuite::Actions::Upsert.call([invoice])
|
87
|
-
response.errors.first.
|
87
|
+
expect(response.errors.first).to be_kind_of(NetSuite::Error)
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -102,14 +102,14 @@ describe NetSuite::Actions::Upsert do
|
|
102
102
|
|
103
103
|
it 'provides an error method on the object with details about the error' do
|
104
104
|
invoice.upsert
|
105
|
-
invoice.errors.length.
|
105
|
+
expect(invoice.errors.length).to eq(2)
|
106
106
|
|
107
107
|
error = invoice.errors.first
|
108
108
|
|
109
|
-
error.
|
110
|
-
error.type.
|
111
|
-
error.code.
|
112
|
-
error.message.
|
109
|
+
expect(error).to be_kind_of(NetSuite::Error)
|
110
|
+
expect(error.type).to eq('ERROR')
|
111
|
+
expect(error.code).to eq('ERROR')
|
112
|
+
expect(error.message).to eq('Some message')
|
113
113
|
end
|
114
114
|
end
|
115
115
|
end
|
@@ -10,9 +10,9 @@ describe NetSuite::Configuration do
|
|
10
10
|
describe '#reset!' do
|
11
11
|
it 'clears the attributes hash' do
|
12
12
|
config.attributes[:blah] = 'something'
|
13
|
-
config.attributes.
|
13
|
+
expect(config.attributes).not_to be_empty
|
14
14
|
config.reset!
|
15
|
-
config.attributes.
|
15
|
+
expect(config.attributes).to be_empty
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -23,7 +23,7 @@ describe NetSuite::Configuration do
|
|
23
23
|
config.password 'me@example.com'
|
24
24
|
config.account 1023
|
25
25
|
|
26
|
-
config.connection.
|
26
|
+
expect(config.connection).to be_kind_of(Savon::Client)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -34,13 +34,13 @@ describe NetSuite::Configuration do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'returns a path to the WSDL to use for the API' do
|
37
|
-
config.wsdl.
|
37
|
+
expect(config.wsdl).to eql('https://system.sandbox.netsuite.com/wsdl/v2011_2_0/netsuite.wsdl')
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
context 'when the wsdl has not been set' do
|
42
42
|
it 'returns a path to the WSDL to use for the API' do
|
43
|
-
config.wsdl.
|
43
|
+
expect(config.wsdl).to match(/.*\/netsuite\/wsdl\/2011_2\.wsdl/)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -48,7 +48,7 @@ describe NetSuite::Configuration do
|
|
48
48
|
it 'should correctly return the full HTTP sandbox URL' do
|
49
49
|
config.api_version '2013_1'
|
50
50
|
config.sandbox false
|
51
|
-
config.wsdl.
|
51
|
+
expect(config.wsdl).to eql('https://webservices.netsuite.com/wsdl/v2013_1_0/netsuite.wsdl')
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
@@ -61,7 +61,7 @@ describe NetSuite::Configuration do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'returns a hash representation of the authentication header' do
|
64
|
-
config.auth_header.
|
64
|
+
expect(config.auth_header).to eql({
|
65
65
|
'platformMsgs:passport' => {
|
66
66
|
'platformCore:email' => 'user@example.com',
|
67
67
|
'platformCore:password' => 'myPassword',
|
@@ -85,7 +85,7 @@ describe NetSuite::Configuration do
|
|
85
85
|
'platformMsgs:ignoreReadOnlyFields' => true,
|
86
86
|
}
|
87
87
|
}
|
88
|
-
config.soap_header.
|
88
|
+
expect(config.soap_header).to eql({
|
89
89
|
'platformMsgs:preferences' => {
|
90
90
|
'platformMsgs:ignoreReadOnlyFields' => true,
|
91
91
|
}
|
@@ -100,15 +100,15 @@ describe NetSuite::Configuration do
|
|
100
100
|
end
|
101
101
|
|
102
102
|
it 'returns the email' do
|
103
|
-
config.email.
|
103
|
+
expect(config.email).to eql('test@example.com')
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
107
|
context 'when the email has not been set' do
|
108
108
|
it 'raises a ConfigurationError' do
|
109
|
-
|
109
|
+
expect {
|
110
110
|
config.email
|
111
|
-
}.
|
111
|
+
}.to raise_error(NetSuite::ConfigurationError,
|
112
112
|
'#email is a required configuration value. Please set it by calling NetSuite::Configuration.email = "me@example.com"')
|
113
113
|
end
|
114
114
|
end
|
@@ -121,15 +121,15 @@ describe NetSuite::Configuration do
|
|
121
121
|
end
|
122
122
|
|
123
123
|
it 'returns the password' do
|
124
|
-
config.password.
|
124
|
+
expect(config.password).to eql('password')
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
128
|
context 'when the password has not been set' do
|
129
129
|
it 'raises a ConfigurationError' do
|
130
|
-
|
130
|
+
expect {
|
131
131
|
config.password
|
132
|
-
}.
|
132
|
+
}.to raise_error(NetSuite::ConfigurationError,
|
133
133
|
'#password is a required configuration value. Please set it by calling NetSuite::Configuration.password = "my_pass"')
|
134
134
|
end
|
135
135
|
end
|
@@ -142,15 +142,15 @@ describe NetSuite::Configuration do
|
|
142
142
|
end
|
143
143
|
|
144
144
|
it 'returns the account' do
|
145
|
-
config.account.
|
145
|
+
expect(config.account).to eql(4321)
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
149
|
context 'when the account has not been set' do
|
150
150
|
it 'raises a ConfigurationError' do
|
151
|
-
|
151
|
+
expect {
|
152
152
|
config.account
|
153
|
-
}.
|
153
|
+
}.to raise_error(NetSuite::ConfigurationError,
|
154
154
|
'#account is a required configuration value. Please set it by calling NetSuite::Configuration.account = 1234')
|
155
155
|
end
|
156
156
|
end
|
@@ -160,7 +160,7 @@ describe NetSuite::Configuration do
|
|
160
160
|
describe '#role' do
|
161
161
|
context 'when no role is defined' do
|
162
162
|
it 'defaults to "3"' do
|
163
|
-
config.role.
|
163
|
+
expect(config.role).to eq("3")
|
164
164
|
end
|
165
165
|
end
|
166
166
|
end
|
@@ -168,14 +168,14 @@ describe NetSuite::Configuration do
|
|
168
168
|
describe '#role=' do
|
169
169
|
it 'sets the role according to the input value' do
|
170
170
|
config.role = "6"
|
171
|
-
config.role.
|
171
|
+
expect(config.role).to eq("6")
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
175
175
|
describe '#api_version' do
|
176
176
|
context 'when no api_version is defined' do
|
177
177
|
it 'defaults to 2011_2' do
|
178
|
-
config.api_version.
|
178
|
+
expect(config.api_version).to eq('2011_2')
|
179
179
|
end
|
180
180
|
end
|
181
181
|
end
|
@@ -184,7 +184,7 @@ describe NetSuite::Configuration do
|
|
184
184
|
context 'when api version is defined' do
|
185
185
|
it 'sets the api_version of the application' do
|
186
186
|
config.api_version = '2012_1'
|
187
|
-
config.api_version.
|
187
|
+
expect(config.api_version).to eq('2012_1')
|
188
188
|
end
|
189
189
|
end
|
190
190
|
end
|