class Axie::Client

Constants

BASE_URL

Attributes

ronin_address[R]

Public Class Methods

new(ronin_address:) click to toggle source
# File lib/axie/client.rb, line 10
def initialize(ronin_address:)
  @ronin_address = "0x#{ronin_address.split(":").last}"
end

Public Instance Methods

account() click to toggle source
# File lib/axie/client.rb, line 22
def account
  response = connection.get("game-api/clients/#{ronin_address}/items/1")
  Axie::Account.from_response(response)
end
connection() click to toggle source
# File lib/axie/client.rb, line 14
def connection
  @connection ||= Faraday.new do |conn|
    conn.url_prefix = BASE_URL
    conn.request :json
    conn.response :json, content_type: "application/json"
  end
end