Sha256: 158daa45277ac5456e82c160287feedaa3c83a0edd7b72a940eba99973bee291

Contents?: true

Size: 719 Bytes

Versions: 3

Compression:

Stored size: 719 Bytes

Contents

module EveOnline
  module Server
    # https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/server/serv_serverstatus.html
    class Status < BaseXML
      API_ENDPOINT = 'https://api.eveonline.com/Server/ServerStatus.xml.aspx'.freeze

      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

      alias server_open? server_open

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

      def url
        API_ENDPOINT
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
eve_online-0.11.0 lib/eve_online/server/status.rb
eve_online-0.10.0 lib/eve_online/server/status.rb
eve_online-0.9.0 lib/eve_online/server/status.rb