Class: TwitterAPI::Response
- Inherits:
-
Object
- Object
- TwitterAPI::Response
- Defined in:
- lib/twitter_api.rb
Instance Method Summary collapse
-
#body ⇒ Object
String.
-
#headers ⇒ Object
Net::HTTPHeader or Hash.
-
#initialize(res) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(res) ⇒ Response
Returns a new instance of Response.
64 65 66 |
# File 'lib/twitter_api.rb', line 64 def initialize(res) @res = res end |
Instance Method Details
#body ⇒ Object
Returns String.
82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/twitter_api.rb', line 82 def body if @res.kind_of?(Net::HTTPResponse) @res.body elsif @res.kind_of?(StringIO) @res.read elsif @res.kind_of?(Tempfile) @res.read else nil end end |
#headers ⇒ Object
Returns Net::HTTPHeader or Hash.
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/twitter_api.rb', line 69 def headers if @res.kind_of?(Net::HTTPResponse) @res elsif @res.kind_of?(StringIO) @res. elsif @res.kind_of?(Tempfile) @res. else nil end end |