Class: EveOnline::ESI::CharacterSkills

Inherits:
Base
  • Object
show all
Defined in:
lib/eve_online/esi/character_skills.rb

Constant Summary collapse

API_PATH =
"/v4/characters/%<character_id>s/skills/"

Constants inherited from Base

Base::API_HOST

Instance Attribute Summary collapse

Attributes inherited from Base

#_open_timeout, #_read_timeout, #_write_timeout, #adapter, #language, #middlewares, #token

Instance Method Summary collapse

Methods inherited from Base

#add_middleware, #additional_query_params, #base_query_params, #connection, #error_limit_remain, #error_limit_reset, #http_method, #open_timeout, #open_timeout=, #page, #query, #read_timeout, #read_timeout=, #request_id, #resource, #response, #total_pages, #uri, #url, #user_agent, #write_timeout, #write_timeout=

Constructor Details

#initialize(options) ⇒ CharacterSkills

Returns a new instance of CharacterSkills.



10
11
12
13
14
# File 'lib/eve_online/esi/character_skills.rb', line 10

def initialize(options)
  super

  @character_id = options.fetch(:character_id)
end

Instance Attribute Details

#character_idObject (readonly)

Returns the value of attribute character_id.



8
9
10
# File 'lib/eve_online/esi/character_skills.rb', line 8

def character_id
  @character_id
end

Instance Method Details

#as_jsonObject



16
17
18
19
20
21
# File 'lib/eve_online/esi/character_skills.rb', line 16

def as_json
  {
    total_sp: total_sp,
    unallocated_sp: unallocated_sp
  }
end

#pathObject



46
47
48
# File 'lib/eve_online/esi/character_skills.rb', line 46

def path
  format(API_PATH, character_id: character_id)
end

#scopeObject



42
43
44
# File 'lib/eve_online/esi/character_skills.rb', line 42

def scope
  "esi-skills.read_skills.v1"
end

#skillsObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/eve_online/esi/character_skills.rb', line 23

def skills
  @skills ||=
    begin
      output = []
      response.fetch("skills").each do |skill|
        output << Models::Skill.new(skill)
      end
      output
    end
end

#total_spObject



34
35
36
# File 'lib/eve_online/esi/character_skills.rb', line 34

def total_sp
  response["total_sp"]
end

#unallocated_spObject



38
39
40
# File 'lib/eve_online/esi/character_skills.rb', line 38

def unallocated_sp
  response["unallocated_sp"]
end