Sha256: 89c9bed7938242a21314a76724ee3d9387eb6f3c71250b57757b639d52ae61e5

Contents?: true

Size: 699 Bytes

Versions: 1

Compression:

Stored size: 699 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 url
        API_ENDPOINT
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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