class Nicehash::Response

Attributes

error[R]
method[R]
result[R]

Public Class Methods

from_faraday_resp(resp) click to toggle source
# File lib/nicehash/client.rb, line 36
def self.from_faraday_resp(resp)
  body = resp.body
  error = body&.dig(:result, :error)
  result = error ? nil : body[:result]
  self.new(body[:method], result, error)
end
new(method, result = nil, error = nil) click to toggle source
# File lib/nicehash/client.rb, line 43
def initialize(method, result = nil, error = nil)
  @method =  method
  @result = result
  @error = error
end

Public Instance Methods

ok?() click to toggle source
# File lib/nicehash/client.rb, line 49
def ok?
  @error == nil
end