Class: TingYun::Http::TyphoeusHTTPResponse
- Inherits:
-
Object
- Object
- TingYun::Http::TyphoeusHTTPResponse
- Defined in:
- lib/ting_yun/http/typhoeus_wrappers.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(response) ⇒ TyphoeusHTTPResponse
constructor
A new instance of TyphoeusHTTPResponse.
- #to_hash ⇒ Object
Constructor Details
#initialize(response) ⇒ TyphoeusHTTPResponse
Returns a new instance of TyphoeusHTTPResponse.
8 9 10 |
# File 'lib/ting_yun/http/typhoeus_wrappers.rb', line 8 def initialize(response) @response = response end |
Instance Method Details
#[](key) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/ting_yun/http/typhoeus_wrappers.rb', line 12 def [](key) unless headers.nil? result = headers[key] # Typhoeus 0.5.3 has a bug where asking the headers hash for a # non-existent header will return the hash itself, not what we want. result == headers ? nil : result end end |
#to_hash ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/ting_yun/http/typhoeus_wrappers.rb', line 22 def to_hash hash = {} headers.each do |(k,v)| hash[k] = v end hash end |