Class: Spyonweb::Response
- Inherits:
-
Struct
- Object
- Struct
- Spyonweb::Response
- Defined in:
- lib/spyonweb/response.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
Returns the value of attribute response.
-
#result ⇒ Object
Returns the value of attribute result.
-
#status ⇒ Object
Returns the value of attribute status.
Class Method Summary collapse
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response
3 4 5 |
# File 'lib/spyonweb/response.rb', line 3 def response @response end |
#result ⇒ Object
Returns the value of attribute result
3 4 5 |
# File 'lib/spyonweb/response.rb', line 3 def result @result end |
#status ⇒ Object
Returns the value of attribute status
3 4 5 |
# File 'lib/spyonweb/response.rb', line 3 def status @status end |
Class Method Details
.parse(response) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/spyonweb/response.rb', line 4 def self.parse(response) begin hash = JSON.parse(response.body) status = hash['status'] result = hash['result'] rescue JSON::ParserError => e status = "error" result = e. end Response.new(status, result, response) end |