require "faraday" require "faraday_middleware" module Axie class Client BASE_URL = "https://game-api.skymavis.com/" attr_reader :ronin_address def initialize(ronin_address:) @ronin_address = "0x#{ronin_address.split(":").last}" end def connection @connection ||= Faraday.new do |conn| conn.url_prefix = BASE_URL conn.request :json conn.response :json, content_type: "application/json" end end def account response = connection.get("game-api/clients/#{ronin_address}/items/1") Axie::Account.from_response(response) end end end