Sha256: 360f32b7d445a89c51af0c27ce779d14cbc105c64d7c656c910a5357380285f7

Contents?: true

Size: 917 Bytes

Versions: 1

Compression:

Stored size: 917 Bytes

Contents

require 'open-uri'

module EveOnline
  # http://wiki.eve-id.net/APIv2_Char_AccountBalance_XML
  class AccountBalance < Base
    API_ENDPOINT = 'https://api.eveonline.com/char/AccountBalance.xml.aspx'

    def current_time
      # TODO: time in "(GMT) Monrovia, Reykjavik".
      eveapi.fetch('currentTime')
    end

    def account_id
      row.fetch('@accountID').to_i
    end

    def account_key
      row.fetch('@accountKey')
    end

    def balance
      row.fetch('@balance')
    end

    def row
      rowset.fetch('row')
    end

    def rowset
      result.fetch('rowset')
    end

    def cached_until
      eveapi.fetch('cachedUntil')
    end

    def version
      eveapi.fetch('@version').to_i
    end

    def result
      eveapi.fetch('result')
    end

    def eveapi
      response.fetch('eveapi')
    end

    def url
      "#{ API_ENDPOINT }?keyID=#{ key_id }&vCode=#{ v_code }"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eve_online-0.2.0 lib/eve_online/account_balance.rb