Class: EveAPI::User

Inherits:
Base
  • Object
show all
Includes:
Common
Defined in:
lib/eve-api/eve-api.rb

Instance Method Summary collapse

Methods included from Common

#extract_options_from_args!

Methods inherited from Base

#id, #method_missing, #type

Constructor Details

#initialize(*args) ⇒ User

Returns a new instance of User.



58
59
60
61
62
# File 'lib/eve-api/eve-api.rb', line 58

def initialize(*args)
  super(extract_options_from_args!(args))
  raise(Exceptions::InputException, "id required") unless @options[:id]
  raise(Exceptions::InputException, "api_key required") unless @options[:api_key]
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class EveAPI::Base

Instance Method Details

#charactersObject



63
64
65
66
67
68
69
# File 'lib/eve-api/eve-api.rb', line 63

def characters
  characters = []
  @api.characters.each do |raw_character_id, raw_character|
    characters << Character.new(raw_character, @api)
  end
  return characters
end

#ref_typesObject



90
91
92
93
94
95
96
# File 'lib/eve-api/eve-api.rb', line 90

def ref_types
  ref_types = {}
  @api.reftypes.each do |raw_reftype_id, raw_reftype|
    ref_types[raw_reftype_id] = ReferenceType.new(raw_reftype, @api)
  end
  return ref_types
end

#skill_treeObject



70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/eve-api/eve-api.rb', line 70

def skill_tree
  groups = []
  skills = {}
  skilltree = @api.skilltree
  skilltree[:groups].each do |raw_group_id, raw_group|
    group_skills = {}
    skilltree[:skills].each do |raw_skill_id, raw_skill|
      group_skills[raw_skill_id] = Skill.new(raw_skill, @api) if raw_skill[:group_id] == raw_group_id
    end
    groups << SkillGroup.new(raw_group.merge({:skills => group_skills}), @api)
  end
  return groups
end

#sovereigntyObject



83
84
85
86
87
88
89
# File 'lib/eve-api/eve-api.rb', line 83

def sovereignty
  systems = {}
  @api.sovereignty.each do |raw_system_id, raw_system|
    systems[raw_system_id] = System.new(raw_system, @api)
  end
  return systems
end