Class: Orchestrate::API::ItemResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/orchestrate/api/response.rb

Overview

A generic response for a single entity (K/V, Ref, Event)

Instance Attribute Summary collapse

Attributes inherited from Response

#body, #client, #headers, #request_id, #request_time, #status

Instance Method Summary collapse

Methods inherited from Response

#finished?, #on_complete, #success?

Constructor Details

#initialize(faraday_response, client) ⇒ ItemResponse

Instantiate a new Respose

Parameters:

  • faraday_response (Faraday::Response)

    The Faraday response object.

  • client (Orchestrate::Client)

    The client used to generate the response.


90
91
92
93
94
95
96
# File 'lib/orchestrate/api/response.rb', line 90

def initialize(faraday_response, client)
  super(faraday_response, client)
  @response.on_complete do
    @location = headers['Content-Location'] || headers['Location']
    @ref = headers.fetch('Etag','').gsub('"','').sub(/-gzip$/,'')
  end
end

Instance Attribute Details

#locationString (readonly)

Returns The 'Location' of the item.

Returns:

  • (String)

    The 'Location' of the item.


84
85
86
# File 'lib/orchestrate/api/response.rb', line 84

def location
  @location
end

#refString (readonly)

Returns The canonical 'ref' of the item.

Returns:

  • (String)

    The canonical 'ref' of the item.


87
88
89
# File 'lib/orchestrate/api/response.rb', line 87

def ref
  @ref
end