Class: Filespot::Response
- Inherits:
-
Object
- Object
- Filespot::Response
- Defined in:
- lib/filespot/response.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/filespot/response.rb', line 7 def initialize(response) if response.status == 200 json_data = JSON.parse(response.body) @code = json_data.delete('code').to_i @status = json_data.delete('status') @data = json_data else return_error end end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
5 6 7 |
# File 'lib/filespot/response.rb', line 5 def code @code end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/filespot/response.rb', line 5 def data @data end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/filespot/response.rb', line 5 def status @status end |