Sha256: e6a9ed2a1ec177bcd891c562402313960f891910716a047360c5ac8478775adb

Contents?: true

Size: 686 Bytes

Versions: 1

Compression:

Stored size: 686 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
        {
          current_time: current_time,
          cached_until: cached_until,
          server_open: server_open?,
          online_players: online_players
        }
      end

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

      def online_players
        result.fetch('onlinePlayers').to_i
      end

      def 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.3.0 lib/eve_online/server/status.rb