Sha256: 6560211e19a641e9ec1364016a7bc7e2cf2c68032a26ee29c9870dddb704b44e

Contents?: true

Size: 921 Bytes

Versions: 2

Compression:

Stored size: 921 Bytes

Contents

require 'active_support/time'

module EveOnline
  class SkillQueueEntry
    attr_reader :options

    def initialize(options)
      @options = options
    end

    def as_json
      {
        queue_position: queue_position,
        type_id: type_id,
        level: level,
        start_sp: start_sp,
        end_sp: end_sp,
        start_time: start_time,
        end_time: end_time
      }
    end

    def queue_position
      options.fetch('@queuePosition').to_i
    end

    def type_id
      options.fetch('@typeID').to_i
    end

    def level
      options.fetch('@level').to_i
    end

    def start_sp
      options.fetch('@startSP').to_i
    end

    def end_sp
      options.fetch('@endSP').to_i
    end

    def start_time
      ActiveSupport::TimeZone['UTC'].parse(options.fetch('@startTime'))
    end

    def end_time
      ActiveSupport::TimeZone['UTC'].parse(options.fetch('@endTime'))
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eve_online-0.10.0 lib/eve_online/skill_queue_entry.rb
eve_online-0.9.0 lib/eve_online/skill_queue_entry.rb