Sha256: f88a44a806ba2fda9e79fd3ef1ca1080e4b6db656f85bb492905914b033c7eb7

Contents?: true

Size: 776 Bytes

Versions: 1

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.tech.ccp.is/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

1 entries across 1 versions & 1 rubygems

Version Path
eve_online-0.17.0 lib/eve_online/esi/character_online.rb