Class: HTTPigeon::Response

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/httpigeon/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request, raw_response) ⇒ Response

Returns a new instance of Response.



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

def initialize(request, raw_response)
  @request = request
  @raw_response = raw_response

  parse_response
end

Instance Attribute Details

#parsed_responseObject (readonly)

Returns the value of attribute parsed_response.



5
6
7
# File 'lib/httpigeon/response.rb', line 5

def parsed_response
  @parsed_response
end

#raw_responseObject (readonly)

Returns the value of attribute raw_response.



5
6
7
# File 'lib/httpigeon/response.rb', line 5

def raw_response
  @raw_response
end

#requestObject (readonly)

Returns the value of attribute request.



5
6
7
# File 'lib/httpigeon/response.rb', line 5

def request
  @request
end

Instance Method Details

#==(other) ⇒ Object



17
18
19
# File 'lib/httpigeon/response.rb', line 17

def ==(other)
  other == parsed_response || other.to_json == to_json || super
end

#[](key) ⇒ Object



21
22
23
# File 'lib/httpigeon/response.rb', line 21

def [](key)
  parsed_response[key]
end