Class: Greeve::Character::Locations

Inherits:
BaseItem
  • Object
show all
Defined in:
lib/greeve/character/locations.rb

Overview

Location and name of specific items that belong to the character of the api key. This call can be used to retrieve the player-set name of containers and ships.

Attributes collapse

Instance Method Summary collapse

Methods inherited from BaseItem

attribute, #cache_expired?, #cached_until, endpoint, #inspect, namespace, #refresh, rowset, #to_s

Methods included from Helpers::AttributeToHash

#to_h

Constructor Details

#initialize(character_id, opts = {}) ⇒ Locations

Returns a new instance of Locations

Parameters:

  • character_id (Integer)

    EVE character ID

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :ids (Array<Integer>, Integer) — default: nil

    ID or array of IDs of items belonging to the character



25
26
27
28
29
30
31
32
33
# File 'lib/greeve/character/locations.rb', line 25

def initialize(character_id, opts = {})
  ids = opts.delete(:ids)
  ids = [ids] unless ids.nil? || ids.is_a?(Array)

  opts[:query_params] = { "characterID" => character_id }
  opts[:query_params]["IDs"] = ids.join(",") if ids

  super(opts)
end

Instance Method Details

#locationsGreeve::Rowset

Parameters:

  • item_id (Integer)
  • item_name (String)
  • x (BigDecimal)
  • y (BigDecimal)
  • z (BigDecimal)

Returns:



13
14
15
16
17
18
19
# File 'lib/greeve/character/locations.rb', line 13

rowset :locations, xpath: "eveapi/result/rowset[@name='locations']" do
  attribute :item_id,   xpath: "@itemID",   type: :integer
  attribute :item_name, xpath: "@itemName", type: :string
  attribute :x,         xpath: "@x",        type: :numeric
  attribute :y,         xpath: "@y",        type: :numeric
  attribute :z,         xpath: "@z",        type: :numeric
end