Class: EveOnline::ESI::CharacterSkills

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

Constant Summary collapse

API_ENDPOINT =
'https://esi.tech.ccp.is/v4/characters/%<character_id>s/skills/?datasource=tranquility'

Instance Attribute Summary collapse

Attributes inherited from Base

#parser, #token

Instance Method Summary collapse

Methods inherited from Base

#content, #response, #user_agent

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[: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

#scopeObject



40
41
42
# File 'lib/eve_online/esi/character_skills.rb', line 40

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

#skillsObject



31
32
33
34
35
36
37
# File 'lib/eve_online/esi/character_skills.rb', line 31

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

#total_spObject



23
24
25
# File 'lib/eve_online/esi/character_skills.rb', line 23

def total_sp
  response['total_sp']
end

#unallocated_spObject



27
28
29
# File 'lib/eve_online/esi/character_skills.rb', line 27

def unallocated_sp
  response['unallocated_sp']
end

#urlObject



44
45
46
# File 'lib/eve_online/esi/character_skills.rb', line 44

def url
  format(API_ENDPOINT, character_id: character_id)
end