Class: CGMiner::API::Response
- Inherits:
-
Object
- Object
- CGMiner::API::Response
- Defined in:
- lib/cgminer/api/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(status, body) ⇒ Response
constructor
A new instance of Response.
- #received_at ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(status, body) ⇒ Response
Returns a new instance of Response.
10 11 12 13 |
# File 'lib/cgminer/api/response.rb', line 10 def initialize(status, body) @status = status @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
8 9 10 |
# File 'lib/cgminer/api/response.rb', line 8 def body @body end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/cgminer/api/response.rb', line 6 def status @status end |
Instance Method Details
#received_at ⇒ Object
15 16 17 |
# File 'lib/cgminer/api/response.rb', line 15 def received_at DateTime.strptime("#{@status['When']}", '%s') end |
#success? ⇒ Boolean
19 20 21 |
# File 'lib/cgminer/api/response.rb', line 19 def success? @status['STATUS'] == 'S' end |