Class: HTTParty::ResponseFragment

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/httparty/response_fragment.rb

Overview

Allow access to http_response and code by delegation on fragment

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fragment, http_response, connection) ⇒ ResponseFragment

Returns a new instance of ResponseFragment.



14
15
16
17
18
19
# File 'lib/httparty/response_fragment.rb', line 14

def initialize(fragment, http_response, connection)
  @fragment = fragment
  @http_response = http_response
  @connection = connection
  super fragment
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



8
9
10
# File 'lib/httparty/response_fragment.rb', line 8

def connection
  @connection
end

#http_responseObject (readonly)

Returns the value of attribute http_response.



8
9
10
# File 'lib/httparty/response_fragment.rb', line 8

def http_response
  @http_response
end

Instance Method Details

#codeObject



10
11
12
# File 'lib/httparty/response_fragment.rb', line 10

def code
  @http_response.code.to_i
end