Class: Fleck::Client::Response

Inherits:
Object
  • Object
show all
Includes:
Loggable
Defined in:
lib/fleck/client/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Loggable

#logger

Constructor Details

#initialize(payload) ⇒ Response

Returns a new instance of Response.



7
8
9
10
11
12
13
# File 'lib/fleck/client/response.rb', line 7

def initialize(payload)
  @data    = Oj.load(payload).to_hash_with_indifferent_access
  @status  = @data["status"]
  @headers = @data["headers"] || {}
  @body    = @data["body"]
  @errors  = @data["errors"] || []
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



6
7
8
# File 'lib/fleck/client/response.rb', line 6

def body
  @body
end

#errorsObject

Returns the value of attribute errors.



6
7
8
# File 'lib/fleck/client/response.rb', line 6

def errors
  @errors
end

#headersObject

Returns the value of attribute headers.



6
7
8
# File 'lib/fleck/client/response.rb', line 6

def headers
  @headers
end

#statusObject

Returns the value of attribute status.



6
7
8
# File 'lib/fleck/client/response.rb', line 6

def status
  @status
end