class Nicehash::Client
Public Class Methods
new(client: nil)
click to toggle source
# File lib/nicehash/client.rb, line 6 def initialize(client: nil) @client = client || Faraday.new('https://api.nicehash.com/api') do |conn| conn.response :json, parser_options: { symbolize_names: true } conn.adapter Faraday.default_adapter end end
Public Instance Methods
api()
click to toggle source
# File lib/nicehash/client.rb, line 13 def api resp = rpc(nil) Response.from_faraday_resp(resp) end
method_missing(name, *args, **kwargs)
click to toggle source
# File lib/nicehash/client.rb, line 18 def method_missing(name, *args, **kwargs) resp = rpc(name.to_s.gsub('_', '.'), kwargs) Response.from_faraday_resp(resp) end
Private Instance Methods
rpc(method, **kwargs)
click to toggle source
# File lib/nicehash/client.rb, line 25 def rpc(method, **kwargs) params = {} params[:method] = method if method params.merge! kwargs @client.get '/api', params end