Class: ArchivesSpace::Request
- Inherits:
-
Object
- Object
- ArchivesSpace::Request
- Includes:
- HTTParty
- Defined in:
- lib/archivesspace/client/request.rb
Constant Summary collapse
- DEFAULT_HEADERS =
{"Content-Type" => "application/json"}.freeze
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(context, config, method = "GET", path = "", options = {}) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(context, config, method = "GET", path = "", options = {}) ⇒ Request
Returns a new instance of Request.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/archivesspace/client/request.rb', line 11 def initialize(context, config, method = "GET", path = "", = {}) @config = config @method = method.downcase.to_sym @path = path.gsub(%r{^/+}, "") @options = @options[:headers] = DEFAULT_HEADERS.merge(@options.fetch(:headers, {})) @options[:headers]["User-Agent"] = "#{Client::NAME}/#{Client::VERSION}" @options[:verify] = config.verify_ssl @options[:timeout] = config.timeout @options[:query] = {} unless .key? :query self.class.debug_output($stdout) if @config.debug self.class.base_uri context ? "#{config.base_uri}/#{context}" : config.base_uri end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/archivesspace/client/request.rb', line 7 def config @config end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
7 8 9 |
# File 'lib/archivesspace/client/request.rb', line 7 def headers @headers end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
7 8 9 |
# File 'lib/archivesspace/client/request.rb', line 7 def method @method end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/archivesspace/client/request.rb', line 7 def @options end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/archivesspace/client/request.rb', line 7 def path @path end |