Sha256: bf15969360923ce6b257a10fe7daac96ebaed67999df9e9c13acf3de826039ca

Contents?: true

Size: 919 Bytes

Versions: 1

Compression:

Stored size: 919 Bytes

Contents

module EveOnline
  module ESI
    class CharacterSkills < Base
      API_ENDPOINT = 'https://esi.tech.ccp.is/v4/characters/%<character_id>s/skills/?datasource=tranquility'.freeze

      attr_reader :character_id

      def initialize(options)
        super

        @character_id = options[:character_id]
      end

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

      def total_sp
        response['total_sp']
      end

      def unallocated_sp
        response['unallocated_sp']
      end

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

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

      def url
        format(API_ENDPOINT, character_id: character_id)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eve_online-0.14.0 lib/eve_online/esi/character_skills.rb