Sha256: 5992eeee188d9f98f59db5f84c76fa66e91fda0efb25b8bd5654886dd5500cb7

Contents?: true

Size: 776 Bytes

Versions: 3

Compression:

Stored size: 776 Bytes

Contents

# frozen_string_literal: true

require 'forwardable'

module EveOnline
  module ESI
    class CharacterOnline < Base
      extend Forwardable

      API_ENDPOINT = 'https://esi.evetech.net/v2/characters/%<character_id>s/online/?datasource=%<datasource>s'

      attr_reader :character_id

      def initialize(options)
        super

        @character_id = options.fetch(:character_id)
      end

      def_delegators :model, :as_json, :last_login, :last_logout, :logins,
                     :online

      def model
        Models::Online.new(response)
      end
      memoize :model

      def scope
        'esi-location.read_online.v1'
      end

      def url
        format(API_ENDPOINT, character_id: character_id, datasource: datasource)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
eve_online-0.20.0 lib/eve_online/esi/character_online.rb
eve_online-0.19.0 lib/eve_online/esi/character_online.rb
eve_online-0.18.0 lib/eve_online/esi/character_online.rb