Skip to content

Commit

Permalink
Accept write_timeout configuration, and supply it along to savoy (#587)
Browse files Browse the repository at this point in the history
  • Loading branch information
nevinera authored Aug 14, 2023
1 parent 6c1a712 commit a23f1f5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/netsuite/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def connection(params={}, credentials={}, soap_header_extra_info={})
endpoint: endpoint,
read_timeout: read_timeout,
open_timeout: open_timeout,
write_timeout: write_timeout,
namespaces: namespaces,
soap_header: auth_header(credentials).update(soap_header).merge(soap_header_extra_info),
pretty_print_xml: true,
Expand Down Expand Up @@ -365,6 +366,18 @@ def open_timeout(timeout = nil)
end
end

def write_timeout=(timeout)
attributes[:write_timeout] = timeout
end

def write_timeout(timeout = nil)
if timeout
self.write_timeout = timeout
else
attributes[:write_timeout]
end
end

def log=(path)
attributes[:log] = path
end
Expand Down
3 changes: 3 additions & 0 deletions spec/netsuite/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -500,14 +500,17 @@
it 'has defaults' do
expect(config.read_timeout).to eql(60)
expect(config.open_timeout).to be_nil
expect(config.write_timeout).to be_nil
end

it 'sets timeouts' do
config.read_timeout = 100
config.open_timeout = 60
config.write_timeout = 14

expect(config.read_timeout).to eql(100)
expect(config.open_timeout).to eql(60)
expect(config.write_timeout).to eql(14)

# ensure no exception is raised
config.connection
Expand Down

0 comments on commit a23f1f5

Please sign in to comment.