diff --git a/lib/hello_sign/client.rb b/lib/hello_sign/client.rb index 4c6d2e0..c3f4ff8 100644 --- a/lib/hello_sign/client.rb +++ b/lib/hello_sign/client.rb @@ -51,7 +51,7 @@ class Client include Api::OAuth include Api::ApiApp - attr_accessor :end_point, :oauth_end_point, :api_version, :user_agent, :client_id, :client_secret, :email_address, :password, :api_key, :auth_token, :logging, :log_level, :proxy_uri, :proxy_user, :proxy_pass + attr_accessor :end_point, :oauth_end_point, :api_version, :user_agent, :client_id, :client_secret, :email_address, :password, :api_key, :auth_token, :logging, :log_level, :proxy_uri, :proxy_user, :proxy_pass, :timeout ERRORS = { 400 => Error::BadRequest, @@ -154,6 +154,7 @@ def make_connection options faraday.request :url_encoded faraday.response :logger, logger if @logging faraday.adapter :net_http + faraday.options[:timeout] = timeout if timeout end if options[:no_auth] elsif auth_token diff --git a/lib/hello_sign/configuration.rb b/lib/hello_sign/configuration.rb index d4abe1e..7904764 100644 --- a/lib/hello_sign/configuration.rb +++ b/lib/hello_sign/configuration.rb @@ -33,7 +33,7 @@ module Configuration DEFAULT_ENDPOINT = 'https://api.hellosign.com' DEFAULT_API_VERSION = '/v3' DEFAULT_OAUTH_ENDPOINT = 'https://app.hellosign.com' - VALID_OPTIONS_KEYS = [:end_point, :oauth_end_point, :api_version, :user_agent, :client_id, :client_secret, :email_address, :password, :api_key, :auth_token, :log_level, :logging, :proxy_uri, :proxy_user, :proxy_pass] + VALID_OPTIONS_KEYS = [:end_point, :oauth_end_point, :api_version, :user_agent, :client_id, :client_secret, :email_address, :password, :api_key, :auth_token, :log_level, :logging, :proxy_uri, :proxy_user, :proxy_pass, :timeout] DEFAULT_USER_AGENT = "hellosign-ruby-sdk/" + HelloSign::VERSION @@ -77,6 +77,7 @@ def reset self.proxy_uri = nil self.proxy_user = nil self.proxy_pass = nil + self.timeout = nil end end end diff --git a/lib/hello_sign/version.rb b/lib/hello_sign/version.rb index 3adc77b..c7d21b5 100644 --- a/lib/hello_sign/version.rb +++ b/lib/hello_sign/version.rb @@ -23,5 +23,5 @@ # module HelloSign - VERSION = '3.6' + VERSION = '3.6.1' end diff --git a/spec/hello_sign/client_spec.rb b/spec/hello_sign/client_spec.rb index 8e43b76..c177f5b 100644 --- a/spec/hello_sign/client_spec.rb +++ b/spec/hello_sign/client_spec.rb @@ -28,7 +28,8 @@ :logging => false, :proxy_uri => 'proxy_uri', :proxy_user => 'proxy_user', - :proxy_pass => 'proxy_pass' + :proxy_pass => 'proxy_pass', + :timeout => 240 } } subject(:client) { HelloSign::Client.new custom_client } @@ -37,6 +38,14 @@ expect(client.send(key)).to eql(custom_client[key]) end end + + it "should create a new HelloSign Client" do + expect(client).to be_an_instance_of(HelloSign::Client) + end + + it "should have 'timeout' as a parameter" do + expect(client.timeout).to eq(240) + end end end