activenetsuite 0.1.0
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 +7 -0
- data/.gemtest +0 -0
- data/.rspec +1 -0
- data/CHANGELOG +0 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +51 -0
- data/History.txt +3 -0
- data/Manifest.txt +60 -0
- data/README.rdoc +14 -0
- data/Rakefile +14 -0
- data/activenetsuite.gemspec +30 -0
- data/lib/activenetsuite.rb +30 -0
- data/lib/activenetsuite/accounting/account.rb +11 -0
- data/lib/activenetsuite/accounting/non_inventory_sale_item.rb +10 -0
- data/lib/activenetsuite/core/custom_field_list.rb +7 -0
- data/lib/activenetsuite/core/custom_field_ref.rb +8 -0
- data/lib/activenetsuite/core/deleted_record.rb +10 -0
- data/lib/activenetsuite/core/get_deleted_result.rb +13 -0
- data/lib/activenetsuite/core/record.rb +254 -0
- data/lib/activenetsuite/core/record_ref.rb +35 -0
- data/lib/activenetsuite/core/search_record.rb +97 -0
- data/lib/activenetsuite/core/search_result.rb +12 -0
- data/lib/activenetsuite/core/status.rb +50 -0
- data/lib/activenetsuite/helpers/client.rb +135 -0
- data/lib/activenetsuite/helpers/error.rb +7 -0
- data/lib/activenetsuite/helpers/method_inflector.rb +78 -0
- data/lib/activenetsuite/helpers/response_methods.rb +21 -0
- data/lib/activenetsuite/helpers/search_response_methods.rb +62 -0
- data/lib/activenetsuite/messages/add_response.rb +8 -0
- data/lib/activenetsuite/messages/delete_list_response.rb +19 -0
- data/lib/activenetsuite/messages/delete_response.rb +8 -0
- data/lib/activenetsuite/messages/get_deleted_response.rb +23 -0
- data/lib/activenetsuite/messages/get_deleted_result.rb +21 -0
- data/lib/activenetsuite/messages/get_response.rb +13 -0
- data/lib/activenetsuite/messages/read_response.rb +7 -0
- data/lib/activenetsuite/messages/search_more_with_id_response.rb +8 -0
- data/lib/activenetsuite/messages/search_response.rb +8 -0
- data/lib/activenetsuite/messages/update_response.rb +8 -0
- data/lib/activenetsuite/messages/write_response.rb +16 -0
- data/lib/activenetsuite/relationships/partner.rb +18 -0
- data/lib/activenetsuite/relationships/vendor.rb +14 -0
- data/lib/activenetsuite/sales/cash_refund.rb +12 -0
- data/lib/activenetsuite/sales/cash_sale.rb +12 -0
- data/lib/activenetsuite/soap/NetSuiteServiceClient.rb +978 -0
- data/lib/activenetsuite/soap/default.rb +68163 -0
- data/lib/activenetsuite/soap/defaultDriver.rb +419 -0
- data/lib/activenetsuite/soap/defaultMappingRegistry.rb +62549 -0
- data/lib/activenetsuite/version.rb +3 -0
- data/spec/lib/activenetsuite/accounting/non_inventory_sale_item_spec.rb +9 -0
- data/spec/lib/activenetsuite/core/record_ref_spec.rb +56 -0
- data/spec/lib/activenetsuite/core/record_spec.rb +298 -0
- data/spec/lib/activenetsuite/core/search_record_spec.rb +50 -0
- data/spec/lib/activenetsuite/core/search_result_spec.rb +26 -0
- data/spec/lib/activenetsuite/helpers/client_spec.rb +115 -0
- data/spec/lib/activenetsuite/helpers/method_inflector_spec.rb +85 -0
- data/spec/lib/activenetsuite/helpers/search_response_methods_spec.rb +50 -0
- data/spec/lib/activenetsuite/messages/search_response_spec.rb +5 -0
- data/spec/lib/activenetsuite/relationships/partner_spec.rb +22 -0
- data/spec/lib/activenetsuite/relationships/vendor_spec.rb +14 -0
- data/spec/lib/activenetsuite/sales/cash_refund_spec.rb +10 -0
- data/spec/lib/activenetsuite/sales/cash_sale_spec.rb +10 -0
- data/spec/spec_helper.rb +17 -0
- metadata +138 -0
@@ -0,0 +1,115 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Client do
|
4
|
+
let(:client) { Client.new }
|
5
|
+
|
6
|
+
describe Client::SearchPreferencesHeaderHandler do
|
7
|
+
subject { Client::SearchPreferencesHeaderHandler }
|
8
|
+
|
9
|
+
its(:superclass) { should eq Client::ActiveNetsuiteHeader }
|
10
|
+
it { subject::Name.should eq 'searchPreferences' }
|
11
|
+
it do
|
12
|
+
subject::DefaultPrefs.should == {
|
13
|
+
bodyFieldsOnly: false,
|
14
|
+
pageSize: 25
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe Client::PreferencesHeaderHandler do
|
20
|
+
subject { Client::PreferencesHeaderHandler }
|
21
|
+
|
22
|
+
its(:superclass) { should eq Client::ActiveNetsuiteHeader }
|
23
|
+
it { subject::Name.should eq 'preferences' }
|
24
|
+
it do
|
25
|
+
subject::DefaultPrefs.should == {
|
26
|
+
warningAsError: false,
|
27
|
+
ignoreReadOnlyFields: true
|
28
|
+
}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe Client::PassportHeaderHandler do
|
33
|
+
subject { Client::PassportHeaderHandler }
|
34
|
+
|
35
|
+
its(:superclass) { should eq Client::ActiveNetsuiteHeader }
|
36
|
+
it { subject::Name.should eq 'passport' }
|
37
|
+
it do
|
38
|
+
subject::DefaultPrefs.should == {
|
39
|
+
account: '',
|
40
|
+
email: '',
|
41
|
+
password: ''
|
42
|
+
}
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#logger' do
|
47
|
+
subject { client.logger }
|
48
|
+
it { should be_a Logger }
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '#get' do
|
52
|
+
subject { client.get ref }
|
53
|
+
|
54
|
+
let(:ref) { double }
|
55
|
+
let(:res) { double }
|
56
|
+
|
57
|
+
it do
|
58
|
+
client.driver.should_receive(:get) do |req|
|
59
|
+
req.should be_a GetRequest
|
60
|
+
req.baseRef.should eq ref
|
61
|
+
res
|
62
|
+
end
|
63
|
+
should eq res
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe '#get_all' do
|
68
|
+
subject { client.get_all refs }
|
69
|
+
|
70
|
+
let(:refs) { double }
|
71
|
+
let(:res) { double }
|
72
|
+
|
73
|
+
it do
|
74
|
+
client.driver.should_receive(:getAll) do |req|
|
75
|
+
req.should be_a GetAllRequest
|
76
|
+
req.record.should eq refs
|
77
|
+
res
|
78
|
+
end
|
79
|
+
should eq res
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe '#add' do
|
84
|
+
subject { client.add rec }
|
85
|
+
|
86
|
+
let(:rec) { double }
|
87
|
+
let(:res) { double }
|
88
|
+
|
89
|
+
it do
|
90
|
+
client.driver.should_receive(:add) do |req|
|
91
|
+
req.should be_a AddRequest
|
92
|
+
req.record.should eq rec
|
93
|
+
res
|
94
|
+
end
|
95
|
+
should eq res
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe '#add_list' do
|
100
|
+
subject { client.add_list recs }
|
101
|
+
|
102
|
+
let(:recs) { [double] }
|
103
|
+
let(:res) { double }
|
104
|
+
|
105
|
+
it do
|
106
|
+
client.driver.should_receive(:addList) do |req|
|
107
|
+
req.should be_a AddListRequest
|
108
|
+
req.should have(1).record
|
109
|
+
req.first.should eq recs.first
|
110
|
+
res
|
111
|
+
end
|
112
|
+
should eq res
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MethodInflector do
|
4
|
+
class Model
|
5
|
+
include MethodInflector
|
6
|
+
|
7
|
+
attr_accessor :xmlattr_internalId, :xmlattr_externalId
|
8
|
+
|
9
|
+
attr_reader :fooBarBaz
|
10
|
+
attr_reader :isCool
|
11
|
+
attr_reader :customFieldList
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:model) { Model.new }
|
15
|
+
|
16
|
+
describe '#method_missing' do
|
17
|
+
subject { model.method_missing method, args, block }
|
18
|
+
let(:args) { double }
|
19
|
+
let(:block) { double }
|
20
|
+
let(:result) { double }
|
21
|
+
|
22
|
+
context 'when it is one of the xmlattr_ methods' do
|
23
|
+
context 'when method is internal_id' do
|
24
|
+
let(:method) { :internal_id }
|
25
|
+
it do
|
26
|
+
model.should_receive(:xmlattr_internalId) { result }
|
27
|
+
should eq result
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'when method is external_id' do
|
32
|
+
let(:method) { :external_id }
|
33
|
+
it do
|
34
|
+
model.should_receive(:xmlattr_externalId) { result }
|
35
|
+
should eq result
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'when method is internal_id=' do
|
40
|
+
let(:method) { :internal_id= }
|
41
|
+
it do
|
42
|
+
model.should_receive(:xmlattr_internalId=) { result }
|
43
|
+
should eq result
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'when method is external_id=' do
|
48
|
+
let(:method) { :external_id= }
|
49
|
+
it do
|
50
|
+
model.should_receive(:xmlattr_externalId=) { result }
|
51
|
+
should eq result
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'when it is a `regular` method' do
|
57
|
+
let(:method) { :foo_bar_baz }
|
58
|
+
it do
|
59
|
+
model.should_receive(:fooBarBaz) { result }
|
60
|
+
should eq result
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context 'when it is a boolean is_ method' do
|
65
|
+
let(:method) { :cool? }
|
66
|
+
it do
|
67
|
+
model.should_receive(:isCool) { result }
|
68
|
+
should eq result
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'when it is a `special` method' do
|
73
|
+
let(:method) { :custom_fields }
|
74
|
+
it do
|
75
|
+
model.should_receive(:customFieldList) { result }
|
76
|
+
should eq result
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
context 'non existing method' do
|
81
|
+
let(:method) { :does_not_exist }
|
82
|
+
it { expect { subject }.to raise_error NameError }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SearchResponseMethods do
|
4
|
+
class Response
|
5
|
+
include SearchResponseMethods
|
6
|
+
attr_accessor :records
|
7
|
+
end
|
8
|
+
let(:response) { Response.new }
|
9
|
+
before do
|
10
|
+
response.stub(
|
11
|
+
status: status,
|
12
|
+
result: result
|
13
|
+
)
|
14
|
+
end
|
15
|
+
let(:status) { double }
|
16
|
+
let(:result) { double }
|
17
|
+
|
18
|
+
describe '#each' do
|
19
|
+
subject { response.each }
|
20
|
+
before { response.records = [1,2,3] }
|
21
|
+
its(:to_a) { should eq [1,2,3] }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#success?' do
|
25
|
+
subject { response.success? }
|
26
|
+
let(:status) { double xmlattr_isSuccess: true }
|
27
|
+
it { should be_true }
|
28
|
+
end
|
29
|
+
|
30
|
+
describe ":[]" do
|
31
|
+
subject { response[3] }
|
32
|
+
before { response.stub(:records) { [5,6,7,8,9] } }
|
33
|
+
it { should eq 8 }
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '#next' do
|
37
|
+
subject { response.next }
|
38
|
+
before do
|
39
|
+
response.stub(:result) do
|
40
|
+
double page_index: 5
|
41
|
+
end
|
42
|
+
Record.client = double
|
43
|
+
end
|
44
|
+
|
45
|
+
it do
|
46
|
+
Record.client.should_receive(:search_next).with(response, 6)
|
47
|
+
subject
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Partner do
|
4
|
+
let(:model) { Partner.new }
|
5
|
+
before do
|
6
|
+
model.internal_id = 123
|
7
|
+
end
|
8
|
+
|
9
|
+
describe '#vendor' do
|
10
|
+
subject { model.vendor }
|
11
|
+
|
12
|
+
it { should be_a Vendor }
|
13
|
+
its(:internal_id) { should eq 123 }
|
14
|
+
it { should be model.vendor } # memoized
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#eligible_for_commission?' do
|
18
|
+
subject { model.eligible_for_commission? }
|
19
|
+
before { model.eligible_for_commission = :yes }
|
20
|
+
it { should eq :yes }
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Vendor do
|
4
|
+
let(:model) { Vendor.new }
|
5
|
+
|
6
|
+
describe '#partner' do
|
7
|
+
subject { model.partner }
|
8
|
+
before { model.internal_id = 123 }
|
9
|
+
|
10
|
+
it { should be_a Partner }
|
11
|
+
its(:internal_id) { should eq 123 }
|
12
|
+
it { should eq model.partner } # memoized
|
13
|
+
end
|
14
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start do
|
3
|
+
add_filter do |src|
|
4
|
+
src.filename.start_with? SimpleCov.root + '/lib/ActiveNetsuite/soap/'
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
9
|
+
$:.unshift File.expand_path(File.join(File.dirname(__FILE__)))
|
10
|
+
require 'activenetsuite'
|
11
|
+
require 'webmock'
|
12
|
+
|
13
|
+
include ActiveNetsuite
|
14
|
+
RSpec.configure do |config|
|
15
|
+
WebMock.disable_net_connect!
|
16
|
+
end
|
17
|
+
|
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: activenetsuite
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stan Mazhara
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rdoc
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: hoe
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.8'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.8'
|
41
|
+
description: Netsuite Object Mapper.
|
42
|
+
email:
|
43
|
+
- akmegran@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files:
|
47
|
+
- History.txt
|
48
|
+
- Manifest.txt
|
49
|
+
- README.rdoc
|
50
|
+
files:
|
51
|
+
- .rspec
|
52
|
+
- CHANGELOG
|
53
|
+
- Gemfile
|
54
|
+
- Gemfile.lock
|
55
|
+
- History.txt
|
56
|
+
- Manifest.txt
|
57
|
+
- README.rdoc
|
58
|
+
- Rakefile
|
59
|
+
- activenetsuite.gemspec
|
60
|
+
- lib/activenetsuite.rb
|
61
|
+
- lib/activenetsuite/accounting/account.rb
|
62
|
+
- lib/activenetsuite/accounting/non_inventory_sale_item.rb
|
63
|
+
- lib/activenetsuite/core/custom_field_list.rb
|
64
|
+
- lib/activenetsuite/core/custom_field_ref.rb
|
65
|
+
- lib/activenetsuite/core/deleted_record.rb
|
66
|
+
- lib/activenetsuite/core/get_deleted_result.rb
|
67
|
+
- lib/activenetsuite/core/record.rb
|
68
|
+
- lib/activenetsuite/core/record_ref.rb
|
69
|
+
- lib/activenetsuite/core/search_record.rb
|
70
|
+
- lib/activenetsuite/core/search_result.rb
|
71
|
+
- lib/activenetsuite/core/status.rb
|
72
|
+
- lib/activenetsuite/helpers/client.rb
|
73
|
+
- lib/activenetsuite/helpers/error.rb
|
74
|
+
- lib/activenetsuite/helpers/method_inflector.rb
|
75
|
+
- lib/activenetsuite/helpers/response_methods.rb
|
76
|
+
- lib/activenetsuite/helpers/search_response_methods.rb
|
77
|
+
- lib/activenetsuite/messages/add_response.rb
|
78
|
+
- lib/activenetsuite/messages/delete_list_response.rb
|
79
|
+
- lib/activenetsuite/messages/delete_response.rb
|
80
|
+
- lib/activenetsuite/messages/get_deleted_response.rb
|
81
|
+
- lib/activenetsuite/messages/get_deleted_result.rb
|
82
|
+
- lib/activenetsuite/messages/get_response.rb
|
83
|
+
- lib/activenetsuite/messages/read_response.rb
|
84
|
+
- lib/activenetsuite/messages/search_more_with_id_response.rb
|
85
|
+
- lib/activenetsuite/messages/search_response.rb
|
86
|
+
- lib/activenetsuite/messages/update_response.rb
|
87
|
+
- lib/activenetsuite/messages/write_response.rb
|
88
|
+
- lib/activenetsuite/relationships/partner.rb
|
89
|
+
- lib/activenetsuite/relationships/vendor.rb
|
90
|
+
- lib/activenetsuite/sales/cash_refund.rb
|
91
|
+
- lib/activenetsuite/sales/cash_sale.rb
|
92
|
+
- lib/activenetsuite/soap/NetSuiteServiceClient.rb
|
93
|
+
- lib/activenetsuite/soap/default.rb
|
94
|
+
- lib/activenetsuite/soap/defaultDriver.rb
|
95
|
+
- lib/activenetsuite/soap/defaultMappingRegistry.rb
|
96
|
+
- lib/activenetsuite/version.rb
|
97
|
+
- spec/lib/activenetsuite/accounting/non_inventory_sale_item_spec.rb
|
98
|
+
- spec/lib/activenetsuite/core/record_ref_spec.rb
|
99
|
+
- spec/lib/activenetsuite/core/record_spec.rb
|
100
|
+
- spec/lib/activenetsuite/core/search_record_spec.rb
|
101
|
+
- spec/lib/activenetsuite/core/search_result_spec.rb
|
102
|
+
- spec/lib/activenetsuite/helpers/client_spec.rb
|
103
|
+
- spec/lib/activenetsuite/helpers/method_inflector_spec.rb
|
104
|
+
- spec/lib/activenetsuite/helpers/search_response_methods_spec.rb
|
105
|
+
- spec/lib/activenetsuite/messages/search_response_spec.rb
|
106
|
+
- spec/lib/activenetsuite/relationships/partner_spec.rb
|
107
|
+
- spec/lib/activenetsuite/relationships/vendor_spec.rb
|
108
|
+
- spec/lib/activenetsuite/sales/cash_refund_spec.rb
|
109
|
+
- spec/lib/activenetsuite/sales/cash_sale_spec.rb
|
110
|
+
- spec/spec_helper.rb
|
111
|
+
- .gemtest
|
112
|
+
homepage: https://github.com/smazhara/activenetsuite
|
113
|
+
licenses:
|
114
|
+
- MIT
|
115
|
+
metadata: {}
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options:
|
118
|
+
- --main
|
119
|
+
- README.rdoc
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
requirements: []
|
133
|
+
rubyforge_project: activenetsuite
|
134
|
+
rubygems_version: 2.0.3
|
135
|
+
signing_key:
|
136
|
+
specification_version: 4
|
137
|
+
summary: Netsuite Object Mapper.
|
138
|
+
test_files: []
|