Class: Reapal::Http::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Response

Returns a new instance of Response.



10
11
12
13
14
15
16
# File 'lib/reapal/http/response.rb', line 10

def initialize(params)
  self.data_valid = true
  
  params.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



8
9
10
# File 'lib/reapal/http/response.rb', line 8

def data
  @data
end

#data_validObject

Returns the value of attribute data_valid.



8
9
10
# File 'lib/reapal/http/response.rb', line 8

def data_valid
  @data_valid
end

#flow_idObject

Returns the value of attribute flow_id.



6
7
8
# File 'lib/reapal/http/response.rb', line 6

def flow_id
  @flow_id
end

#http_responseObject

Returns the value of attribute http_response.



7
8
9
# File 'lib/reapal/http/response.rb', line 7

def http_response
  @http_response
end

#raw_bodyObject

Returns the value of attribute raw_body.



7
8
9
# File 'lib/reapal/http/response.rb', line 7

def raw_body
  @raw_body
end

#serviceObject

Returns the value of attribute service.



6
7
8
# File 'lib/reapal/http/response.rb', line 6

def service
  @service
end

Instance Method Details

#[](key) ⇒ Object



18
19
20
# File 'lib/reapal/http/response.rb', line 18

def [] key
  instance_variable_get("#{key}")
end

#to_sObject



22
23
24
25
26
27
28
29
# File 'lib/reapal/http/response.rb', line 22

def to_s
  arr = ["{"]
  self.instance_variables.map{ |value|
    arr << "\t#{value.to_s} => #{self[value.to_sym]}"
  }
  arr << ["}"]
  arr.join("\n")
end