netsuite 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/netsuite.rb +1 -0
- data/lib/netsuite/actions/login.rb +12 -8
- data/lib/netsuite/records/account.rb +2 -0
- data/lib/netsuite/records/cash_refund.rb +1 -1
- data/lib/netsuite/records/journal_entry.rb +5 -1
- data/lib/netsuite/records/rev_rec_schedule.rb +32 -0
- data/lib/netsuite/records/vendor_bill_item.rb +2 -1
- data/lib/netsuite/version.rb +1 -1
- data/spec/netsuite/actions/login_spec.rb +26 -3
- data/spec/netsuite/records/basic_record_spec.rb +3 -0
- data/spec/netsuite/records/cash_refund_spec.rb +1 -1
- data/spec/netsuite/records/journal_entry_spec.rb +3 -3
- data/spec/netsuite/records/vendor_bill_item_spec.rb +1 -1
- data/spec/support/fixtures/login/failure_concurrent_requests.xml +15 -0
- data/spec/support/fixtures/login/failure_invalid_credentials.xml +15 -0
- data/spec/support/fixtures/{login.xml → login/success.xml} +0 -0
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDZjNmUwOTA5NzlmODQ4YWE0ZTk2ZmQzNDJmYTg1ZDI5ZjVhMjY3MA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MThmZWIzZjgzNjdhNmJiMDgzY2FhZjAwOGY0M2Q3ZjZiNzQ0YTZkNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Y2JkOThlMGJlNGQ5Mzg4OTVlMTcyYmQwOGY5NjJmYWZjMGM1MmI0ZDQwMTdm
|
10
|
+
YzU1YzY0OGRmNDg4OWYzNTIyODA0MTZhMTlkNzA3MzY3NTBmMzcxYWFmMzkz
|
11
|
+
NzU2NzY4YTRlMDBjMTZlZTBkMDY2NzVjZThlNjRmODY0NjFiMzg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjM5NWFiMzRlMjRjNWFiNTExMzFkYzE5OGRmYWJlM2ViMGE1N2RlNGZkNjky
|
14
|
+
NzE3ZWI2MDQ5ZTljZTlkNGVkZGI5ZDRmMzU4ZjVlYWM2ODdhZGU0NWMzYzdj
|
15
|
+
NWI0ZGJhMjJmYzFmOWFjMGMzMGUwZjgwMzY3YjYwY2YwZDdhOTk=
|
data/lib/netsuite.rb
CHANGED
@@ -167,6 +167,7 @@ module NetSuite
|
|
167
167
|
autoload :RecordRef, 'netsuite/records/record_ref'
|
168
168
|
autoload :RecordRefList, 'netsuite/records/record_ref_list'
|
169
169
|
autoload :RevRecTemplate, 'netsuite/records/rev_rec_template'
|
170
|
+
autoload :RevRecSchedule, 'netsuite/records/rev_rec_schedule'
|
170
171
|
autoload :RoleList, 'netsuite/records/role_list'
|
171
172
|
autoload :SalesOrder, 'netsuite/records/sales_order'
|
172
173
|
autoload :SalesOrderItem, 'netsuite/records/sales_order_item'
|
@@ -38,14 +38,18 @@ module NetSuite
|
|
38
38
|
rescue Savon::SOAPFault => e
|
39
39
|
error_details = e.to_hash[:fault]
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
41
|
+
if error_details[:detail].has_key?(:invalid_credentials_fault)
|
42
|
+
return NetSuite::Response.new(
|
43
|
+
success: false,
|
44
|
+
errors: [ NetSuite::Error.new(
|
45
|
+
code: error_details[:detail][:invalid_credentials_fault][:code],
|
46
|
+
message: error_details[:faultstring]
|
47
|
+
)],
|
48
|
+
body: error_details
|
49
|
+
)
|
50
|
+
else
|
51
|
+
raise(e)
|
52
|
+
end
|
49
53
|
end
|
50
54
|
|
51
55
|
# include more data in body; leave it up to the user to pull the data they are looking for
|
@@ -9,7 +9,7 @@ module NetSuite
|
|
9
9
|
|
10
10
|
actions :add, :get, :delete, :initialize, :upsert
|
11
11
|
|
12
|
-
fields :tran_date, :to_be_emailed, :memo, :total, :currency_name, :exchange_rate, :source, :tax_rate
|
12
|
+
fields :tran_id, :tran_date, :to_be_emailed, :memo, :total, :currency_name, :exchange_rate, :source, :tax_rate
|
13
13
|
|
14
14
|
field :item_list, CashRefundItemList
|
15
15
|
field :custom_field_list, CustomFieldList
|
@@ -5,7 +5,7 @@ module NetSuite
|
|
5
5
|
include Support::RecordRefs
|
6
6
|
include Support::Records
|
7
7
|
include Support::Actions
|
8
|
-
include Namespaces::
|
8
|
+
include Namespaces::TranGeneral
|
9
9
|
|
10
10
|
actions :get, :get_list, :add, :delete, :search, :upsert
|
11
11
|
|
@@ -39,6 +39,10 @@ module NetSuite
|
|
39
39
|
"Transaction"
|
40
40
|
end
|
41
41
|
|
42
|
+
def self.search_class_namespace
|
43
|
+
"tranSales"
|
44
|
+
end
|
45
|
+
|
42
46
|
end
|
43
47
|
end
|
44
48
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2015_1/schema/record/revrecschedule.html
|
2
|
+
|
3
|
+
module NetSuite
|
4
|
+
module Records
|
5
|
+
class RevRecSchedule
|
6
|
+
include Support::Fields
|
7
|
+
include Support::RecordRefs
|
8
|
+
include Support::Records
|
9
|
+
include Support::Actions
|
10
|
+
include Namespaces::ListAcct
|
11
|
+
|
12
|
+
actions :get, :get_list, :add, :update, :upsert, :delete, :search
|
13
|
+
|
14
|
+
fields :initial_amount, :is_inactive, :name, :period_offset, :rev_rec_offset,
|
15
|
+
:amortization_period
|
16
|
+
|
17
|
+
record_refs :amortization_type, :recog_interval_src, :recurrence_type
|
18
|
+
|
19
|
+
# recurrenceList RevRecScheduleRecurrenceList 0..1
|
20
|
+
|
21
|
+
attr_reader :internal_id
|
22
|
+
attr_accessor :external_id
|
23
|
+
|
24
|
+
def initialize(attributes = {})
|
25
|
+
@internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
|
26
|
+
@external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
|
27
|
+
initialize_from_attributes_hash(attributes)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -8,7 +8,8 @@ module NetSuite
|
|
8
8
|
|
9
9
|
fields :amortization_end_date, :amortization_residual, :amortiz_start_date, :bin_numbers, :bill_variance_status,
|
10
10
|
:description, :expiration_date, :gross_amt, :inventory_detail, :is_billable, :landed_cost, :line,
|
11
|
-
:order_doc, :order_line, :quantity, :serial_numbers, :tax_rate_1, :tax_rate_2, :tax_1_amt, :vendor_name
|
11
|
+
:order_doc, :order_line, :quantity, :serial_numbers, :tax_rate_1, :tax_rate_2, :tax_1_amt, :vendor_name,
|
12
|
+
:rate
|
12
13
|
|
13
14
|
field :bill_receipts_list, RecordRefList
|
14
15
|
field :custom_field_list, CustomFieldList
|
data/lib/netsuite/version.rb
CHANGED
@@ -4,10 +4,9 @@ describe NetSuite::Actions::Login do
|
|
4
4
|
before { savon.mock! }
|
5
5
|
after { savon.unmock! }
|
6
6
|
|
7
|
-
it '
|
7
|
+
it 'handles a successful login call' do
|
8
8
|
message = {"platformMsgs:passport"=>{"platformCore:email"=>"email", "platformCore:password"=>"password", "platformCore:account"=>"1234", "platformCore:role"=>234}}
|
9
|
-
|
10
|
-
savon.expects(:login).with(:message => message).returns(File.read('spec/support/fixtures/login.xml'))
|
9
|
+
savon.expects(:login).with(:message => message).returns(File.read('spec/support/fixtures/login/success.xml'))
|
11
10
|
|
12
11
|
result = NetSuite::Actions::Login.call({
|
13
12
|
email: 'email',
|
@@ -18,4 +17,28 @@ describe NetSuite::Actions::Login do
|
|
18
17
|
expect(result.success?).to eq(true)
|
19
18
|
expect(result.body[:user_id]).to_not be_nil
|
20
19
|
end
|
20
|
+
|
21
|
+
it 'handles a failed login call because of a concurrent request error' do
|
22
|
+
message = {"platformMsgs:passport"=>{"platformCore:email"=>"email", "platformCore:password"=>"password", "platformCore:account"=>"1234", "platformCore:role"=>234}}
|
23
|
+
savon.expects(:login).with(:message => message).returns(File.read('spec/support/fixtures/login/failure_invalid_credentials.xml'))
|
24
|
+
|
25
|
+
result = NetSuite::Actions::Login.call({
|
26
|
+
email: 'email',
|
27
|
+
password: 'password',
|
28
|
+
role: 234
|
29
|
+
})
|
30
|
+
|
31
|
+
expect(result.success?).to eq(false)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'handles a failed login call because of a concurrent request error' do
|
35
|
+
message = {"platformMsgs:passport"=>{"platformCore:email"=>"email", "platformCore:password"=>"password", "platformCore:account"=>"1234", "platformCore:role"=>234}}
|
36
|
+
savon.expects(:login).with(:message => message).returns(File.read('spec/support/fixtures/login/failure_concurrent_requests.xml'))
|
37
|
+
|
38
|
+
expect { NetSuite::Actions::Login.call({
|
39
|
+
email: 'email',
|
40
|
+
password: 'password',
|
41
|
+
role: 234
|
42
|
+
}) }.to raise_error(Savon::SOAPFault)
|
43
|
+
end
|
21
44
|
end
|
@@ -141,15 +141,15 @@ describe NetSuite::Records::JournalEntry do
|
|
141
141
|
|
142
142
|
it 'returns a hash of attributes that can be used in a SOAP request' do
|
143
143
|
expect(entry.to_record).to eql({
|
144
|
-
'
|
145
|
-
'
|
144
|
+
'tranGeneral:tranId' => '1234',
|
145
|
+
'tranGeneral:approved' => true
|
146
146
|
})
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
150
|
describe '#record_type' do
|
151
151
|
it 'returns a string type for the record to be used in a SOAP request' do
|
152
|
-
expect(entry.record_type).to eql('
|
152
|
+
expect(entry.record_type).to eql('tranGeneral:JournalEntry')
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
@@ -7,7 +7,7 @@ describe NetSuite::Records::VendorBillItem do
|
|
7
7
|
[
|
8
8
|
:amortization_end_date, :amortization_residual, :amortiz_start_date, :bin_numbers, :bill_variance_status,
|
9
9
|
:description, :expiration_date, :gross_amt, :inventory_detail, :is_billable, :landed_cost, :line,
|
10
|
-
:order_doc, :order_line, :quantity, :serial_numbers, :tax_rate_1, :tax_rate_2, :tax_1_amt, :vendor_name
|
10
|
+
:order_doc, :order_line, :quantity, :serial_numbers, :tax_rate_1, :tax_rate_2, :tax_1_amt, :vendor_name, :rate
|
11
11
|
].each do |field|
|
12
12
|
expect(item).to have_field(field)
|
13
13
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
2
|
+
<soapenv:Body>
|
3
|
+
<soapenv:Fault>
|
4
|
+
<faultcode>soapenv:Server.userException</faultcode>
|
5
|
+
<faultstring>Only one request may be made against a session at a time</faultstring>
|
6
|
+
<detail>
|
7
|
+
<platformFaults:exceededRequestLimitFault xmlns:platformFaults="urn:faults_2011_2.platform.webservices.netsuite.com">
|
8
|
+
<platformFaults:code>WS_CONCUR_SESSION_DISALLWD</platformFaults:code>
|
9
|
+
<platformFaults:message>Only one request may be made against a session at a time</platformFaults:message>
|
10
|
+
</platformFaults:exceededRequestLimitFault>
|
11
|
+
<ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">partners-java10003.bos.netledger.com</ns1:hostname>
|
12
|
+
</detail>
|
13
|
+
</soapenv:Fault>
|
14
|
+
</soapenv:Body>
|
15
|
+
</soapenv:Envelope>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
2
|
+
<soapenv:Body>
|
3
|
+
<soapenv:Fault>
|
4
|
+
<faultcode>soapenv:Server.userException</faultcode>
|
5
|
+
<faultstring>Only one request may be made against a session at a time</faultstring>
|
6
|
+
<detail>
|
7
|
+
<platformFaults:invalidCredentialsFault xmlns:platformFaults="urn:faults_2011_2.platform.webservices.netsuite.com">
|
8
|
+
<platformFaults:code>INVALID_LOGIN_CREDENTIALS</platformFaults:code>
|
9
|
+
<platformFaults:message>You have entered an invalid email address or account number. Please try again.</platformFaults:message>
|
10
|
+
</platformFaults:invalidCredentialsFault>
|
11
|
+
<ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">partners-java10003.bos.netledger.com</ns1:hostname>
|
12
|
+
</detail>
|
13
|
+
</soapenv:Fault>
|
14
|
+
</soapenv:Body>
|
15
|
+
</soapenv:Envelope>
|
File without changes
|
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.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Moran
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-12-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|
@@ -194,6 +194,7 @@ files:
|
|
194
194
|
- lib/netsuite/records/promotion_code.rb
|
195
195
|
- lib/netsuite/records/record_ref.rb
|
196
196
|
- lib/netsuite/records/record_ref_list.rb
|
197
|
+
- lib/netsuite/records/rev_rec_schedule.rb
|
197
198
|
- lib/netsuite/records/rev_rec_template.rb
|
198
199
|
- lib/netsuite/records/role_list.rb
|
199
200
|
- lib/netsuite/records/roles.rb
|
@@ -369,7 +370,9 @@ files:
|
|
369
370
|
- spec/support/fixtures/get/get_customer.xml
|
370
371
|
- spec/support/fixtures/get/get_invoice.xml
|
371
372
|
- spec/support/fixtures/initialize/initialize_invoice_from_customer.xml
|
372
|
-
- spec/support/fixtures/login.xml
|
373
|
+
- spec/support/fixtures/login/failure_concurrent_requests.xml
|
374
|
+
- spec/support/fixtures/login/failure_invalid_credentials.xml
|
375
|
+
- spec/support/fixtures/login/success.xml
|
373
376
|
- spec/support/fixtures/search/saved_search_customer.xml
|
374
377
|
- spec/support/fixtures/search/saved_search_joined_custom_customer.xml
|
375
378
|
- spec/support/fixtures/update/update_customer.xml
|
@@ -540,7 +543,9 @@ test_files:
|
|
540
543
|
- spec/support/fixtures/get/get_customer.xml
|
541
544
|
- spec/support/fixtures/get/get_invoice.xml
|
542
545
|
- spec/support/fixtures/initialize/initialize_invoice_from_customer.xml
|
543
|
-
- spec/support/fixtures/login.xml
|
546
|
+
- spec/support/fixtures/login/failure_concurrent_requests.xml
|
547
|
+
- spec/support/fixtures/login/failure_invalid_credentials.xml
|
548
|
+
- spec/support/fixtures/login/success.xml
|
544
549
|
- spec/support/fixtures/search/saved_search_customer.xml
|
545
550
|
- spec/support/fixtures/search/saved_search_joined_custom_customer.xml
|
546
551
|
- spec/support/fixtures/update/update_customer.xml
|