Sha256: 487d137531ef0cf13a9bb588a2c8aa7995d2e3c065337aeaa20287cfe838904e

Contents?: true

Size: 1.84 KB

Versions: 1

Compression:

Stored size: 1.84 KB

Contents

require_relative "../base_item"

module Greeve
  module Character
    # Character market orders.
    #
    # @see https://eveonline-third-party-documentation.readthedocs.io/en/latest/xmlapi/character/char_marketorders.html
    class MarketOrders < Greeve::BaseItem
      endpoint "char/MarketOrders"

      rowset :orders, xpath: "eveapi/result/rowset[@name='orders']" do
        attribute :order_id,      xpath: "@orderID",      type: :integer
        attribute :char_id,       xpath: "@charID",       type: :integer
        attribute :station_id,    xpath: "@stationID",    type: :integer
        attribute :vol_entered,   xpath: "@volEntered",   type: :integer
        attribute :vol_remaining, xpath: "@volRemaining", type: :integer
        attribute :min_volume,    xpath: "@minVolume",    type: :integer
        attribute :order_state,   xpath: "@orderState",   type: :integer
        attribute :type_id,       xpath: "@typeID",       type: :integer
        attribute :range,         xpath: "@range",        type: :integer
        attribute :account_key,   xpath: "@accountKey",   type: :integer
        attribute :duration,      xpath: "@duration",     type: :integer
        attribute :escrow,        xpath: "@escrow",       type: :numeric
        attribute :price,         xpath: "@price",        type: :numeric
        attribute :bid,           xpath: "@bid",          type: :boolean
        attribute :issued,        xpath: "@issued",       type: :datetime
      end

      # @param character_id [Integer] EVE character ID
      #
      # @option opts [Integer] :order_id Optional order ID of order to retrieve
      def initialize(character_id, opts = {})
        order_id = opts.delete(:order_id)

        opts[:query_params] = { "characterID" => character_id }
        opts[:query_params]["orderID"] = order_id if order_id

        super(opts)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
greeve-1.0.0 lib/greeve/character/market_orders.rb