diff --git a/lib/netsuite/configuration.rb b/lib/netsuite/configuration.rb index 0eaf0ae6..91fe7025 100644 --- a/lib/netsuite/configuration.rb +++ b/lib/netsuite/configuration.rb @@ -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, @@ -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 diff --git a/spec/netsuite/configuration_spec.rb b/spec/netsuite/configuration_spec.rb index 9d5f9ee8..c1e54474 100644 --- a/spec/netsuite/configuration_spec.rb +++ b/spec/netsuite/configuration_spec.rb @@ -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