Class: Apnotic::Response
- Inherits:
-
Object
- Object
- Apnotic::Response
- Defined in:
- lib/apnotic/response.rb
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(options = {}) ⇒ Response
constructor
A new instance of Response.
- #ok? ⇒ Boolean
- #status ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Response
Returns a new instance of Response.
8 9 10 11 |
# File 'lib/apnotic/response.rb', line 8 def initialize(={}) @headers = [:headers] @body = [:body] end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
6 7 8 |
# File 'lib/apnotic/response.rb', line 6 def headers @headers end |
Instance Method Details
#body ⇒ Object
21 22 23 |
# File 'lib/apnotic/response.rb', line 21 def body JSON.parse(@body) rescue @body end |
#ok? ⇒ Boolean
17 18 19 |
# File 'lib/apnotic/response.rb', line 17 def ok? status == '200' end |
#status ⇒ Object
13 14 15 |
# File 'lib/apnotic/response.rb', line 13 def status @headers[':status'] if @headers end |