Sha256: 375fe5f8ddb420826c1b9cdade9326e72d0cfdbc75c1ea778342f07a9572d82a

Contents?: true

Size: 719 Bytes

Versions: 1

Compression:

Stored size: 719 Bytes

Contents

module EveOnline
  module XML
    # https://eveonline-third-party-documentation.readthedocs.org/en/latest/xmlapi/server/serv_serverstatus.html
    class ServerStatus < Base
      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

1 entries across 1 versions & 1 rubygems

Version Path
eve_online-0.12.0 lib/eve_online/xml/server_status.rb