lib/hello_sign/client.rb in hellosign-ruby-sdk-3.0.3 vs lib/hello_sign/client.rb in hellosign-ruby-sdk-3.0.4

- old
+ new

@@ -104,11 +104,11 @@ def request(path, method, options={}) strip_options_whitespace(options) make_connection(options).send method do |request| if options[:oauth_request] - request.url "#{path}", options[:params] + request.url path, options[:params] else request.url "#{api_version}#{path}", options[:params] end request.body = options[:body] end @@ -120,15 +120,15 @@ if @logging logger = Logger.new(STDOUT) logger.level = @log_level end - connection = Faraday.new(:url => url, :headers => {user_agent: user_agent}) do |faraday| - faraday.request :multipart - faraday.request :url_encoded + connection = Faraday.new(:url => url, :headers => { user_agent: user_agent }) do |faraday| + faraday.request :multipart + faraday.request :url_encoded faraday.response :logger, logger if @logging - faraday.adapter :net_http + faraday.adapter :net_http end if options[:no_auth] elsif auth_token connection.authorization :Bearer, auth_token elsif api_key @@ -145,11 +145,11 @@ raise ERRORS[response.status].new error_message(response) end end def parse(response) - if response["content-type"] == "application/pdf" + if response['content-type'] == 'application/pdf' response.body elsif response.body.strip.empty? {} else MultiJson.load response.body @@ -160,11 +160,11 @@ "Server responded with code #{response.status}\n" \ "Request URI: #{response.to_hash[:url].to_s}\n"\ "Message: #{response.body}" end - def prepare_files opts + def prepare_files(opts) if opts[:files] opts[:files].each_with_index do |file, index| if file.is_a? String opts[:"file[#{index}]"] = Faraday::UploadIO.new(file, 'application/pdf') elsif defined? ActionDispatch::Http::UploadedFile @@ -182,20 +182,20 @@ end opts.delete(:file_urls) end end - def prepare_signers opts + def prepare_signers(opts) prepare opts, :signers end - def prepare_ccs opts + def prepare_ccs(opts) prepare opts, :ccs end def strip_options_whitespace(hash) - hash.each do |k, v| + hash.each do |_, v| case v when String v.strip! when Array v.each {|av| av.strip!} @@ -203,10 +203,10 @@ strip_options_whitespace(v) end end end - def prepare opts, key + def prepare(opts, key) return unless opts[key] opts[key].each_with_index do |value, index| if value.is_a? String opts[:"#{key}[#{index}]"] = value else