Class: HTTPResponse
- Inherits:
-
Object
- Object
- HTTPResponse
- Defined in:
- lib/TeleRuby/http_response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(status, json) ⇒ HTTPResponse
constructor
A new instance of HTTPResponse.
- #to_a ⇒ Object
Constructor Details
#initialize(status, json) ⇒ HTTPResponse
Returns a new instance of HTTPResponse.
7 8 9 10 11 |
# File 'lib/TeleRuby/http_response.rb', line 7 def initialize(status, json) @status = status @headers = { 'Content-Type' => 'application/json' } @body = [JSON.generate(json)] end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
5 6 7 |
# File 'lib/TeleRuby/http_response.rb', line 5 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
5 6 7 |
# File 'lib/TeleRuby/http_response.rb', line 5 def headers @headers end |
#status ⇒ Object
Returns the value of attribute status.
5 6 7 |
# File 'lib/TeleRuby/http_response.rb', line 5 def status @status end |
Instance Method Details
#to_a ⇒ Object
13 14 15 |
# File 'lib/TeleRuby/http_response.rb', line 13 def to_a [@status, @headers, @body] end |