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.

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