lib/archivesspace/client/request.rb in archivesspace-client-0.1.12 vs lib/archivesspace/client/request.rb in archivesspace-client-0.2.0

- old
+ new

@@ -8,29 +8,30 @@ def default_headers(method = :get) headers = { delete: {}, get: {}, post: { - 'Content-Type' => 'application/json', - 'Content-Length' => 'nnnn' + "Content-Type" => "application/json", + "Content-Length" => "nnnn" }, put: { - 'Content-Type' => 'application/json', - 'Content-Length' => 'nnnn' + "Content-Type" => "application/json", + "Content-Length" => "nnnn" } } headers[method] end - def initialize(config, method = 'GET', path = '', options = {}) - @config = config - @method = method.downcase.to_sym - @path = path.gsub(%r{^/+}, '') - @options = options + def initialize(config, method = "GET", path = "", options = {}) + @config = config + @method = method.downcase.to_sym + @path = path.gsub(%r{^/+}, "") + @options = options @options[:headers] = options[:headers] ? default_headers(@method).merge(options[:headers]) : default_headers(@method) - @options[:verify] = config.verify_ssl - @options[:query] = {} unless options.key? :query + @options[:verify] = config.verify_ssl + @options[:timeout] = config.timeout + @options[:query] = {} unless options.key? :query self.class.debug_output($stdout) if @config.debug base_uri = config.base_repo&.length&.positive? ? File.join(config.base_uri, config.base_repo) : config.base_uri self.class.base_uri base_uri