Sha256: c197c415de0bf698a14dd5bc4308192d1dc8cf5825553e049ff3a629496b772b

Contents?: true

Size: 621 Bytes

Versions: 3

Compression:

Stored size: 621 Bytes

Contents

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

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
axie-ruby-0.2.1 lib/axie/client.rb
axie-ruby-0.2.0 lib/axie/client.rb
axie-0.1.0 lib/axie/client.rb