Class: Halchemy::HttpModel::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/halchemy/http_model.rb

Overview

Provides HTTP metadata that came along with the response resulting in the Resource this is attached to

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status_code, reason, headers, body = nil) ⇒ Response

Returns a new instance of Response.



29
30
31
32
33
34
# File 'lib/halchemy/http_model.rb', line 29

def initialize(status_code, reason, headers, body = nil)
  @status_code = status_code
  @reason = reason
  @headers = headers
  @body = body
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



27
28
29
# File 'lib/halchemy/http_model.rb', line 27

def body
  @body
end

#errorObject

Returns the value of attribute error.



27
28
29
# File 'lib/halchemy/http_model.rb', line 27

def error
  @error
end

#headersObject

Returns the value of attribute headers.



27
28
29
# File 'lib/halchemy/http_model.rb', line 27

def headers
  @headers
end

#reasonObject

Returns the value of attribute reason.



27
28
29
# File 'lib/halchemy/http_model.rb', line 27

def reason
  @reason
end

#status_codeObject

Returns the value of attribute status_code.



27
28
29
# File 'lib/halchemy/http_model.rb', line 27

def status_code
  @status_code
end

Instance Method Details

#to_sObject



36
37
38
# File 'lib/halchemy/http_model.rb', line 36

def to_s
  "#{@status_code} #{@reason}"
end