netsuite 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/netsuite.rb +3 -0
- data/lib/netsuite/configuration.rb +23 -1
- data/lib/netsuite/records/accounting_period.rb +2 -2
- data/lib/netsuite/records/cash_refund.rb +29 -0
- data/lib/netsuite/records/cash_refund_item.rb +19 -0
- data/lib/netsuite/records/cash_refund_item_list.rb +33 -0
- data/lib/netsuite/records/customer_deposit.rb +1 -1
- data/lib/netsuite/version.rb +1 -1
- data/spec/netsuite/actions/search_spec.rb +30 -32
- data/spec/netsuite/configuration_spec.rb +23 -2
- data/spec/netsuite/records/accounting_period_spec.rb +36 -1
- data/spec/netsuite/records/cash_refund_item_list_spec.rb +27 -0
- data/spec/netsuite/records/cash_refund_item_spec.rb +23 -0
- data/spec/netsuite/records/cash_refund_spec.rb +152 -0
- data/spec/netsuite/records/customer_payment_spec.rb +1 -1
- data/spec/netsuite/records/phone_call_spec.rb +0 -6
- metadata +15 -6
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTM3NmVlZDg3YjVmM2VhNzg0YzJhOWVhMzUxYmFjZGY2MTJmOTAxMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Yzc1OGM5ZWFkNzg2NTNjMDcxYWM0ZDU4YTQ2Y2U4ZmMzYzJhNWYzMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjhlZDc1MTk0OTgwNGE2MDNjNDI2YzczMWE3ZTU2NWU1NjFiYmY5ZWRmZmUz
|
10
|
+
OGEzZTZmYWVhZGQyMDg1OWI5ZDc3M2U2MmY1Yjc3ODg1ZGRhYmJiYjM5NzUw
|
11
|
+
MmU5ZjgyODFhOTUzY2ZmZGQ5ZDY0NmZjODdiNzkyOGY4NTZkOTU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YWU4NTdjZTMxYmMxOWYxNTE2MTFlMmZlNzViNmMxMzcwYTBlMzRiZGY4N2Y5
|
14
|
+
NGEyOGI5NTA4MTg5OWYxMTkyMTYzOWViZmQ5YTVhNTJiYjZjMGM3ZDc0Yzgy
|
15
|
+
NzMxZTkyMGEyOTdjN2U0NTI3YTZiOTNiMDU0NmEyOTBhYTFmZGQ=
|
data/lib/netsuite.rb
CHANGED
@@ -55,6 +55,9 @@ module NetSuite
|
|
55
55
|
autoload :BillAddress, 'netsuite/records/bill_address'
|
56
56
|
autoload :BinNumberList, 'netsuite/records/bin_number_list'
|
57
57
|
autoload :CashSale, 'netsuite/records/cash_sale'
|
58
|
+
autoload :CashRefund, 'netsuite/records/cash_refund'
|
59
|
+
autoload :CashRefundItem, 'netsuite/records/cash_refund_item'
|
60
|
+
autoload :CashRefundItemList, 'netsuite/records/cash_refund_item_list'
|
58
61
|
autoload :Classification, 'netsuite/records/classification'
|
59
62
|
autoload :CreditMemo, 'netsuite/records/credit_memo'
|
60
63
|
autoload :CreditMemoApply, 'netsuite/records/credit_memo_apply'
|
@@ -15,10 +15,11 @@ module NetSuite
|
|
15
15
|
wsdl: wsdl,
|
16
16
|
read_timeout: read_timeout,
|
17
17
|
namespaces: namespaces,
|
18
|
-
soap_header: auth_header(credentials),
|
18
|
+
soap_header: auth_header(credentials).update(soap_header),
|
19
19
|
pretty_print_xml: true,
|
20
20
|
logger: logger,
|
21
21
|
log_level: log_level,
|
22
|
+
log: !silent, # turn off logging entirely if configured
|
22
23
|
}.update(params))
|
23
24
|
end
|
24
25
|
|
@@ -65,6 +66,18 @@ module NetSuite
|
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
69
|
+
def soap_header=(headers)
|
70
|
+
attributes[:soap_header] = headers
|
71
|
+
end
|
72
|
+
|
73
|
+
def soap_header(headers = nil)
|
74
|
+
if headers
|
75
|
+
self.soap_header = headers
|
76
|
+
else
|
77
|
+
attributes[:soap_header] ||= {}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
68
81
|
def auth_header(credentials={})
|
69
82
|
{
|
70
83
|
'platformMsgs:passport' => {
|
@@ -176,6 +189,15 @@ module NetSuite
|
|
176
189
|
end
|
177
190
|
end
|
178
191
|
|
192
|
+
def silent(value=nil)
|
193
|
+
self.silent = value if value
|
194
|
+
attributes[:silent]
|
195
|
+
end
|
196
|
+
|
197
|
+
def silent=(value)
|
198
|
+
attributes[:silent] ||= value
|
199
|
+
end
|
200
|
+
|
179
201
|
def log_level(value = nil)
|
180
202
|
self.log_level = value || :debug
|
181
203
|
attributes[:log_level]
|
@@ -4,8 +4,9 @@ module NetSuite
|
|
4
4
|
include Support::Fields
|
5
5
|
include Support::RecordRefs
|
6
6
|
include Support::Actions
|
7
|
+
include Namespaces::ListAcct
|
7
8
|
|
8
|
-
actions :get, :add, :delete
|
9
|
+
actions :get, :add, :delete, :search
|
9
10
|
|
10
11
|
fields :allow_non_gl_changes, :end_date, :is_adjust, :is_quarter, :is_year, :period_name, :start_date
|
11
12
|
|
@@ -19,7 +20,6 @@ module NetSuite
|
|
19
20
|
@external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
|
20
21
|
initialize_from_attributes_hash(attributes)
|
21
22
|
end
|
22
|
-
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class CashRefund
|
4
|
+
include Support::Fields
|
5
|
+
include Support::RecordRefs
|
6
|
+
include Support::Records
|
7
|
+
include Support::Actions
|
8
|
+
include Namespaces::TranCust
|
9
|
+
|
10
|
+
actions :add, :get, :delete
|
11
|
+
|
12
|
+
fields :tran_date
|
13
|
+
|
14
|
+
field :item_list, CashRefundItemList
|
15
|
+
field :custom_field_list, CustomFieldList
|
16
|
+
|
17
|
+
record_refs :entity, :custom_form, :payment_method, :created_from
|
18
|
+
|
19
|
+
attr_reader :internal_id
|
20
|
+
attr_accessor :external_id
|
21
|
+
|
22
|
+
def initialize(attributes = {})
|
23
|
+
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
24
|
+
@external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
|
25
|
+
initialize_from_attributes_hash(attributes)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class CashRefundItem
|
4
|
+
include Support::Fields
|
5
|
+
include Support::RecordRefs
|
6
|
+
include Support::Records
|
7
|
+
include Namespaces::TranCust
|
8
|
+
|
9
|
+
field :amount
|
10
|
+
|
11
|
+
record_refs :item, :klass
|
12
|
+
|
13
|
+
def initialize(attributes_or_record = {})
|
14
|
+
initialize_from_attributes_hash(attributes_or_record)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module NetSuite
|
2
|
+
module Records
|
3
|
+
class CashRefundItemList
|
4
|
+
include Support::Fields
|
5
|
+
include Namespaces::TranCust
|
6
|
+
|
7
|
+
fields :item
|
8
|
+
|
9
|
+
def initialize(attributes = {})
|
10
|
+
initialize_from_attributes_hash(attributes)
|
11
|
+
end
|
12
|
+
|
13
|
+
def item=(items)
|
14
|
+
case items
|
15
|
+
when Hash
|
16
|
+
self.items << CashRefundItem.new(items)
|
17
|
+
when Array
|
18
|
+
items.each { |item| self.items << CashRefundItem.new(item) }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def items
|
23
|
+
@items ||= []
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_record
|
27
|
+
{ "#{record_namespace}:item" => items.map(&:to_record) }
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
data/lib/netsuite/version.rb
CHANGED
@@ -17,29 +17,31 @@ describe NetSuite::Actions::Search do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
context "saved search" do
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
'
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
20
|
+
context "with no params" do
|
21
|
+
before do
|
22
|
+
savon.expects(:search).with(:message => {
|
23
|
+
'searchRecord' => {
|
24
|
+
'@xsi:type' => 'listRel:CustomerSearchAdvanced',
|
25
|
+
'@savedSearchId' => 500,
|
26
|
+
:content! => { "listRel:criteria" => {} }
|
27
|
+
},
|
28
|
+
}).returns(File.read('spec/support/fixtures/search/saved_search_customer.xml'))
|
29
|
+
end
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
it "should handle a ID only search" do
|
32
|
+
result = NetSuite::Records::Customer.search(saved: 500)
|
33
|
+
result.results.size.should == 1
|
34
|
+
result.results.first.email.should == 'aemail@gmail.com'
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
37
|
+
it "merges preferences gracefully" do
|
38
|
+
expect {
|
39
|
+
NetSuite::Records::Customer.search(
|
40
|
+
saved: 500,
|
41
|
+
preferences: { page_size: 20 }
|
42
|
+
)
|
43
|
+
}.not_to raise_error
|
44
|
+
end
|
43
45
|
end
|
44
46
|
|
45
47
|
skip "should handle a ID search with basic params"
|
@@ -54,23 +56,19 @@ describe NetSuite::Actions::Search do
|
|
54
56
|
"listRel:criteria" => {
|
55
57
|
"listRel:basic" => {
|
56
58
|
"platformCommon:entityId" => {
|
57
|
-
"platformCore:searchValue" => "New Keywords"
|
59
|
+
:content! => {"platformCore:searchValue" => "New Keywords"},
|
60
|
+
:"@operator" => "hasKeywords"
|
58
61
|
},
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
"platformCommon:stage" => { "operator" => "anyOf" }
|
62
|
+
"platformCommon:stage" => {
|
63
|
+
:content! => {"platformCore:searchValue"=>["_lead", "_customer"]},
|
64
|
+
:"@operator" => "anyOf"
|
63
65
|
},
|
64
|
-
|
65
|
-
"platformCommon:stage" => { "platformCore:searchValue" => ["_lead", "_customer"] },
|
66
66
|
"platformCommon:customFieldList" => {
|
67
67
|
"platformCore:customField" => [
|
68
68
|
{
|
69
|
-
"platformCore:searchValue" => [{}, {}],
|
69
|
+
"platformCore:searchValue" => [{:"@internalId" => 4}, {:"@internalId" => 11}],
|
70
70
|
:attributes! => {
|
71
|
-
"platformCore:searchValue" => {
|
72
|
-
"internalId" => [4, 11]
|
73
|
-
}
|
71
|
+
"platformCore:searchValue" => { "internalId" => [4, 11] }
|
74
72
|
}
|
75
73
|
},
|
76
74
|
{
|
@@ -66,7 +66,28 @@ describe NetSuite::Configuration do
|
|
66
66
|
'platformCore:email' => 'user@example.com',
|
67
67
|
'platformCore:password' => 'myPassword',
|
68
68
|
'platformCore:account' => '1234',
|
69
|
-
'platformCore:role' => { :@
|
69
|
+
'platformCore:role' => { :@internalId => '3' },
|
70
|
+
}
|
71
|
+
})
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe '#soap_header' do
|
76
|
+
before do
|
77
|
+
config.email = 'user@example.com'
|
78
|
+
config.password = 'myPassword'
|
79
|
+
config.account = 1234
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'adds a new header to the soap header' do
|
83
|
+
config.soap_header = {
|
84
|
+
'platformMsgs:preferences' => {
|
85
|
+
'platformMsgs:ignoreReadOnlyFields' => true,
|
86
|
+
}
|
87
|
+
}
|
88
|
+
config.soap_header.should eql({
|
89
|
+
'platformMsgs:preferences' => {
|
90
|
+
'platformMsgs:ignoreReadOnlyFields' => true,
|
70
91
|
}
|
71
92
|
})
|
72
93
|
end
|
@@ -143,7 +164,7 @@ describe NetSuite::Configuration do
|
|
143
164
|
end
|
144
165
|
end
|
145
166
|
end
|
146
|
-
|
167
|
+
|
147
168
|
describe '#role=' do
|
148
169
|
it 'sets the role according to the input value' do
|
149
170
|
config.role = "6"
|
@@ -44,6 +44,42 @@ describe NetSuite::Records::AccountingPeriod do
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
describe ".search" do
|
48
|
+
context 'when the response is successful' do
|
49
|
+
|
50
|
+
it 'returns a Account instance populated with the data from the response object' do
|
51
|
+
body = {
|
52
|
+
total_records: 2,
|
53
|
+
record_list: {
|
54
|
+
record: [
|
55
|
+
{period_name: "Accounting Period 1"},
|
56
|
+
{period_name: "Accounting Period 2"}
|
57
|
+
]
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
allow(NetSuite::Actions::Search).to receive(:call).with(
|
62
|
+
[NetSuite::Records::AccountingPeriod, {:external_id => 1}], {}
|
63
|
+
).and_return(
|
64
|
+
NetSuite::Response.new(:success => true, :body => body)
|
65
|
+
)
|
66
|
+
|
67
|
+
search_result = NetSuite::Records::AccountingPeriod.search(:external_id => 1)
|
68
|
+
|
69
|
+
expect(search_result).to be_a NetSuite::Support::SearchResult
|
70
|
+
expect(search_result.total_records).to eq 2
|
71
|
+
|
72
|
+
period1, period2 = search_result.results
|
73
|
+
|
74
|
+
expect(period1).to be_a NetSuite::Records::AccountingPeriod
|
75
|
+
expect(period1.period_name).to eq 'Accounting Period 1'
|
76
|
+
|
77
|
+
expect(period2).to be_a NetSuite::Records::AccountingPeriod
|
78
|
+
expect(period2.period_name).to eq 'Accounting Period 2'
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
47
83
|
describe '#add' do
|
48
84
|
let(:test_data) { { :acct_name => 'Test Accounting Period', :description => 'An example accounting period' } }
|
49
85
|
|
@@ -99,5 +135,4 @@ describe NetSuite::Records::AccountingPeriod do
|
|
99
135
|
end
|
100
136
|
end
|
101
137
|
end
|
102
|
-
|
103
138
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NetSuite::Records::CashRefundItemList do
|
4
|
+
let(:list) { NetSuite::Records::CashRefundItemList.new }
|
5
|
+
|
6
|
+
it 'has a items attribute' do
|
7
|
+
expect(list.items).to be_kind_of(Array)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#to_record' do
|
11
|
+
before do
|
12
|
+
list.items << NetSuite::Records::CashRefundItem.new(
|
13
|
+
:amount => 10
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'can represent itself as a SOAP record' do
|
18
|
+
record = {
|
19
|
+
'tranCust:item' => [{
|
20
|
+
'tranCust:amount' => 10
|
21
|
+
}]
|
22
|
+
}
|
23
|
+
expect(list.to_record).to eql(record)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NetSuite::Records::CashRefundItem do
|
4
|
+
let(:item) { NetSuite::Records::CashRefundItem.new }
|
5
|
+
|
6
|
+
it 'has all the right fields' do
|
7
|
+
[
|
8
|
+
:amount
|
9
|
+
].each do |field|
|
10
|
+
expect(item).to have_field(field)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'has all the right record refs' do
|
15
|
+
[
|
16
|
+
:item, :klass
|
17
|
+
].each do |record_ref|
|
18
|
+
expect(item).to have_record_ref(record_ref)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,152 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NetSuite::Records::CashRefund do
|
4
|
+
let(:cashrefund) { NetSuite::Records::CashRefund.new }
|
5
|
+
let(:customer) { NetSuite::Records::Customer.new }
|
6
|
+
|
7
|
+
it 'has all the right fields' do
|
8
|
+
[
|
9
|
+
:tran_date
|
10
|
+
].each do |field|
|
11
|
+
expect(cashrefund).to have_field(field)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'has all the right record refs' do
|
16
|
+
[
|
17
|
+
:entity, :custom_form, :payment_method, :created_from
|
18
|
+
].each do |record_ref|
|
19
|
+
expect(cashrefund).to have_record_ref(record_ref)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#item_list' do
|
24
|
+
it 'can be set from attributes' do
|
25
|
+
attributes = {
|
26
|
+
:item => {
|
27
|
+
:amount => 10
|
28
|
+
}
|
29
|
+
}
|
30
|
+
cashrefund.item_list = attributes
|
31
|
+
expect(cashrefund.item_list).to be_kind_of(NetSuite::Records::CashRefundItemList)
|
32
|
+
expect(cashrefund.item_list.items.length).to eql(1)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'can be set from a CashRefundItemList object' do
|
36
|
+
item_list = NetSuite::Records::CashRefundItemList.new
|
37
|
+
cashrefund.item_list = item_list
|
38
|
+
expect(cashrefund.item_list).to eql(item_list)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '#custom_field_list' do
|
43
|
+
it 'can be set through individual field setters' do
|
44
|
+
cashrefund.custom_field_list.custbody18 = "123-456"
|
45
|
+
expect(cashrefund.custom_field_list).to be_kind_of(NetSuite::Records::CustomFieldList)
|
46
|
+
expect(cashrefund.custom_field_list.custom_fields.length).to eql(1)
|
47
|
+
expect(cashrefund.custom_field_list.custbody18.attributes[:value]).to eq("123-456")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '.get' do
|
52
|
+
context 'when the response is successful' do
|
53
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :tran_date => 'test_tran_date' }) }
|
54
|
+
|
55
|
+
it 'returns a CashRefund instance populated with the data from the response object' do
|
56
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::CashRefund, :external_id => 1], {}).and_return(response)
|
57
|
+
cashrefund = NetSuite::Records::CashRefund.get(:external_id => 1)
|
58
|
+
expect(cashrefund).to be_kind_of(NetSuite::Records::CashRefund)
|
59
|
+
expect(cashrefund.tran_date).to eql('test_tran_date')
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'when the response is unsuccessful' do
|
64
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
65
|
+
|
66
|
+
it 'raises a RecordNotFound exception' do
|
67
|
+
expect(NetSuite::Actions::Get).to receive(:call).with([NetSuite::Records::CashRefund, :external_id => 1], {}).and_return(response)
|
68
|
+
expect {
|
69
|
+
NetSuite::Records::CashRefund.get(:external_id => 1)
|
70
|
+
}.to raise_error(NetSuite::RecordNotFound,
|
71
|
+
/NetSuite::Records::CashRefund with OPTIONS=(.*) could not be found/)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe '#add' do
|
77
|
+
let(:test_data) { { :email => 'test@example.com', :fax => '1234567890' } }
|
78
|
+
|
79
|
+
context 'when the response is successful' do
|
80
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
81
|
+
|
82
|
+
it 'returns true' do
|
83
|
+
cashrefund = NetSuite::Records::CashRefund.new(test_data)
|
84
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
85
|
+
with([cashrefund], {}).
|
86
|
+
and_return(response)
|
87
|
+
expect(cashrefund.add).to be_truthy
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
context 'when the response is unsuccessful' do
|
92
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
93
|
+
|
94
|
+
it 'returns false' do
|
95
|
+
cashrefund = NetSuite::Records::CashRefund.new(test_data)
|
96
|
+
expect(NetSuite::Actions::Add).to receive(:call).
|
97
|
+
with([cashrefund], {}).
|
98
|
+
and_return(response)
|
99
|
+
expect(cashrefund.add).to be_falsey
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe '#delete' do
|
105
|
+
let(:test_data) { { :internal_id => '1' } }
|
106
|
+
|
107
|
+
context 'when the response is successful' do
|
108
|
+
let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
|
109
|
+
|
110
|
+
it 'returns true' do
|
111
|
+
cashrefund = NetSuite::Records::CashRefund.new(test_data)
|
112
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
113
|
+
with([cashrefund], {}).
|
114
|
+
and_return(response)
|
115
|
+
expect(cashrefund.delete).to be_truthy
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
context 'when the response is unsuccessful' do
|
120
|
+
let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
|
121
|
+
|
122
|
+
it 'returns false' do
|
123
|
+
cashrefund = NetSuite::Records::CashRefund.new(test_data)
|
124
|
+
expect(NetSuite::Actions::Delete).to receive(:call).
|
125
|
+
with([cashrefund], {}).
|
126
|
+
and_return(response)
|
127
|
+
expect(cashrefund.delete).to be_falsey
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
describe '#to_record' do
|
133
|
+
let(:tran_date) { Time.now }
|
134
|
+
before do
|
135
|
+
cashrefund.tran_date = tran_date
|
136
|
+
end
|
137
|
+
it 'can represent itself as a SOAP record' do
|
138
|
+
record = {
|
139
|
+
'tranCust:tranDate' => tran_date
|
140
|
+
}
|
141
|
+
expect(cashrefund.to_record).to eql(record)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
|
146
|
+
describe '#record_type' do
|
147
|
+
it 'returns a string representation of the SOAP type' do
|
148
|
+
expect(cashrefund.record_type).to eql('tranCust:CashRefund')
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
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
|
+
:pending, :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
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netsuite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Moran
|
@@ -9,36 +9,36 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-07-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
+
name: savon
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
18
|
- - ~>
|
18
19
|
- !ruby/object:Gem::Version
|
19
20
|
version: 2.3.0
|
21
|
+
type: :runtime
|
20
22
|
prerelease: false
|
21
23
|
version_requirements: !ruby/object:Gem::Requirement
|
22
24
|
requirements:
|
23
25
|
- - ~>
|
24
26
|
- !ruby/object:Gem::Version
|
25
27
|
version: 2.3.0
|
26
|
-
name: savon
|
27
|
-
type: :runtime
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
+
name: rspec
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
30
31
|
requirements:
|
31
32
|
- - ~>
|
32
33
|
- !ruby/object:Gem::Version
|
33
34
|
version: '2.99'
|
35
|
+
type: :development
|
34
36
|
prerelease: false
|
35
37
|
version_requirements: !ruby/object:Gem::Requirement
|
36
38
|
requirements:
|
37
39
|
- - ~>
|
38
40
|
- !ruby/object:Gem::Version
|
39
41
|
version: '2.99'
|
40
|
-
name: rspec
|
41
|
-
type: :development
|
42
42
|
description: NetSuite SuiteTalk API Wrapper
|
43
43
|
email:
|
44
44
|
- ryan.moran@gmail.com
|
@@ -84,6 +84,9 @@ files:
|
|
84
84
|
- lib/netsuite/records/base_ref_list.rb
|
85
85
|
- lib/netsuite/records/bill_address.rb
|
86
86
|
- lib/netsuite/records/bin_number_list.rb
|
87
|
+
- lib/netsuite/records/cash_refund.rb
|
88
|
+
- lib/netsuite/records/cash_refund_item.rb
|
89
|
+
- lib/netsuite/records/cash_refund_item_list.rb
|
87
90
|
- lib/netsuite/records/cash_sale.rb
|
88
91
|
- lib/netsuite/records/classification.rb
|
89
92
|
- lib/netsuite/records/contact.rb
|
@@ -173,6 +176,9 @@ files:
|
|
173
176
|
- spec/netsuite/records/account_spec.rb
|
174
177
|
- spec/netsuite/records/accounting_period_spec.rb
|
175
178
|
- spec/netsuite/records/bill_address_spec.rb
|
179
|
+
- spec/netsuite/records/cash_refund_item_list_spec.rb
|
180
|
+
- spec/netsuite/records/cash_refund_item_spec.rb
|
181
|
+
- spec/netsuite/records/cash_refund_spec.rb
|
176
182
|
- spec/netsuite/records/classification_spec.rb
|
177
183
|
- spec/netsuite/records/credit_memo_apply_list_spec.rb
|
178
184
|
- spec/netsuite/records/credit_memo_apply_spec.rb
|
@@ -287,6 +293,9 @@ test_files:
|
|
287
293
|
- spec/netsuite/records/account_spec.rb
|
288
294
|
- spec/netsuite/records/accounting_period_spec.rb
|
289
295
|
- spec/netsuite/records/bill_address_spec.rb
|
296
|
+
- spec/netsuite/records/cash_refund_item_list_spec.rb
|
297
|
+
- spec/netsuite/records/cash_refund_item_spec.rb
|
298
|
+
- spec/netsuite/records/cash_refund_spec.rb
|
290
299
|
- spec/netsuite/records/classification_spec.rb
|
291
300
|
- spec/netsuite/records/credit_memo_apply_list_spec.rb
|
292
301
|
- spec/netsuite/records/credit_memo_apply_spec.rb
|