lib/archivesspace/client/request.rb in archivesspace-client-0.1.4 vs lib/archivesspace/client/request.rb in archivesspace-client-0.1.5
- old
+ new
@@ -19,21 +19,22 @@
}
headers[method]
end
def initialize(config, method = "GET", path = "", options = {})
- @config = config
- @method = method.downcase.to_sym
- @path = path.gsub(/^\/+/, '')
+ @config = config
+ @method = method.downcase.to_sym
+ @path = path.gsub(/^\/+/, '')
+ @options = options
+ @options[:headers] = options[:headers] ? default_headers(@method).merge(options[:headers]) : default_headers(@method)
+ @options[:verify] = config.verify_ssl
+ @options[:query] = {} unless options.has_key? :query
- @options = options
- @options[:headers] = options[:headers] ? default_headers(@method).merge(options[:headers]) : default_headers(@method)
- @options[:verify] = config.verify_ssl
- @options[:query] = {} unless options.has_key? :query
+ base_uri = (
+ config.base_repo.nil? or config.base_repo.empty?
+ ) ? config.base_uri : "#{config.base_uri}/#{config.base_repo}"
- base_uri = (config.base_repo.nil? or config.base_repo.empty?) ? config.base_uri : "#{config.base_uri}/#{config.base_repo}"
self.class.base_uri base_uri
- # self.class.default_params abc: 123
end
def execute
self.class.send method, "/#{path}", options
end