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
14
# File 'lib/fleck/client/response.rb', line 7

def initialize(payload)
  @data       = Oj.load(payload, mode: :compat).to_hash_with_indifferent_access
  @status     = @data["status"]
  @headers    = @data["headers"] || {}
  @body       = @data["body"]
  @errors     = @data["errors"] || []
  @deprecated = !!@data["deprecated"]
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

#deprecatedObject

Returns the value of attribute deprecated.



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

def deprecated
  @deprecated
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

Instance Method Details

#deprecated?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/fleck/client/response.rb', line 16

def deprecated?
  @deprecated
end