Class: Orchestrate::API::Response::Header

Inherits:
Object
  • Object
show all
Defined in:
lib/orchestrate_api/response.rb

Overview

Provides methods for ready access to relevant information extracted from the HTTParty response headers.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(headers, code, msg) ⇒ Header

Returns a new instance of Header.



49
50
51
52
53
54
55
# File 'lib/orchestrate_api/response.rb', line 49

def initialize(headers, code, msg)
  @content = headers
  @code, @status = code, msg
  @timestamp = headers['date']
  @etag = headers['etag'] if headers['etag']
  @link = headers['link'] if headers['link']
end

Instance Attribute Details

#codeObject (readonly)

HTTP response code.



36
37
38
# File 'lib/orchestrate_api/response.rb', line 36

def code
  @code
end

#contentObject (readonly)

Original response headers from HTTParty.



33
34
35
# File 'lib/orchestrate_api/response.rb', line 33

def content
  @content
end

#etagObject (readonly)

ETag value, also known as the ‘ref’ value.



44
45
46
# File 'lib/orchestrate_api/response.rb', line 44

def etag
  @etag
end

Link to the next url in a series of list requests.



47
48
49
# File 'lib/orchestrate_api/response.rb', line 47

def link
  @link
end

#statusObject (readonly)

HTTP response status.



39
40
41
# File 'lib/orchestrate_api/response.rb', line 39

def status
  @status
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



41
42
43
# File 'lib/orchestrate_api/response.rb', line 41

def timestamp
  @timestamp
end