Sha256: 3ec23a7314212155ba92f8913d0fa1d5a3a28c1b90d3b0dbe336af55da9580b4

Contents?: true

Size: 1.44 KB

Versions: 1

Compression:

Stored size: 1.44 KB

Contents

module EveOnline
  module ESI
    class Character < Base
      API_ENDPOINT = 'https://esi.tech.ccp.is/v4/characters/%s/?datasource=tranquility'.freeze

      attr_reader :character_id

      def initialize(character_id)
        super()
        @character_id = character_id
      end

      def as_json
        {
          corporation_id: corporation_id,
          birthday: birthday,
          name: name,
          gender: gender,
          race_id: race_id,
          bloodline_id: bloodline_id,
          description: description,
          alliance_id: alliance_id,
          ancestry_id: ancestry_id,
          security_status: security_status
        }
      end

      def corporation_id
        response['corporation_id']
      end

      def birthday
        birthday = response['birthday']

        parse_datetime_with_timezone(birthday) if birthday
      end

      def name
        response['name']
      end

      def gender
        response['gender']
      end

      def race_id
        response['race_id']
      end

      def bloodline_id
        response['bloodline_id']
      end

      def description
        response['description']
      end

      def alliance_id
        response['alliance_id']
      end

      def ancestry_id
        response['ancestry_id']
      end

      def security_status
        response['security_status']
      end

      def scope; end

      def url
        API_ENDPOINT % character_id
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eve_online-0.12.0 lib/eve_online/esi/character.rb