Skip to content

Commit

Permalink
Add support for role in SOAP header
Browse files Browse the repository at this point in the history
  • Loading branch information
tmann-ttc committed Jun 23, 2012
1 parent 6aa9be6 commit 1bd1bb0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion lib/netsuite_client/client.rb
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/netsuite_client_test.rb
Expand Up @@ -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
Expand Down

0 comments on commit 1bd1bb0

Please sign in to comment.