Permalink
Browse files

Add support for role in SOAP header

  • Loading branch information...
1 parent 6aa9be6 commit 1bd1bb0fbaf7486a7b6c0106e5e528b771a3986a @tmann-ttc tmann-ttc committed Jun 23, 2012
Showing with 8 additions and 3 deletions.
  1. +6 −1 lib/netsuite_client/client.rb
  2. +2 −2 test/netsuite_client_test.rb
@@ -37,7 +37,12 @@ def initialize(config = {})
@config = config
@driver = NetSuitePortType.new(@config[:endpoint_url] || NetSuitePortType::DefaultEndpointUrl)
- @driver.headerhandler.add(PassportHeaderHandler.new(:email => @config[:email], :password => @config[:password], :account => @config[:account_id]))
+
+ if @config[:role]
+ role = {:internalID => config[:role]}
+ end
+
+ @driver.headerhandler.add(PassportHeaderHandler.new(:email => @config[:email], :password => @config[:password], :account => @config[:account_id], :role => role))
@driver.headerhandler.add(PreferencesHeaderHandler.new)
@driver.headerhandler.add(SearchPreferencesHeaderHandler.new)
end
@@ -11,8 +11,8 @@ def setup
exit(-1)
end
- @client = NetsuiteClient.new(:account_id => ENV['NS_ACCOUNT_ID'], :email => ENV['NS_EMAIL'], :password => ENV['NS_PASSWORD'], :endpoint_url => ENV['NS_ENDPOINT_URL'])
- #@client.debug = true
+ @client = NetsuiteClient.new(:account_id => ENV['NS_ACCOUNT_ID'], :email => ENV['NS_EMAIL'], :password => ENV['NS_PASSWORD'], :role => ENV['NS_ROLE'], :endpoint_url => ENV['NS_ENDPOINT_URL'])
+ @client.debug = true
end
def test_init

0 comments on commit 1bd1bb0

Please sign in to comment.