Sha256: 1772351e2e26f414bc3b3d2f2cbc6f2da1da2db217892ec6d985cb90be170c8e

Contents?: true

Size: 958 Bytes

Versions: 1

Compression:

Stored size: 958 Bytes

Contents

# frozen_string_literal: true

module EveOnline
  module ESI
    class CorporationOrders < Base
      API_PATH = '/v3/corporations/%<corporation_id>s/orders/?datasource=%<datasource>s&page=%<page>s'

      attr_reader :corporation_id, :page

      def initialize(options)
        super

        @corporation_id = options.fetch(:corporation_id)
        @page = options.fetch(:page, 1)
      end

      def orders
        @orders ||=
          begin
            output = []
            response.each do |order|
              output << Models::CorporationOrder.new(order)
            end
            output
          end
      end

      def scope
        'esi-markets.read_corporation_orders.v1'
      end

      # TODO: add roles support
      # def roles
      #   ['Accountant', 'Trader']
      # end

      def url
        format("#{ API_HOST }#{ API_PATH }", corporation_id: corporation_id, datasource: datasource, page: page)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eve_online-0.24.0 lib/eve_online/esi/corporation_orders.rb