netsuite 0.0.45 → 0.0.47

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,15 +11,15 @@ module NetSuite
11
11
 
12
12
  def request
13
13
  connection.request :platformMsgs, :add do
14
- soap.namespaces['xmlns:platformMsgs'] = 'urn:messages_2011_2.platform.webservices.netsuite.com'
15
- soap.namespaces['xmlns:platformCore'] = 'urn:core_2011_2.platform.webservices.netsuite.com'
16
- soap.namespaces['xmlns:listRel'] = 'urn:relationships_2011_2.lists.webservices.netsuite.com'
17
- soap.namespaces['xmlns:tranSales'] = 'urn:sales_2011_2.transactions.webservices.netsuite.com'
18
- soap.namespaces['xmlns:platformCommon'] = 'urn:common_2011_2.platform.webservices.netsuite.com'
19
- soap.namespaces['xmlns:listAcct'] = 'urn:accounting_2011_2.lists.webservices.netsuite.com'
20
- soap.namespaces['xmlns:tranCust'] = 'urn:customers_2011_2.transactions.webservices.netsuite.com'
21
- soap.namespaces['xmlns:setupCustom'] = 'urn:customization_2011_2.setup.webservices.netsuite.com'
22
- soap.namespaces['xmlns:tranGeneral'] = 'urn:general_2011_2.transactions.webservices.netsuite.com'
14
+ soap.namespaces['xmlns:platformMsgs'] = "urn:messages_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
15
+ soap.namespaces['xmlns:platformCore'] = "urn:core_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
16
+ soap.namespaces['xmlns:listRel'] = "urn:relationships_#{NetSuite::Configuration.api_version}.lists.webservices.netsuite.com"
17
+ soap.namespaces['xmlns:tranSales'] = "urn:sales_#{NetSuite::Configuration.api_version}.transactions.webservices.netsuite.com"
18
+ soap.namespaces['xmlns:platformCommon'] = "urn:common_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
19
+ soap.namespaces['xmlns:listAcct'] = "urn:accounting_#{NetSuite::Configuration.api_version}.lists.webservices.netsuite.com"
20
+ soap.namespaces['xmlns:tranCust'] = "urn:customers_#{NetSuite::Configuration.api_version}.transactions.webservices.netsuite.com"
21
+ soap.namespaces['xmlns:setupCustom'] = "urn:customization_#{NetSuite::Configuration.api_version}.setup.webservices.netsuite.com"
22
+ soap.namespaces['xmlns:tranGeneral'] = "urn:general_#{NetSuite::Configuration.api_version}.transactions.webservices.netsuite.com"
23
23
  soap.header = auth_header
24
24
  soap.body = request_body
25
25
  end
@@ -12,8 +12,8 @@ module NetSuite
12
12
 
13
13
  def request
14
14
  connection.request :platformMsgs, :delete do
15
- soap.namespaces['xmlns:platformMsgs'] = 'urn:messages_2011_2.platform.webservices.netsuite.com'
16
- soap.namespaces['xmlns:platformCore'] = 'urn:core_2011_2.platform.webservices.netsuite.com'
15
+ soap.namespaces['xmlns:platformMsgs'] = "urn:messages_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
16
+ soap.namespaces['xmlns:platformCore'] = "urn:core_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
17
17
  soap.header = auth_header
18
18
  soap.body = request_body
19
19
  end
@@ -12,8 +12,8 @@ module NetSuite
12
12
 
13
13
  def request
14
14
  connection.request :platformMsgs, :get do
15
- soap.namespaces['xmlns:platformMsgs'] = 'urn:messages_2011_2.platform.webservices.netsuite.com'
16
- soap.namespaces['xmlns:platformCore'] = 'urn:core_2011_2.platform.webservices.netsuite.com'
15
+ soap.namespaces['xmlns:platformMsgs'] = "urn:messages_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
16
+ soap.namespaces['xmlns:platformCore'] = "urn:core_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
17
17
  soap.header = auth_header
18
18
  soap.body = request_body
19
19
  end
@@ -10,9 +10,9 @@ module NetSuite
10
10
 
11
11
  def request
12
12
  connection.request :platformMsgs, :initialize do
13
- soap.namespaces['xmlns:platformMsgs'] = 'urn:messages_2011_2.platform.webservices.netsuite.com'
14
- soap.namespaces['xmlns:platformCore'] = 'urn:core_2011_2.platform.webservices.netsuite.com'
15
- soap.namespaces['xmlns:platformCoreTyp'] = 'urn:types.core_2011_2.platform.webservices.netsuite.com'
13
+ soap.namespaces['xmlns:platformMsgs'] = "urn:messages_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
14
+ soap.namespaces['xmlns:platformCore'] = "urn:core_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
15
+ soap.namespaces['xmlns:platformCoreTyp'] = "urn:types.core_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
16
16
  soap.header = auth_header
17
17
  soap.body = request_body
18
18
  end
@@ -10,14 +10,14 @@ module NetSuite
10
10
 
11
11
  def request
12
12
  connection.request :platformMsgs, :update do
13
- soap.namespaces['xmlns:platformMsgs'] = 'urn:messages_2011_2.platform.webservices.netsuite.com'
14
- soap.namespaces['xmlns:platformCore'] = 'urn:core_2011_2.platform.webservices.netsuite.com'
15
- soap.namespaces['xmlns:listRel'] = 'urn:relationships_2011_2.lists.webservices.netsuite.com'
16
- soap.namespaces['xmlns:tranSales'] = 'urn:sales_2011_2.transactions.webservices.netsuite.com'
17
- soap.namespaces['xmlns:platformCommon'] = 'urn:common_2011_2.platform.webservices.netsuite.com'
18
- soap.namespaces['xmlns:listAcct'] = 'urn:accounting_2011_2.lists.webservices.netsuite.com'
19
- soap.namespaces['xmlns:tranCust'] = 'urn:customers_2011_2.transactions.webservices.netsuite.com'
20
- soap.namespaces['xmlns:setupCustom'] = 'urn:customization_2011_2.setup.webservices.netsuite.com'
13
+ soap.namespaces['xmlns:platformMsgs'] = "urn:messages_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
14
+ soap.namespaces['xmlns:platformCore'] = "urn:core_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
15
+ soap.namespaces['xmlns:listRel'] = "urn:relationships_#{NetSuite::Configuration.api_version}.lists.webservices.netsuite.com"
16
+ soap.namespaces['xmlns:tranSales'] = "urn:sales_#{NetSuite::Configuration.api_version}.transactions.webservices.netsuite.com"
17
+ soap.namespaces['xmlns:platformCommon'] = "urn:common_#{NetSuite::Configuration.api_version}.platform.webservices.netsuite.com"
18
+ soap.namespaces['xmlns:listAcct'] = "urn:accounting_#{NetSuite::Configuration.api_version}.lists.webservices.netsuite.com"
19
+ soap.namespaces['xmlns:tranCust'] = "urn:customers_#{NetSuite::Configuration.api_version}.transactions.webservices.netsuite.com"
20
+ soap.namespaces['xmlns:setupCustom'] = "urn:customization_#{NetSuite::Configuration.api_version}.setup.webservices.netsuite.com"
21
21
  soap.header = auth_header
22
22
  soap.body = request_body
23
23
  end
@@ -13,6 +13,18 @@ module NetSuite
13
13
  def connection
14
14
  attributes[:connection] ||= Savon::Client.new(self.wsdl)
15
15
  end
16
+
17
+ def api_version(version = nil)
18
+ if version
19
+ self.api_version = version
20
+ else
21
+ attributes[:api_version] ||= '2011_2'
22
+ end
23
+ end
24
+
25
+ def api_version=(version)
26
+ attributes[:api_version] = version
27
+ end
16
28
 
17
29
  def wsdl=(wsdl)
18
30
  attributes[:wsdl] = wsdl
@@ -22,7 +34,7 @@ module NetSuite
22
34
  if wsdl
23
35
  self.wsdl = wsdl
24
36
  else
25
- attributes[:wsdl] ||= File.expand_path('../../../wsdl/2011_02.wsdl', __FILE__)
37
+ attributes[:wsdl] ||= File.expand_path("../../../wsdl/#{api_version}.wsdl", __FILE__)
26
38
  end
27
39
  end
28
40
 
@@ -7,7 +7,7 @@ module NetSuite
7
7
  include Support::Actions
8
8
  include Namespaces::ListAcct
9
9
 
10
- actions :get
10
+ actions :get, :add, :delete
11
11
 
12
12
  fields :available_to_partners, :cost_estimate, :cost_estimate_type, :cost_estimate_units, :country_of_manufacture,
13
13
  :created_date, :custom_field_list, :display_name, :dont_show_price, :enforce_min_qty_internally, :exclude_from_sitemap,
@@ -1,3 +1,3 @@
1
1
  module Netsuite
2
- VERSION = '0.0.45'
2
+ VERSION = '0.0.47'
3
3
  end
@@ -35,7 +35,7 @@ describe NetSuite::Configuration do
35
35
 
36
36
  context 'when the wsdl has not been set' do
37
37
  it 'returns a path to the WSDL to use for the API' do
38
- config.wsdl.should match(/.*\/netsuite\/wsdl\/2011_02\.wsdl/)
38
+ config.wsdl.should match(/.*\/netsuite\/wsdl\/2011_2\.wsdl/)
39
39
  end
40
40
  end
41
41
  end
@@ -144,4 +144,21 @@ describe NetSuite::Configuration do
144
144
  end
145
145
  end
146
146
 
147
+ describe '#api_version' do
148
+ context 'when no api_version is defined' do
149
+ it 'defaults to 2011_2' do
150
+ config.api_version.should == '2011_2'
151
+ end
152
+ end
153
+ end
154
+
155
+ describe '#api_version=' do
156
+ context 'when api version is defined' do
157
+ it 'sets the api_version of the application' do
158
+ config.api_version = '2012_1'
159
+ config.api_version.should == '2012_1'
160
+ end
161
+ end
162
+ end
163
+
147
164
  end
@@ -60,6 +60,56 @@ describe NetSuite::Records::NonInventorySaleItem do
60
60
  end
61
61
  end
62
62
 
63
+ describe '#add' do
64
+ # let(:item) { NetSuite::Records::NonInventorySaleItem.new(:cost => 100, :is_inactive => false) }
65
+
66
+ context 'when the response is successful' do
67
+ let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
68
+
69
+ it 'returns true' do
70
+ NetSuite::Actions::Add.should_receive(:call).
71
+ with(item).
72
+ and_return(response)
73
+ item.add.should be_true
74
+ end
75
+ end
76
+
77
+ context 'when the response is unsuccessful' do
78
+ let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
79
+
80
+ it 'returns false' do
81
+ NetSuite::Actions::Add.should_receive(:call).
82
+ with(item).
83
+ and_return(response)
84
+ item.add.should be_false
85
+ end
86
+ end
87
+ end
88
+
89
+ describe '#delete' do
90
+ context 'when the response is successful' do
91
+ let(:response) { NetSuite::Response.new(:success => true, :body => { :internal_id => '1' }) }
92
+
93
+ it 'returns true' do
94
+ NetSuite::Actions::Delete.should_receive(:call).
95
+ with(item).
96
+ and_return(response)
97
+ item.delete.should be_true
98
+ end
99
+ end
100
+
101
+ context 'when the response is unsuccessful' do
102
+ let(:response) { NetSuite::Response.new(:success => false, :body => {}) }
103
+
104
+ it 'returns false' do
105
+ NetSuite::Actions::Delete.should_receive(:call).
106
+ with(item).
107
+ and_return(response)
108
+ item.delete.should be_false
109
+ end
110
+ end
111
+ end
112
+
63
113
  describe '#to_record' do
64
114
  before do
65
115
  item.handling_cost = 100.0
File without changes
File without changes
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netsuite
3
3
  version: !ruby/object:Gem::Version
4
- hash: 69
4
+ hash: 65
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 45
10
- version: 0.0.45
9
+ - 47
10
+ version: 0.0.47
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Moran
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-03-14 00:00:00 -07:00
18
+ date: 2012-03-16 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -244,8 +244,8 @@ files:
244
244
  - spec/support/read_only_field_matcher.rb
245
245
  - spec/support/record_ref_matcher.rb
246
246
  - spec/support/savon.rb
247
- - wsdl/2011_02.wsdl
248
- - wsdl/2012_01.wsdl
247
+ - wsdl/2011_2.wsdl
248
+ - wsdl/2012_1.wsdl
249
249
  has_rdoc: true
250
250
  homepage: https://github.com/RevolutionPrep/netsuite
251
251
  licenses: []