Class: Memoir::Response

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

Constant Summary collapse

STATUS_OK =
200

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(faraday_response) ⇒ Response

Returns a new instance of Response.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/memoir/response.rb', line 6

def initialize(faraday_response)
  @data_sets = []
  @status = faraday_response.status
  @raw = faraday_response.body

  if status == STATUS_OK
    parse_response(raw)
  else
    @error = Memoir::Error.new(raw['error'])
  end
end

Instance Attribute Details

#data_setsObject

Returns the value of attribute data_sets.



2
3
4
# File 'lib/memoir/response.rb', line 2

def data_sets
  @data_sets
end

#errorObject

Returns the value of attribute error.



2
3
4
# File 'lib/memoir/response.rb', line 2

def error
  @error
end

#rawObject

Returns the value of attribute raw.



2
3
4
# File 'lib/memoir/response.rb', line 2

def raw
  @raw
end

#stats_summaryObject

Returns the value of attribute stats_summary.



2
3
4
# File 'lib/memoir/response.rb', line 2

def stats_summary
  @stats_summary
end

#statusObject

Returns the value of attribute status.



2
3
4
# File 'lib/memoir/response.rb', line 2

def status
  @status
end