Class: HTTParty::FragmentWithResponse

Inherits:
SimpleDelegator
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/httparty/fragment_with_response.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) ⇒ FragmentWithResponse

Returns a new instance of FragmentWithResponse.



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

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

Instance Attribute Details

#http_responseObject (readonly)

Returns the value of attribute http_response.



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

def http_response
  @http_response
end

Instance Method Details

#codeObject



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

def code
  @http_response.code.to_i
end