Class: Snapcat::Response
- Inherits:
-
Object
- Object
- Snapcat::Response
- Defined in:
- lib/snapcat/response.rb
Constant Summary collapse
- RECOGNIZED_CONTENT_TYPES =
%w(application/json application/octet-stream)
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#http_success ⇒ Object
readonly
Returns the value of attribute http_success.
Instance Method Summary collapse
- #auth_token ⇒ Object
-
#initialize(response, additional_fields = {}) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(response, additional_fields = {}) ⇒ Response
Returns a new instance of Response.
6 7 8 9 10 |
# File 'lib/snapcat/response.rb', line 6 def initialize(response, additional_fields = {}) @data = formatted_result(response).merge(additional_fields) @code = response.code @http_success = response.success? end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
4 5 6 |
# File 'lib/snapcat/response.rb', line 4 def code @code end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
4 5 6 |
# File 'lib/snapcat/response.rb', line 4 def data @data end |
#http_success ⇒ Object (readonly)
Returns the value of attribute http_success.
4 5 6 |
# File 'lib/snapcat/response.rb', line 4 def http_success @http_success end |
Instance Method Details
#auth_token ⇒ Object
12 13 14 |
# File 'lib/snapcat/response.rb', line 12 def auth_token @data[:auth_token] end |
#success? ⇒ Boolean
16 17 18 19 20 21 22 |
# File 'lib/snapcat/response.rb', line 16 def success? if !@data[:logged].nil? !!@data[:logged] else @http_success end end |