netsuite 0.3.0 → 0.3.1
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.
- 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
|
@@ -11,7 +11,7 @@ describe NetSuite::Records::CustomRecordType do
|
|
|
11
11
|
:record_name, :script_id, :show_creation_date, :show_creation_date_on_list, :show_id, :show_last_modified,
|
|
12
12
|
:show_last_modified_on_list, :show_notes, :show_owner, :show_owner_allow_change, :show_owner_on_list, :use_permissions
|
|
13
13
|
].each do |field|
|
|
14
|
-
record_type.
|
|
14
|
+
expect(record_type).to have_field(field)
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ describe NetSuite::Records::CustomRecordType do
|
|
|
19
19
|
[
|
|
20
20
|
:owner
|
|
21
21
|
].each do |record_ref|
|
|
22
|
-
record_type.
|
|
22
|
+
expect(record_type).to have_record_ref(record_ref)
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
@@ -83,12 +83,12 @@ describe NetSuite::Records::CustomRecordType do
|
|
|
83
83
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :allow_attachments => true }) }
|
|
84
84
|
|
|
85
85
|
it 'returns a Customer instance populated with the data from the response object' do
|
|
86
|
-
NetSuite::Actions::Get.
|
|
86
|
+
expect(NetSuite::Actions::Get).to receive(:call).
|
|
87
87
|
with([NetSuite::Records::CustomRecordType, :external_id => 1], {}).
|
|
88
88
|
and_return(response)
|
|
89
89
|
record_type = NetSuite::Records::CustomRecordType.get(:external_id => 1)
|
|
90
|
-
record_type.
|
|
91
|
-
record_type.allow_attachments.
|
|
90
|
+
expect(record_type).to be_kind_of(NetSuite::Records::CustomRecordType)
|
|
91
|
+
expect(record_type.allow_attachments).to be_truthy
|
|
92
92
|
end
|
|
93
93
|
end
|
|
94
94
|
|
|
@@ -96,12 +96,12 @@ describe NetSuite::Records::CustomRecordType do
|
|
|
96
96
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
97
97
|
|
|
98
98
|
it 'raises a RecordNotFound exception' do
|
|
99
|
-
NetSuite::Actions::Get.
|
|
99
|
+
expect(NetSuite::Actions::Get).to receive(:call).
|
|
100
100
|
with([NetSuite::Records::CustomRecordType, :external_id => 1], {}).
|
|
101
101
|
and_return(response)
|
|
102
|
-
|
|
102
|
+
expect {
|
|
103
103
|
NetSuite::Records::CustomRecordType.get(:external_id => 1)
|
|
104
|
-
}.
|
|
104
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
|
105
105
|
/NetSuite::Records::CustomRecordType with OPTIONS=(.*) could not be found/)
|
|
106
106
|
end
|
|
107
107
|
end
|
|
@@ -112,10 +112,10 @@ describe NetSuite::Records::CustomRecordType do
|
|
|
112
112
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
|
113
113
|
|
|
114
114
|
it 'returns true' do
|
|
115
|
-
NetSuite::Actions::Add.
|
|
115
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
116
116
|
with([record_type], {}).
|
|
117
117
|
and_return(response)
|
|
118
|
-
record_type.add.
|
|
118
|
+
expect(record_type.add).to be_truthy
|
|
119
119
|
end
|
|
120
120
|
end
|
|
121
121
|
|
|
@@ -123,10 +123,10 @@ describe NetSuite::Records::CustomRecordType do
|
|
|
123
123
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
124
124
|
|
|
125
125
|
it 'returns false' do
|
|
126
|
-
NetSuite::Actions::Add.
|
|
126
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
127
127
|
with([record_type], {}).
|
|
128
128
|
and_return(response)
|
|
129
|
-
record_type.add.
|
|
129
|
+
expect(record_type.add).to be_falsey
|
|
130
130
|
end
|
|
131
131
|
end
|
|
132
132
|
end
|
|
@@ -136,10 +136,10 @@ describe NetSuite::Records::CustomRecordType do
|
|
|
136
136
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
|
137
137
|
|
|
138
138
|
it 'returns true' do
|
|
139
|
-
NetSuite::Actions::Delete.
|
|
139
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
140
140
|
with([record_type], {}).
|
|
141
141
|
and_return(response)
|
|
142
|
-
record_type.delete.
|
|
142
|
+
expect(record_type.delete).to be_truthy
|
|
143
143
|
end
|
|
144
144
|
end
|
|
145
145
|
|
|
@@ -147,10 +147,10 @@ describe NetSuite::Records::CustomRecordType do
|
|
|
147
147
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
148
148
|
|
|
149
149
|
it 'returns false' do
|
|
150
|
-
NetSuite::Actions::Delete.
|
|
150
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
151
151
|
with([record_type], {}).
|
|
152
152
|
and_return(response)
|
|
153
|
-
record_type.delete.
|
|
153
|
+
expect(record_type.delete).to be_falsey
|
|
154
154
|
end
|
|
155
155
|
end
|
|
156
156
|
end
|
|
@@ -4,7 +4,7 @@ describe NetSuite::Records::CustomerAddressbookList do
|
|
|
4
4
|
let(:list) { NetSuite::Records::CustomerAddressbookList.new }
|
|
5
5
|
|
|
6
6
|
it 'has an addressbooks attribute' do
|
|
7
|
-
list.addressbooks.
|
|
7
|
+
expect(list.addressbooks).to be_kind_of(Array)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
describe '#to_record' do
|
|
@@ -13,7 +13,7 @@ describe NetSuite::Records::CustomerAddressbookList do
|
|
|
13
13
|
'listRel:addressbook' => [],
|
|
14
14
|
'listRel:replaceAll' => true
|
|
15
15
|
}
|
|
16
|
-
list.to_record.
|
|
16
|
+
expect(list.to_record).to eql(record)
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
@@ -26,7 +26,7 @@ describe NetSuite::Records::CustomerAddressbook do
|
|
|
26
26
|
:default_shipping, :default_billing, :is_residential, :label, :attention, :addressee,
|
|
27
27
|
:phone, :addr1, :addr2, :addr3, :city, :zip, :addr_text, :override, :state
|
|
28
28
|
].each do |field|
|
|
29
|
-
list.
|
|
29
|
+
expect(list).to have_field(field)
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
|
|
@@ -34,25 +34,25 @@ describe NetSuite::Records::CustomerAddressbook do
|
|
|
34
34
|
[
|
|
35
35
|
:addr_text
|
|
36
36
|
].each do |field|
|
|
37
|
-
NetSuite::Records::CustomerAddressbook.
|
|
37
|
+
expect(NetSuite::Records::CustomerAddressbook).to have_read_only_field(field)
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
describe '#initialize' do
|
|
42
42
|
context 'when taking in a hash of attributes' do
|
|
43
43
|
it 'sets the attributes for the object given the attributes hash' do
|
|
44
|
-
list.addr1.
|
|
45
|
-
list.addr_text.
|
|
46
|
-
list.city.
|
|
47
|
-
list.country.to_record.
|
|
48
|
-
list.default_billing.
|
|
49
|
-
list.default_shipping.
|
|
50
|
-
list.is_residential.
|
|
51
|
-
list.label.
|
|
52
|
-
list.override.
|
|
53
|
-
list.state.
|
|
54
|
-
list.zip.
|
|
55
|
-
list.internal_id.
|
|
44
|
+
expect(list.addr1).to eql('123 Happy Lane')
|
|
45
|
+
expect(list.addr_text).to eql("123 Happy Lane\nLos Angeles CA 90007")
|
|
46
|
+
expect(list.city).to eql('Los Angeles')
|
|
47
|
+
expect(list.country.to_record).to eql('_unitedStates')
|
|
48
|
+
expect(list.default_billing).to be_truthy
|
|
49
|
+
expect(list.default_shipping).to be_truthy
|
|
50
|
+
expect(list.is_residential).to be_falsey
|
|
51
|
+
expect(list.label).to eql('123 Happy Lane')
|
|
52
|
+
expect(list.override).to be_falsey
|
|
53
|
+
expect(list.state).to eql('CA')
|
|
54
|
+
expect(list.zip).to eql('90007')
|
|
55
|
+
expect(list.internal_id).to eql('567')
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
|
|
@@ -60,18 +60,18 @@ describe NetSuite::Records::CustomerAddressbook do
|
|
|
60
60
|
it 'sets the attributes for the object given the record attributes' do
|
|
61
61
|
old_list = NetSuite::Records::CustomerAddressbook.new(attributes)
|
|
62
62
|
list = NetSuite::Records::CustomerAddressbook.new(old_list)
|
|
63
|
-
list.addr1.
|
|
64
|
-
list.addr_text.
|
|
65
|
-
list.city.
|
|
66
|
-
list.country.to_record.
|
|
67
|
-
list.default_billing.
|
|
68
|
-
list.default_shipping.
|
|
69
|
-
list.is_residential.
|
|
70
|
-
list.label.
|
|
71
|
-
list.override.
|
|
72
|
-
list.state.
|
|
73
|
-
list.zip.
|
|
74
|
-
list.internal_id.
|
|
63
|
+
expect(list.addr1).to eql('123 Happy Lane')
|
|
64
|
+
expect(list.addr_text).to eql("123 Happy Lane\nLos Angeles CA 90007")
|
|
65
|
+
expect(list.city).to eql('Los Angeles')
|
|
66
|
+
expect(list.country.to_record).to eql('_unitedStates')
|
|
67
|
+
expect(list.default_billing).to be_truthy
|
|
68
|
+
expect(list.default_shipping).to be_truthy
|
|
69
|
+
expect(list.is_residential).to be_falsey
|
|
70
|
+
expect(list.label).to eql('123 Happy Lane')
|
|
71
|
+
expect(list.override).to be_falsey
|
|
72
|
+
expect(list.state).to eql('CA')
|
|
73
|
+
expect(list.zip).to eql('90007')
|
|
74
|
+
expect(list.internal_id).to eql('567')
|
|
75
75
|
end
|
|
76
76
|
end
|
|
77
77
|
end
|
|
@@ -91,7 +91,7 @@ describe NetSuite::Records::CustomerAddressbook do
|
|
|
91
91
|
'listRel:zip' => '90007',
|
|
92
92
|
"listRel:internalId" => "567"
|
|
93
93
|
}
|
|
94
|
-
list.to_record.
|
|
94
|
+
expect(list.to_record).to eql(record)
|
|
95
95
|
end
|
|
96
96
|
end
|
|
97
97
|
|
|
@@ -113,12 +113,22 @@ describe NetSuite::Records::CustomerAddressbook do
|
|
|
113
113
|
it "can be specified as the NetSuite enum value" do
|
|
114
114
|
addressbook = NetSuite::Records::CustomerAddressbook.new country: "_unitedStates"
|
|
115
115
|
addressbook.to_record["listRel:country"].should eql "_unitedStates"
|
|
116
|
+
|
|
117
|
+
# country with two uppercase letters (looks like ISO2)
|
|
118
|
+
addressbook = NetSuite::Records::CustomerAddressbook.new country: "_unitedKingdomGB"
|
|
119
|
+
addressbook.to_record["listRel:country"].should eql "_unitedKingdomGB"
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
it "can be unspecified" do
|
|
123
|
+
addressbook = NetSuite::Records::CustomerAddressbook.new country: ''
|
|
124
|
+
addressbook.country.to_record.should eql ""
|
|
125
|
+
addressbook.to_record["listRel:country"].should eql ""
|
|
116
126
|
end
|
|
117
127
|
end
|
|
118
128
|
|
|
119
129
|
describe '#record_type' do
|
|
120
130
|
it 'returns a string of the record SOAP type' do
|
|
121
|
-
list.record_type.
|
|
131
|
+
expect(list.record_type).to eql('listRel:CustomerAddressbook')
|
|
122
132
|
end
|
|
123
133
|
end
|
|
124
134
|
|
|
@@ -12,7 +12,7 @@ describe NetSuite::Records::CustomerPayment do
|
|
|
12
12
|
:created_date, :currency_name, :debit_card_issue_no, :exchange_rate, :ignore_avs, :last_modified_date, :memo, :payment,
|
|
13
13
|
:pending, :pn_ref_num, :status, :three_d_status_code, :total, :tran_date, :unapplied, :undep_funds, :valid_from
|
|
14
14
|
].each do |field|
|
|
15
|
-
payment.
|
|
15
|
+
expect(payment).to have_field(field)
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ describe NetSuite::Records::CustomerPayment do
|
|
|
20
20
|
[
|
|
21
21
|
:account, :ar_acct, :credit_card, :credit_card_processor, :custom_form, :customer, :department, :klass, :location, :payment_method, :posting_period, :subsidiary
|
|
22
22
|
].each do |record_ref|
|
|
23
|
-
payment.
|
|
23
|
+
expect(payment).to have_record_ref(record_ref)
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -33,14 +33,14 @@ describe NetSuite::Records::CustomerPayment do
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
payment.custom_field_list = attributes
|
|
36
|
-
payment.custom_field_list.
|
|
37
|
-
payment.custom_field_list.custom_fields.length.
|
|
36
|
+
expect(payment.custom_field_list).to be_kind_of(NetSuite::Records::CustomFieldList)
|
|
37
|
+
expect(payment.custom_field_list.custom_fields.length).to eql(1)
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
it 'can be set from a CustomFieldList object' do
|
|
41
41
|
custom_field_list = NetSuite::Records::CustomFieldList.new
|
|
42
42
|
payment.custom_field_list = custom_field_list
|
|
43
|
-
payment.custom_field_list.
|
|
43
|
+
expect(payment.custom_field_list).to eql(custom_field_list)
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
@@ -64,10 +64,10 @@ describe NetSuite::Records::CustomerPayment do
|
|
|
64
64
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :memo => 'This is a memo' }) }
|
|
65
65
|
|
|
66
66
|
it 'returns an CustomerPayment instance populated with the data from the response object' do
|
|
67
|
-
NetSuite::Actions::Get.
|
|
67
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::CustomerPayment, {:external_id => 7}], {}).and_return(response)
|
|
68
68
|
payment = NetSuite::Records::CustomerPayment.get(:external_id => 7)
|
|
69
|
-
payment.
|
|
70
|
-
payment.memo.
|
|
69
|
+
expect(payment).to be_kind_of(NetSuite::Records::CustomerPayment)
|
|
70
|
+
expect(payment.memo).to eql('This is a memo')
|
|
71
71
|
end
|
|
72
72
|
end
|
|
73
73
|
|
|
@@ -75,10 +75,10 @@ describe NetSuite::Records::CustomerPayment do
|
|
|
75
75
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
76
76
|
|
|
77
77
|
it 'raises a RecordNotFound exception' do
|
|
78
|
-
NetSuite::Actions::Get.
|
|
79
|
-
|
|
78
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::CustomerPayment, {:external_id => 8}], {}).and_return(response)
|
|
79
|
+
expect {
|
|
80
80
|
NetSuite::Records::CustomerPayment.get(:external_id => 8)
|
|
81
|
-
}.
|
|
81
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
|
82
82
|
/NetSuite::Records::CustomerPayment with OPTIONS=(.*) could not be found/)
|
|
83
83
|
end
|
|
84
84
|
end
|
|
@@ -87,9 +87,9 @@ describe NetSuite::Records::CustomerPayment do
|
|
|
87
87
|
describe '.initialize' do
|
|
88
88
|
context 'when the request is successful' do
|
|
89
89
|
it 'returns an initialized invoice from the customer entity' do
|
|
90
|
-
NetSuite::Actions::Initialize.
|
|
90
|
+
expect(NetSuite::Actions::Initialize).to receive(:call).with([NetSuite::Records::CustomerPayment, invoice], {}).and_return(response)
|
|
91
91
|
payment = NetSuite::Records::CustomerPayment.initialize(invoice)
|
|
92
|
-
payment.
|
|
92
|
+
expect(payment).to be_kind_of(NetSuite::Records::CustomerPayment)
|
|
93
93
|
end
|
|
94
94
|
end
|
|
95
95
|
|
|
@@ -106,10 +106,10 @@ describe NetSuite::Records::CustomerPayment do
|
|
|
106
106
|
|
|
107
107
|
it 'returns true' do
|
|
108
108
|
payment = NetSuite::Records::CustomerPayment.new(test_data)
|
|
109
|
-
NetSuite::Actions::Add.
|
|
109
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
110
110
|
with([payment], {}).
|
|
111
111
|
and_return(response)
|
|
112
|
-
payment.add.
|
|
112
|
+
expect(payment.add).to be_truthy
|
|
113
113
|
end
|
|
114
114
|
end
|
|
115
115
|
|
|
@@ -118,10 +118,10 @@ describe NetSuite::Records::CustomerPayment do
|
|
|
118
118
|
|
|
119
119
|
it 'returns false' do
|
|
120
120
|
payment = NetSuite::Records::CustomerPayment.new(test_data)
|
|
121
|
-
NetSuite::Actions::Add.
|
|
121
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
122
122
|
with([payment], {}).
|
|
123
123
|
and_return(response)
|
|
124
|
-
payment.add.
|
|
124
|
+
expect(payment.add).to be_falsey
|
|
125
125
|
end
|
|
126
126
|
end
|
|
127
127
|
end
|
|
@@ -131,10 +131,10 @@ describe NetSuite::Records::CustomerPayment do
|
|
|
131
131
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
|
132
132
|
|
|
133
133
|
it 'returns true' do
|
|
134
|
-
NetSuite::Actions::Delete.
|
|
134
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
135
135
|
with([payment], {}).
|
|
136
136
|
and_return(response)
|
|
137
|
-
payment.delete.
|
|
137
|
+
expect(payment.delete).to be_truthy
|
|
138
138
|
end
|
|
139
139
|
end
|
|
140
140
|
|
|
@@ -142,10 +142,10 @@ describe NetSuite::Records::CustomerPayment do
|
|
|
142
142
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
143
143
|
|
|
144
144
|
it 'returns false' do
|
|
145
|
-
NetSuite::Actions::Delete.
|
|
145
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
146
146
|
with([payment], {}).
|
|
147
147
|
and_return(response)
|
|
148
|
-
payment.delete.
|
|
148
|
+
expect(payment.delete).to be_falsey
|
|
149
149
|
end
|
|
150
150
|
end
|
|
151
151
|
end
|
|
@@ -160,13 +160,13 @@ describe NetSuite::Records::CustomerPayment do
|
|
|
160
160
|
'tranCust:ccName' => 'Ryan Moran',
|
|
161
161
|
'tranCust:ccNumber' => '1234567890123456'
|
|
162
162
|
}
|
|
163
|
-
payment.to_record.
|
|
163
|
+
expect(payment.to_record).to eql(record)
|
|
164
164
|
end
|
|
165
165
|
end
|
|
166
166
|
|
|
167
167
|
describe '#record_type' do
|
|
168
168
|
it 'returns a string representation of the SOAP type' do
|
|
169
|
-
payment.record_type.
|
|
169
|
+
expect(payment.record_type).to eql('tranCust:CustomerPayment')
|
|
170
170
|
end
|
|
171
171
|
end
|
|
172
172
|
|
|
@@ -4,7 +4,7 @@ describe NetSuite::Records::CustomerRefundApplyList do
|
|
|
4
4
|
let(:list) { NetSuite::Records::CustomerRefundApplyList.new }
|
|
5
5
|
|
|
6
6
|
it 'has a applies attribute' do
|
|
7
|
-
list.applies.
|
|
7
|
+
expect(list.applies).to be_kind_of(Array)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
describe '#to_record' do
|
|
@@ -20,7 +20,7 @@ describe NetSuite::Records::CustomerRefundApplyList do
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
]
|
|
23
|
-
list.to_record.
|
|
23
|
+
expect(list.to_record).to eql(record)
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -4,7 +4,7 @@ describe NetSuite::Records::CustomerRefundDepositList do
|
|
|
4
4
|
let(:list) { NetSuite::Records::CustomerRefundDepositList.new }
|
|
5
5
|
|
|
6
6
|
it 'has a deposits attribute' do
|
|
7
|
-
list.deposits.
|
|
7
|
+
expect(list.deposits).to be_kind_of(Array)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
describe '#to_record' do
|
|
@@ -18,7 +18,7 @@ describe NetSuite::Records::CustomerRefundDepositList do
|
|
|
18
18
|
'tranCust:apply' => false
|
|
19
19
|
}]
|
|
20
20
|
}
|
|
21
|
-
list.to_record.
|
|
21
|
+
expect(list.to_record).to eql(record)
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -11,7 +11,7 @@ describe NetSuite::Records::CustomerRefund do
|
|
|
11
11
|
:created_date, :currency_name, :debit_card_issue_no, :exchange_rate, :last_modified_date, :memo, :pn_ref_num, :status,
|
|
12
12
|
:to_be_printed, :total, :tran_date, :tran_id, :valid_from
|
|
13
13
|
].each do |field|
|
|
14
|
-
refund.
|
|
14
|
+
expect(refund).to have_field(field)
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
@@ -20,7 +20,7 @@ describe NetSuite::Records::CustomerRefund do
|
|
|
20
20
|
:account, :ar_acct, :credit_card, :credit_card_processor, :custom_form, :customer, :department, :klass, :location,
|
|
21
21
|
:payment_method, :posting_period, :subsidiary, :void_journal
|
|
22
22
|
].each do |record_ref|
|
|
23
|
-
refund.
|
|
23
|
+
expect(refund).to have_record_ref(record_ref)
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -33,14 +33,14 @@ describe NetSuite::Records::CustomerRefund do
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
refund.custom_field_list = attributes
|
|
36
|
-
refund.custom_field_list.
|
|
37
|
-
refund.custom_field_list.custom_fields.length.
|
|
36
|
+
expect(refund.custom_field_list).to be_kind_of(NetSuite::Records::CustomFieldList)
|
|
37
|
+
expect(refund.custom_field_list.custom_fields.length).to eql(1)
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
it 'can be set from a CustomFieldList object' do
|
|
41
41
|
custom_field_list = NetSuite::Records::CustomFieldList.new
|
|
42
42
|
refund.custom_field_list = custom_field_list
|
|
43
|
-
refund.custom_field_list.
|
|
43
|
+
expect(refund.custom_field_list).to eql(custom_field_list)
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
@@ -52,14 +52,14 @@ describe NetSuite::Records::CustomerRefund do
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
refund.apply_list = attributes
|
|
55
|
-
refund.apply_list.
|
|
56
|
-
refund.apply_list.applies.length.
|
|
55
|
+
expect(refund.apply_list).to be_kind_of(NetSuite::Records::CustomerRefundApplyList)
|
|
56
|
+
expect(refund.apply_list.applies.length).to eql(1)
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
it 'can be set from a CustomerRefundApplyList object' do
|
|
60
60
|
apply_list = NetSuite::Records::CustomerRefundApplyList.new
|
|
61
61
|
refund.apply_list = apply_list
|
|
62
|
-
refund.apply_list.
|
|
62
|
+
expect(refund.apply_list).to eql(apply_list)
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
65
|
|
|
@@ -71,14 +71,14 @@ describe NetSuite::Records::CustomerRefund do
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
refund.deposit_list = attributes
|
|
74
|
-
refund.deposit_list.
|
|
75
|
-
refund.deposit_list.deposits.length.
|
|
74
|
+
expect(refund.deposit_list).to be_kind_of(NetSuite::Records::CustomerRefundDepositList)
|
|
75
|
+
expect(refund.deposit_list.deposits.length).to eql(1)
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
it 'can be set from a CustomerRefundDepositList object' do
|
|
79
79
|
deposit_list = NetSuite::Records::CustomerRefundDepositList.new
|
|
80
80
|
refund.deposit_list = deposit_list
|
|
81
|
-
refund.deposit_list.
|
|
81
|
+
expect(refund.deposit_list).to eql(deposit_list)
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
|
|
@@ -87,9 +87,9 @@ describe NetSuite::Records::CustomerRefund do
|
|
|
87
87
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :is_person => true }) }
|
|
88
88
|
|
|
89
89
|
it 'returns an CustomerRefund instance populated with the data from the response object' do
|
|
90
|
-
NetSuite::Actions::Get.
|
|
90
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::CustomerRefund, {:external_id => 10}], {}).and_return(response)
|
|
91
91
|
refund = NetSuite::Records::CustomerRefund.get(:external_id => 10)
|
|
92
|
-
refund.
|
|
92
|
+
expect(refund).to be_kind_of(NetSuite::Records::CustomerRefund)
|
|
93
93
|
end
|
|
94
94
|
end
|
|
95
95
|
|
|
@@ -97,10 +97,10 @@ describe NetSuite::Records::CustomerRefund do
|
|
|
97
97
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
|
98
98
|
|
|
99
99
|
it 'raises a RecordNotFound exception' do
|
|
100
|
-
NetSuite::Actions::Get.
|
|
101
|
-
|
|
100
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::CustomerRefund, {:external_id => 10}], {}).and_return(response)
|
|
101
|
+
expect {
|
|
102
102
|
NetSuite::Records::CustomerRefund.get(:external_id => 10)
|
|
103
|
-
}.
|
|
103
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
|
104
104
|
/NetSuite::Records::CustomerRefund with OPTIONS=(.*) could not be found/)
|
|
105
105
|
end
|
|
106
106
|
end
|
|
@@ -109,9 +109,9 @@ describe NetSuite::Records::CustomerRefund do
|
|
|
109
109
|
describe '.initialize' do
|
|
110
110
|
context 'when the request is successful' do
|
|
111
111
|
it 'returns an initialized invoice from the customer entity' do
|
|
112
|
-
NetSuite::Actions::Initialize.
|
|
112
|
+
expect(NetSuite::Actions::Initialize).to receive(:call).with([NetSuite::Records::CustomerRefund, memo], {}).and_return(response)
|
|
113
113
|
refund = NetSuite::Records::CustomerRefund.initialize(memo)
|
|
114
|
-
refund.
|
|
114
|
+
expect(refund).to be_kind_of(NetSuite::Records::CustomerRefund)
|
|
115
115
|
end
|
|
116
116
|
end
|
|
117
117
|
|
|
@@ -128,10 +128,10 @@ describe NetSuite::Records::CustomerRefund do
|
|
|
128
128
|
|
|
129
129
|
it 'returns true' do
|
|
130
130
|
refund = NetSuite::Records::CustomerRefund.new(test_data)
|
|
131
|
-
NetSuite::Actions::Add.
|
|
131
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
132
132
|
with([refund], {}).
|
|
133
133
|
and_return(response)
|
|
134
|
-
refund.add.
|
|
134
|
+
expect(refund.add).to be_truthy
|
|
135
135
|
end
|
|
136
136
|
end
|
|
137
137
|
|
|
@@ -140,10 +140,10 @@ describe NetSuite::Records::CustomerRefund do
|
|
|
140
140
|
|
|
141
141
|
it 'returns false' do
|
|
142
142
|
refund = NetSuite::Records::CustomerRefund.new(test_data)
|
|
143
|
-
NetSuite::Actions::Add.
|
|
143
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
|
144
144
|
with([refund], {}).
|
|
145
145
|
and_return(response)
|
|
146
|
-
refund.add.
|
|
146
|
+
expect(refund.add).to be_falsey
|
|
147
147
|
end
|
|
148
148
|
end
|
|
149
149
|
end
|
|
@@ -154,10 +154,10 @@ describe NetSuite::Records::CustomerRefund do
|
|
|
154
154
|
|
|
155
155
|
it 'returns true' do
|
|
156
156
|
refund = NetSuite::Records::CustomerRefund.new
|
|
157
|
-
NetSuite::Actions::Delete.
|
|
157
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
158
158
|
with([refund], {}).
|
|
159
159
|
and_return(response)
|
|
160
|
-
refund.delete.
|
|
160
|
+
expect(refund.delete).to be_truthy
|
|
161
161
|
end
|
|
162
162
|
end
|
|
163
163
|
|
|
@@ -166,10 +166,10 @@ describe NetSuite::Records::CustomerRefund do
|
|
|
166
166
|
|
|
167
167
|
it 'returns false' do
|
|
168
168
|
refund = NetSuite::Records::CustomerRefund.new
|
|
169
|
-
NetSuite::Actions::Delete.
|
|
169
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
|
170
170
|
with([refund], {}).
|
|
171
171
|
and_return(response)
|
|
172
|
-
refund.delete.
|
|
172
|
+
expect(refund.delete).to be_falsey
|
|
173
173
|
end
|
|
174
174
|
end
|
|
175
175
|
end
|
|
@@ -184,13 +184,13 @@ describe NetSuite::Records::CustomerRefund do
|
|
|
184
184
|
'tranCust:memo' => 'This is a memo',
|
|
185
185
|
'tranCust:ccZipCode' => '10101'
|
|
186
186
|
}
|
|
187
|
-
refund.to_record.
|
|
187
|
+
expect(refund.to_record).to eql(record)
|
|
188
188
|
end
|
|
189
189
|
end
|
|
190
190
|
|
|
191
191
|
describe '#record_type' do
|
|
192
192
|
it 'returns a string representation of the SOAP type' do
|
|
193
|
-
refund.record_type.
|
|
193
|
+
expect(refund.record_type).to eql('tranCust:CustomerRefund')
|
|
194
194
|
end
|
|
195
195
|
end
|
|
196
196
|
|