Class: Apis::Response
- Inherits:
-
Object
- Object
- Apis::Response
- Defined in:
- lib/apis/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
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize(status, headers, body) ⇒ Response
constructor
A new instance of Response.
- #to_a ⇒ Object (also: #to_ary)
- #to_env ⇒ Object
Constructor Details
#initialize(status, headers, body) ⇒ Response
Returns a new instance of Response.
4 5 6 |
# File 'lib/apis/response.rb', line 4 def initialize(status, headers, body) @status, @headers, @body = status, headers, body end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
3 4 5 |
# File 'lib/apis/response.rb', line 3 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
3 4 5 |
# File 'lib/apis/response.rb', line 3 def headers @headers end |
#status ⇒ Object
Returns the value of attribute status.
3 4 5 |
# File 'lib/apis/response.rb', line 3 def status @status end |
Instance Method Details
#[](key) ⇒ Object
17 18 19 |
# File 'lib/apis/response.rb', line 17 def [](key) respond_to?(key) ? send(key) : nil end |
#[]=(key, value) ⇒ Object
21 22 23 |
# File 'lib/apis/response.rb', line 21 def []=(key, value) send("#{key}=", value) if respond_to?("#{key}=") end |
#to_a ⇒ Object Also known as: to_ary
12 13 14 |
# File 'lib/apis/response.rb', line 12 def to_a [status, headers, body] end |
#to_env ⇒ Object
8 9 10 |
# File 'lib/apis/response.rb', line 8 def to_env {:status => status, :headers => headers, :body => body} end |