Sha256: d57d26ac965ba0120b2ca641c700272f984253b222a89ef6c69ef1440e9978af

Contents?: true

Size: 779 Bytes

Versions: 1

Compression:

Stored size: 779 Bytes

Contents

module EveOnline
  module Server
    # http://wiki.eve-id.net/APIv2_Server_ServerStatus_XML
    class Status < Base
      API_ENDPOINT = 'https://api.eveonline.com/Server/ServerStatus.xml.aspx'

      def as_json(*args)
        {
          current_time: current_time,
          cached_until: cached_until,
          server_open: server_open,
          online_players: online_players
        }
      end

      def server_open
        @server_open ||= result.fetch('serverOpen') == 'True'
      end

      alias server_open? server_open

      def online_players
        @online_players ||= result.fetch('onlinePlayers').to_i
      end

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

      def url
        API_ENDPOINT
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eve_online-0.4.0 lib/eve_online/server/status.rb