netsuite 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +32 -0
- data/lib/netsuite.rb +5 -1
- data/lib/netsuite/actions/add.rb +4 -4
- data/lib/netsuite/actions/delete.rb +7 -7
- data/lib/netsuite/actions/get.rb +5 -5
- data/lib/netsuite/actions/get_list.rb +24 -11
- data/lib/netsuite/actions/get_select_value.rb +5 -5
- data/lib/netsuite/actions/initialize.rb +5 -5
- data/lib/netsuite/actions/login.rb +33 -0
- data/lib/netsuite/actions/search.rb +5 -5
- data/lib/netsuite/actions/update.rb +5 -5
- data/lib/netsuite/actions/upsert.rb +4 -4
- data/lib/netsuite/configuration.rb +9 -9
- data/lib/netsuite/records/account.rb +1 -1
- data/lib/netsuite/records/custom_field_list.rb +2 -0
- data/lib/netsuite/records/custom_record.rb +1 -1
- data/lib/netsuite/records/customer.rb +9 -6
- data/lib/netsuite/records/deposit.rb +2 -2
- data/lib/netsuite/records/deposit_cash_back.rb +42 -0
- data/lib/netsuite/records/deposit_cash_back_list.rb +32 -0
- data/lib/netsuite/records/deposit_other.rb +45 -0
- data/lib/netsuite/records/deposit_other_list.rb +32 -0
- data/lib/netsuite/records/item_fulfillment.rb +7 -1
- data/lib/netsuite/records/item_fulfillment_item.rb +1 -1
- data/lib/netsuite/records/item_fulfillment_package_list.rb +22 -1
- data/lib/netsuite/records/sales_order.rb +1 -1
- data/lib/netsuite/records/service_sale_item.rb +1 -1
- data/lib/netsuite/support/requests.rb +5 -4
- data/lib/netsuite/version.rb +1 -1
- data/netsuite.gemspec +1 -1
- data/spec/netsuite/actions/add_spec.rb +5 -5
- data/spec/netsuite/actions/delete_spec.rb +2 -2
- data/spec/netsuite/actions/get_spec.rb +4 -4
- 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 +4 -4
- data/spec/netsuite/actions/upsert_spec.rb +5 -5
- data/spec/netsuite/records/account_spec.rb +6 -6
- data/spec/netsuite/records/accounting_period_spec.rb +6 -6
- data/spec/netsuite/records/classification_spec.rb +4 -4
- data/spec/netsuite/records/credit_memo_spec.rb +8 -8
- data/spec/netsuite/records/custom_field_list_spec.rb +10 -0
- data/spec/netsuite/records/custom_field_spec.rb +1 -1
- data/spec/netsuite/records/custom_record_ref_spec.rb +1 -1
- data/spec/netsuite/records/custom_record_spec.rb +6 -6
- data/spec/netsuite/records/custom_record_type_spec.rb +6 -6
- data/spec/netsuite/records/customer_payment_spec.rb +9 -9
- data/spec/netsuite/records/customer_refund_spec.rb +8 -8
- data/spec/netsuite/records/customer_spec.rb +10 -10
- data/spec/netsuite/records/department_spec.rb +6 -6
- data/spec/netsuite/records/deposit_spec.rb +10 -10
- data/spec/netsuite/records/inventory_item_spec.rb +6 -6
- data/spec/netsuite/records/invoice_spec.rb +8 -8
- data/spec/netsuite/records/item_fulfillment_package_list_spec.rb +27 -0
- data/spec/netsuite/records/item_fulfillment_spec.rb +49 -0
- data/spec/netsuite/records/job_spec.rb +8 -8
- data/spec/netsuite/records/journal_entry_spec.rb +6 -6
- data/spec/netsuite/records/location_spec.rb +2 -2
- data/spec/netsuite/records/non_inventory_sale_item_spec.rb +6 -6
- data/spec/netsuite/records/payment_method_spec.rb +2 -2
- data/spec/netsuite/records/rev_rec_template_spec.rb +2 -2
- data/spec/netsuite/records/sales_order_spec.rb +9 -9
- data/spec/netsuite/records/service_sale_item_spec.rb +6 -6
- data/spec/netsuite/records/support_case_spec.rb +8 -8
- data/spec/netsuite/records/term_spec.rb +6 -6
- data/spec/netsuite/support/actions_spec.rb +1 -1
- data/spec/netsuite/support/attributes_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +13 -5
- data/lib/netsuite/actions/search_more_with_id.rb +0 -107
@@ -42,8 +42,8 @@ describe NetSuite::Actions::Search do
|
|
42
42
|
}.not_to raise_error
|
43
43
|
end
|
44
44
|
|
45
|
-
|
46
|
-
|
45
|
+
skip "should handle a ID search with basic params"
|
46
|
+
skip "should handle a search with joined params"
|
47
47
|
|
48
48
|
it "should handle a search with joined params containing custom field search" do
|
49
49
|
savon.expects(:search).with(:message => {
|
@@ -146,12 +146,12 @@ describe NetSuite::Actions::Search do
|
|
146
146
|
end
|
147
147
|
|
148
148
|
context "advanced search" do
|
149
|
-
|
150
|
-
|
149
|
+
skip "should handle search column definitions"
|
150
|
+
skip "should handle joined search results"
|
151
151
|
end
|
152
152
|
|
153
153
|
context "basic search" do
|
154
|
-
|
155
|
-
|
154
|
+
skip "should handle searching basic fields"
|
155
|
+
skip "should handle searching with joined fields"
|
156
156
|
end
|
157
157
|
end
|
@@ -21,11 +21,11 @@ describe NetSuite::Actions::Update do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'makes a valid request to the NetSuite API' do
|
24
|
-
NetSuite::Actions::Update.call(NetSuite::Records::Customer, attributes)
|
24
|
+
NetSuite::Actions::Update.call([NetSuite::Records::Customer, attributes])
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'returns a valid Response object' do
|
28
|
-
response = NetSuite::Actions::Update.call(NetSuite::Records::Customer, attributes)
|
28
|
+
response = NetSuite::Actions::Update.call([NetSuite::Records::Customer, attributes])
|
29
29
|
response.should be_kind_of(NetSuite::Response)
|
30
30
|
response.should be_success
|
31
31
|
end
|
@@ -47,11 +47,11 @@ describe NetSuite::Actions::Update do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'makes a valid request to the NetSuite API' do
|
50
|
-
NetSuite::Actions::Update.call(NetSuite::Records::Invoice, attributes)
|
50
|
+
NetSuite::Actions::Update.call([NetSuite::Records::Invoice, attributes])
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'returns a valid Response object' do
|
54
|
-
response = NetSuite::Actions::Update.call(NetSuite::Records::Invoice, attributes)
|
54
|
+
response = NetSuite::Actions::Update.call([NetSuite::Records::Invoice, attributes])
|
55
55
|
response.should be_kind_of(NetSuite::Response)
|
56
56
|
response.should be_success
|
57
57
|
end
|
@@ -22,11 +22,11 @@ describe NetSuite::Actions::Upsert do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'makes a valid request to the NetSuite API' do
|
25
|
-
NetSuite::Actions::Upsert.call(customer)
|
25
|
+
NetSuite::Actions::Upsert.call([customer])
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'returns a valid Response object' do
|
29
|
-
response = NetSuite::Actions::Upsert.call(customer)
|
29
|
+
response = NetSuite::Actions::Upsert.call([customer])
|
30
30
|
response.should be_kind_of(NetSuite::Response)
|
31
31
|
response.should be_success
|
32
32
|
end
|
@@ -50,11 +50,11 @@ describe NetSuite::Actions::Upsert do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
it 'makes a valid request to the NetSuite API' do
|
53
|
-
NetSuite::Actions::Upsert.call(invoice)
|
53
|
+
NetSuite::Actions::Upsert.call([invoice])
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'returns a valid Response object' do
|
57
|
-
response = NetSuite::Actions::Upsert.call(invoice)
|
57
|
+
response = NetSuite::Actions::Upsert.call([invoice])
|
58
58
|
response.should be_kind_of(NetSuite::Response)
|
59
59
|
response.should be_success
|
60
60
|
end
|
@@ -83,7 +83,7 @@ describe NetSuite::Actions::Upsert do
|
|
83
83
|
end
|
84
84
|
|
85
85
|
it 'provides an error method on the response' do
|
86
|
-
response = NetSuite::Actions::Upsert.call(invoice)
|
86
|
+
response = NetSuite::Actions::Upsert.call([invoice])
|
87
87
|
response.errors.first.should be_kind_of(NetSuite::Error)
|
88
88
|
end
|
89
89
|
end
|
@@ -40,7 +40,7 @@ describe NetSuite::Records::Account do
|
|
40
40
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :acct_name => 'Account 1' }) }
|
41
41
|
|
42
42
|
it 'returns a Account instance populated with the data from the response object' do
|
43
|
-
NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::Account, :external_id => 1).and_return(response)
|
43
|
+
NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::Account, {:external_id => 1}], {}).and_return(response)
|
44
44
|
account = NetSuite::Records::Account.get(:external_id => 1)
|
45
45
|
account.should be_kind_of(NetSuite::Records::Account)
|
46
46
|
account.acct_name.should eql('Account 1')
|
@@ -51,7 +51,7 @@ describe NetSuite::Records::Account do
|
|
51
51
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
52
52
|
|
53
53
|
it 'raises a RecordNotFound exception' do
|
54
|
-
NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::Account, :external_id => 1).and_return(response)
|
54
|
+
NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::Account, {:external_id => 1}], {}).and_return(response)
|
55
55
|
lambda {
|
56
56
|
NetSuite::Records::Account.get(:external_id => 1)
|
57
57
|
}.should raise_error(NetSuite::RecordNotFound,
|
@@ -69,7 +69,7 @@ describe NetSuite::Records::Account do
|
|
69
69
|
it 'returns true' do
|
70
70
|
account = NetSuite::Records::Account.new(test_data)
|
71
71
|
NetSuite::Actions::Add.should_receive(:call).
|
72
|
-
with(account).
|
72
|
+
with([account], {}).
|
73
73
|
and_return(response)
|
74
74
|
account.add.should be_true
|
75
75
|
end
|
@@ -81,7 +81,7 @@ describe NetSuite::Records::Account do
|
|
81
81
|
it 'returns false' do
|
82
82
|
account = NetSuite::Records::Account.new(test_data)
|
83
83
|
NetSuite::Actions::Add.should_receive(:call).
|
84
|
-
with(account).
|
84
|
+
with([account], {}).
|
85
85
|
and_return(response)
|
86
86
|
account.add.should be_false
|
87
87
|
end
|
@@ -97,7 +97,7 @@ describe NetSuite::Records::Account do
|
|
97
97
|
it 'returns true' do
|
98
98
|
account = NetSuite::Records::Account.new(test_data)
|
99
99
|
NetSuite::Actions::Delete.should_receive(:call).
|
100
|
-
with(account).
|
100
|
+
with([account], {}).
|
101
101
|
and_return(response)
|
102
102
|
account.delete.should be_true
|
103
103
|
end
|
@@ -109,7 +109,7 @@ describe NetSuite::Records::Account do
|
|
109
109
|
it 'returns false' do
|
110
110
|
account = NetSuite::Records::Account.new(test_data)
|
111
111
|
NetSuite::Actions::Delete.should_receive(:call).
|
112
|
-
with(account).
|
112
|
+
with([account], {}).
|
113
113
|
and_return(response)
|
114
114
|
account.delete.should be_false
|
115
115
|
end
|
@@ -24,7 +24,7 @@ describe NetSuite::Records::AccountingPeriod do
|
|
24
24
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :period_name => 'Accounting Period 1' }) }
|
25
25
|
|
26
26
|
it 'returns a Account instance populated with the data from the response object' do
|
27
|
-
NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::AccountingPeriod, :external_id => 1).and_return(response)
|
27
|
+
NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::AccountingPeriod, {:external_id => 1}], {}).and_return(response)
|
28
28
|
accounting_period = NetSuite::Records::AccountingPeriod.get(:external_id => 1)
|
29
29
|
accounting_period.should be_kind_of(NetSuite::Records::AccountingPeriod)
|
30
30
|
accounting_period.period_name.should eql('Accounting Period 1')
|
@@ -35,7 +35,7 @@ describe NetSuite::Records::AccountingPeriod do
|
|
35
35
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
36
36
|
|
37
37
|
it 'raises a RecordNotFound exception' do
|
38
|
-
NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::AccountingPeriod, :external_id => 1).and_return(response)
|
38
|
+
NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::AccountingPeriod, {:external_id => 1}], {}).and_return(response)
|
39
39
|
lambda {
|
40
40
|
NetSuite::Records::AccountingPeriod.get(:external_id => 1)
|
41
41
|
}.should raise_error(NetSuite::RecordNotFound,
|
@@ -53,7 +53,7 @@ describe NetSuite::Records::AccountingPeriod do
|
|
53
53
|
it 'returns true' do
|
54
54
|
accounting_period = NetSuite::Records::AccountingPeriod.new(test_data)
|
55
55
|
NetSuite::Actions::Add.should_receive(:call).
|
56
|
-
with(accounting_period).
|
56
|
+
with([accounting_period], {}).
|
57
57
|
and_return(response)
|
58
58
|
accounting_period.add.should be_true
|
59
59
|
end
|
@@ -65,7 +65,7 @@ describe NetSuite::Records::AccountingPeriod do
|
|
65
65
|
it 'returns false' do
|
66
66
|
accounting_period = NetSuite::Records::AccountingPeriod.new(test_data)
|
67
67
|
NetSuite::Actions::Add.should_receive(:call).
|
68
|
-
with(accounting_period).
|
68
|
+
with([accounting_period], {}).
|
69
69
|
and_return(response)
|
70
70
|
accounting_period.add.should be_false
|
71
71
|
end
|
@@ -81,7 +81,7 @@ describe NetSuite::Records::AccountingPeriod do
|
|
81
81
|
it 'returns true' do
|
82
82
|
accounting_period = NetSuite::Records::AccountingPeriod.new(test_data)
|
83
83
|
NetSuite::Actions::Delete.should_receive(:call).
|
84
|
-
with(accounting_period).
|
84
|
+
with([accounting_period], {}).
|
85
85
|
and_return(response)
|
86
86
|
accounting_period.delete.should be_true
|
87
87
|
end
|
@@ -93,7 +93,7 @@ describe NetSuite::Records::AccountingPeriod do
|
|
93
93
|
it 'returns false' do
|
94
94
|
accounting_period = NetSuite::Records::AccountingPeriod.new(test_data)
|
95
95
|
NetSuite::Actions::Delete.should_receive(:call).
|
96
|
-
with(accounting_period).
|
96
|
+
with([accounting_period], {}).
|
97
97
|
and_return(response)
|
98
98
|
accounting_period.delete.should be_false
|
99
99
|
end
|
@@ -16,7 +16,7 @@ describe NetSuite::Records::Classification do
|
|
16
16
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :name => 'Retail' }) }
|
17
17
|
|
18
18
|
it 'returns an Invoice instance populated with the data from the response object' do
|
19
|
-
NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::Classification, :external_id => 10).and_return(response)
|
19
|
+
NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::Classification, {:external_id => 10}], {}).and_return(response)
|
20
20
|
invoice = NetSuite::Records::Classification.get(:external_id => 10)
|
21
21
|
invoice.should be_kind_of(NetSuite::Records::Classification)
|
22
22
|
end
|
@@ -26,7 +26,7 @@ describe NetSuite::Records::Classification do
|
|
26
26
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
27
27
|
|
28
28
|
it 'raises a RecordNotFound exception' do
|
29
|
-
NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::Classification, :external_id => 10).and_return(response)
|
29
|
+
NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::Classification, {:external_id => 10}], {}).and_return(response)
|
30
30
|
lambda {
|
31
31
|
NetSuite::Records::Classification.get(:external_id => 10)
|
32
32
|
}.should raise_error(NetSuite::RecordNotFound,
|
@@ -44,7 +44,7 @@ describe NetSuite::Records::Classification do
|
|
44
44
|
it 'returns true' do
|
45
45
|
classification = NetSuite::Records::Classification.new(test_data)
|
46
46
|
NetSuite::Actions::Delete.should_receive(:call).
|
47
|
-
with(classification).
|
47
|
+
with([classification], {}).
|
48
48
|
and_return(response)
|
49
49
|
classification.delete.should be_true
|
50
50
|
end
|
@@ -56,7 +56,7 @@ describe NetSuite::Records::Classification do
|
|
56
56
|
it 'returns false' do
|
57
57
|
classification = NetSuite::Records::Classification.new(test_data)
|
58
58
|
NetSuite::Actions::Delete.should_receive(:call).
|
59
|
-
with(classification).
|
59
|
+
with([classification], {}).
|
60
60
|
and_return(response)
|
61
61
|
classification.delete.should be_false
|
62
62
|
end
|
@@ -98,7 +98,7 @@ describe NetSuite::Records::CreditMemo do
|
|
98
98
|
let(:response) { NetSuite::Response.new(:success => true, :body => { :alt_shipping_cost => 100 }) }
|
99
99
|
|
100
100
|
it 'returns a CreditMemo instance populated with the data from the response object' do
|
101
|
-
NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::CreditMemo, :external_id => 1).and_return(response)
|
101
|
+
NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::CreditMemo, {:external_id => 1}], {}).and_return(response)
|
102
102
|
memo = NetSuite::Records::CreditMemo.get(:external_id => 1)
|
103
103
|
memo.should be_kind_of(NetSuite::Records::CreditMemo)
|
104
104
|
memo.alt_shipping_cost.should eql(100)
|
@@ -109,7 +109,7 @@ describe NetSuite::Records::CreditMemo do
|
|
109
109
|
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
110
110
|
|
111
111
|
it 'raises a RecordNotFound exception' do
|
112
|
-
NetSuite::Actions::Get.should_receive(:call).with(NetSuite::Records::CreditMemo, :external_id => 1).and_return(response)
|
112
|
+
NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::CreditMemo, {:external_id => 1}], {}).and_return(response)
|
113
113
|
lambda {
|
114
114
|
NetSuite::Records::CreditMemo.get(:external_id => 1)
|
115
115
|
}.should raise_error(NetSuite::RecordNotFound,
|
@@ -121,14 +121,14 @@ describe NetSuite::Records::CreditMemo do
|
|
121
121
|
describe '.initialize' do
|
122
122
|
context 'when the request is successful' do
|
123
123
|
it 'returns an initialized credit memo from the customer entity' do
|
124
|
-
NetSuite::Actions::Initialize.should_receive(:call).with(NetSuite::Records::CreditMemo, customer).and_return(response)
|
124
|
+
NetSuite::Actions::Initialize.should_receive(:call).with([NetSuite::Records::CreditMemo, customer], {}).and_return(response)
|
125
125
|
invoice = NetSuite::Records::CreditMemo.initialize(customer)
|
126
126
|
invoice.should be_kind_of(NetSuite::Records::CreditMemo)
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
130
|
context 'when the response is unsuccessful' do
|
131
|
-
|
131
|
+
skip
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
@@ -141,7 +141,7 @@ describe NetSuite::Records::CreditMemo do
|
|
141
141
|
it 'returns true' do
|
142
142
|
memo = NetSuite::Records::CreditMemo.new(test_data)
|
143
143
|
NetSuite::Actions::Add.should_receive(:call).
|
144
|
-
with(memo).
|
144
|
+
with([memo], {}).
|
145
145
|
and_return(response)
|
146
146
|
memo.add.should be_true
|
147
147
|
end
|
@@ -153,7 +153,7 @@ describe NetSuite::Records::CreditMemo do
|
|
153
153
|
it 'returns false' do
|
154
154
|
memo = NetSuite::Records::CreditMemo.new(test_data)
|
155
155
|
NetSuite::Actions::Add.should_receive(:call).
|
156
|
-
with(memo).
|
156
|
+
with([memo], {}).
|
157
157
|
and_return(response)
|
158
158
|
memo.add.should be_false
|
159
159
|
end
|
@@ -169,7 +169,7 @@ describe NetSuite::Records::CreditMemo do
|
|
169
169
|
it 'returns true' do
|
170
170
|
memo = NetSuite::Records::CreditMemo.new(test_data)
|
171
171
|
NetSuite::Actions::Delete.should_receive(:call).
|
172
|
-
with(memo).
|
172
|
+
with([memo], {}).
|
173
173
|
and_return(response)
|
174
174
|
memo.delete.should be_true
|
175
175
|
end
|
@@ -181,7 +181,7 @@ describe NetSuite::Records::CreditMemo do
|
|
181
181
|
it 'returns false' do
|
182
182
|
memo = NetSuite::Records::CreditMemo.new(test_data)
|
183
183
|
NetSuite::Actions::Delete.should_receive(:call).
|
184
|
-
with(memo).
|
184
|
+
with([memo], {}).
|
185
185
|
and_return(response)
|
186
186
|
memo.delete.should be_false
|
187
187
|
end
|
@@ -15,6 +15,16 @@ describe NetSuite::Records::CustomFieldList do
|
|
15
15
|
list.custom_fields.first.type.should == 'platformCore:StringCustomFieldRef'
|
16
16
|
end
|
17
17
|
|
18
|
+
it "should handle date custom field creation" do
|
19
|
+
list.custrecord_somefield = Date.parse("12/12/2012")
|
20
|
+
list.custom_fields.first.value.should == '2012-12-12T00:00:00+00:00'
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should handle datetime custom field creation" do
|
24
|
+
list.custrecord_somefield = DateTime.parse("12/12/2012 10:05am")
|
25
|
+
list.custom_fields.first.value.should == '2012-12-12T10:05:00+00:00'
|
26
|
+
end
|
27
|
+
|
18
28
|
it "should convert a list of numbers into a list of custom field refs" do
|
19
29
|
list.custrecord_somefield = [1,2]
|
20
30
|
list.custom_fields.first.type.should == 'platformCore:MultiSelectCustomFieldRef'
|
@@ -51,7 +51,7 @@ describe NetSuite::Records::CustomRecord do
|
|
51
51
|
|
52
52
|
it 'returns a Customer instance populated with the data from the response object' do
|
53
53
|
NetSuite::Actions::Get.should_receive(:call).
|
54
|
-
with(NetSuite::Records::CustomRecord, :external_id => 1, :type_id => nil, :custom => true).
|
54
|
+
with([NetSuite::Records::CustomRecord, {:external_id => 1, :type_id => nil, :custom => true}], {}).
|
55
55
|
and_return(response)
|
56
56
|
customer = NetSuite::Records::CustomRecord.get(:external_id => 1)
|
57
57
|
customer.should be_kind_of(NetSuite::Records::CustomRecord)
|
@@ -64,7 +64,7 @@ describe NetSuite::Records::CustomRecord do
|
|
64
64
|
|
65
65
|
it 'raises a RecordNotFound exception' do
|
66
66
|
NetSuite::Actions::Get.should_receive(:call).
|
67
|
-
with(NetSuite::Records::CustomRecord, :external_id => 1, :type_id => nil, :custom => true).
|
67
|
+
with([NetSuite::Records::CustomRecord, {:external_id => 1, :type_id => nil, :custom => true}], {}).
|
68
68
|
and_return(response)
|
69
69
|
lambda {
|
70
70
|
NetSuite::Records::CustomRecord.get(:external_id => 1)
|
@@ -80,7 +80,7 @@ describe NetSuite::Records::CustomRecord do
|
|
80
80
|
|
81
81
|
it 'returns true' do
|
82
82
|
NetSuite::Actions::Add.should_receive(:call).
|
83
|
-
with(record).
|
83
|
+
with([record], {}).
|
84
84
|
and_return(response)
|
85
85
|
record.add.should be_true
|
86
86
|
end
|
@@ -91,7 +91,7 @@ describe NetSuite::Records::CustomRecord do
|
|
91
91
|
|
92
92
|
it 'returns false' do
|
93
93
|
NetSuite::Actions::Add.should_receive(:call).
|
94
|
-
with(record).
|
94
|
+
with([record], {}).
|
95
95
|
and_return(response)
|
96
96
|
record.add.should be_false
|
97
97
|
end
|
@@ -104,7 +104,7 @@ describe NetSuite::Records::CustomRecord do
|
|
104
104
|
|
105
105
|
it 'returns true' do
|
106
106
|
NetSuite::Actions::Delete.should_receive(:call).
|
107
|
-
with(record, { :custom => true }).
|
107
|
+
with([record, { :custom => true }], {}).
|
108
108
|
and_return(response)
|
109
109
|
record.delete.should be_true
|
110
110
|
end
|
@@ -115,7 +115,7 @@ describe NetSuite::Records::CustomRecord do
|
|
115
115
|
|
116
116
|
it 'returns false' do
|
117
117
|
NetSuite::Actions::Delete.should_receive(:call).
|
118
|
-
with(record, { :custom => true }).
|
118
|
+
with([record, { :custom => true }], {}).
|
119
119
|
and_return(response)
|
120
120
|
record.delete.should be_false
|
121
121
|
end
|
@@ -84,7 +84,7 @@ describe NetSuite::Records::CustomRecordType do
|
|
84
84
|
|
85
85
|
it 'returns a Customer instance populated with the data from the response object' do
|
86
86
|
NetSuite::Actions::Get.should_receive(:call).
|
87
|
-
with(NetSuite::Records::CustomRecordType, :external_id => 1).
|
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
90
|
record_type.should be_kind_of(NetSuite::Records::CustomRecordType)
|
@@ -97,7 +97,7 @@ describe NetSuite::Records::CustomRecordType do
|
|
97
97
|
|
98
98
|
it 'raises a RecordNotFound exception' do
|
99
99
|
NetSuite::Actions::Get.should_receive(:call).
|
100
|
-
with(NetSuite::Records::CustomRecordType, :external_id => 1).
|
100
|
+
with([NetSuite::Records::CustomRecordType, :external_id => 1], {}).
|
101
101
|
and_return(response)
|
102
102
|
lambda {
|
103
103
|
NetSuite::Records::CustomRecordType.get(:external_id => 1)
|
@@ -113,7 +113,7 @@ describe NetSuite::Records::CustomRecordType do
|
|
113
113
|
|
114
114
|
it 'returns true' do
|
115
115
|
NetSuite::Actions::Add.should_receive(:call).
|
116
|
-
with(record_type).
|
116
|
+
with([record_type], {}).
|
117
117
|
and_return(response)
|
118
118
|
record_type.add.should be_true
|
119
119
|
end
|
@@ -124,7 +124,7 @@ describe NetSuite::Records::CustomRecordType do
|
|
124
124
|
|
125
125
|
it 'returns false' do
|
126
126
|
NetSuite::Actions::Add.should_receive(:call).
|
127
|
-
with(record_type).
|
127
|
+
with([record_type], {}).
|
128
128
|
and_return(response)
|
129
129
|
record_type.add.should be_false
|
130
130
|
end
|
@@ -137,7 +137,7 @@ describe NetSuite::Records::CustomRecordType do
|
|
137
137
|
|
138
138
|
it 'returns true' do
|
139
139
|
NetSuite::Actions::Delete.should_receive(:call).
|
140
|
-
with(record_type).
|
140
|
+
with([record_type], {}).
|
141
141
|
and_return(response)
|
142
142
|
record_type.delete.should be_true
|
143
143
|
end
|
@@ -148,7 +148,7 @@ describe NetSuite::Records::CustomRecordType do
|
|
148
148
|
|
149
149
|
it 'returns false' do
|
150
150
|
NetSuite::Actions::Delete.should_receive(:call).
|
151
|
-
with(record_type).
|
151
|
+
with([record_type], {}).
|
152
152
|
and_return(response)
|
153
153
|
record_type.delete.should be_false
|
154
154
|
end
|
@@ -10,7 +10,7 @@ describe NetSuite::Records::CustomerPayment do
|
|
10
10
|
:applied, :auth_code, :auto_apply, :balance, :cc_approved, :cc_avs_street_match, :cc_avs_zip_match, :cc_expire_date,
|
11
11
|
:cc_name, :cc_number, :cc_security_code, :cc_security_code_match, :cc_street, :cc_zip_code, :charge_it, :check_num,
|
12
12
|
:created_date, :currency_name, :debit_card_issue_no, :exchange_rate, :ignore_avs, :last_modified_date, :memo, :payment,
|
13
|
-
:
|
13
|
+
:skip, :pn_ref_num, :status, :three_d_status_code, :total, :tran_date, :unapplied, :undep_funds, :valid_from
|
14
14
|
].each do |field|
|
15
15
|
payment.should have_field(field)
|
16
16
|
end
|
@@ -64,7 +64,7 @@ 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.should_receive(:call).with(NetSuite::Records::CustomerPayment, :external_id => 7).and_return(response)
|
67
|
+
NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::CustomerPayment, {:external_id => 7}], {}).and_return(response)
|
68
68
|
payment = NetSuite::Records::CustomerPayment.get(:external_id => 7)
|
69
69
|
payment.should be_kind_of(NetSuite::Records::CustomerPayment)
|
70
70
|
payment.memo.should eql('This is a memo')
|
@@ -75,7 +75,7 @@ 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.should_receive(:call).with(NetSuite::Records::CustomerPayment, :external_id => 8).and_return(response)
|
78
|
+
NetSuite::Actions::Get.should_receive(:call).with([NetSuite::Records::CustomerPayment, {:external_id => 8}], {}).and_return(response)
|
79
79
|
lambda {
|
80
80
|
NetSuite::Records::CustomerPayment.get(:external_id => 8)
|
81
81
|
}.should raise_error(NetSuite::RecordNotFound,
|
@@ -87,14 +87,14 @@ 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.should_receive(:call).with(NetSuite::Records::CustomerPayment, invoice).and_return(response)
|
90
|
+
NetSuite::Actions::Initialize.should_receive(:call).with([NetSuite::Records::CustomerPayment, invoice], {}).and_return(response)
|
91
91
|
payment = NetSuite::Records::CustomerPayment.initialize(invoice)
|
92
92
|
payment.should be_kind_of(NetSuite::Records::CustomerPayment)
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
96
|
context 'when the response is unsuccessful' do
|
97
|
-
|
97
|
+
skip
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
@@ -107,7 +107,7 @@ describe NetSuite::Records::CustomerPayment do
|
|
107
107
|
it 'returns true' do
|
108
108
|
payment = NetSuite::Records::CustomerPayment.new(test_data)
|
109
109
|
NetSuite::Actions::Add.should_receive(:call).
|
110
|
-
with(payment).
|
110
|
+
with([payment], {}).
|
111
111
|
and_return(response)
|
112
112
|
payment.add.should be_true
|
113
113
|
end
|
@@ -119,7 +119,7 @@ describe NetSuite::Records::CustomerPayment do
|
|
119
119
|
it 'returns false' do
|
120
120
|
payment = NetSuite::Records::CustomerPayment.new(test_data)
|
121
121
|
NetSuite::Actions::Add.should_receive(:call).
|
122
|
-
with(payment).
|
122
|
+
with([payment], {}).
|
123
123
|
and_return(response)
|
124
124
|
payment.add.should be_false
|
125
125
|
end
|
@@ -132,7 +132,7 @@ describe NetSuite::Records::CustomerPayment do
|
|
132
132
|
|
133
133
|
it 'returns true' do
|
134
134
|
NetSuite::Actions::Delete.should_receive(:call).
|
135
|
-
with(payment).
|
135
|
+
with([payment], {}).
|
136
136
|
and_return(response)
|
137
137
|
payment.delete.should be_true
|
138
138
|
end
|
@@ -143,7 +143,7 @@ describe NetSuite::Records::CustomerPayment do
|
|
143
143
|
|
144
144
|
it 'returns false' do
|
145
145
|
NetSuite::Actions::Delete.should_receive(:call).
|
146
|
-
with(payment).
|
146
|
+
with([payment], {}).
|
147
147
|
and_return(response)
|
148
148
|
payment.delete.should be_false
|
149
149
|
end
|