Sha256: f25a8cdc43a2606f7e52835b89ccc1c8cdb72504248dbd57aab4265cc07bf514

Contents?: true

Size: 903 Bytes

Versions: 3

Compression:

Stored size: 903 Bytes

Contents

# frozen_string_literal: true

require 'forwardable'

module EveOnline
  module ESI
    class Corporation < Base
      extend Forwardable

      API_ENDPOINT = 'https://esi.evetech.net/v4/corporations/%<corporation_id>s/?datasource=%<datasource>s'

      attr_reader :corporation_id

      def initialize(options)
        super

        @corporation_id = options.fetch(:corporation_id)
      end

      def_delegators :model, :as_json, :alliance_id, :ceo_id, :creator_id,
                     :date_founded, :description, :faction_id,
                     :home_station_id, :member_count, :name, :shares,
                     :tax_rate, :ticker, :corporation_url

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

      def scope; end

      def url
        format(API_ENDPOINT, corporation_id: corporation_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/corporation.rb
eve_online-0.19.0 lib/eve_online/esi/corporation.rb
eve_online-0.18.0 lib/eve_online/esi/corporation.rb