Sha256: c9d51b449c584fcac037aad957c628eb3a11f1c963b250c9af6f97e1970625ad

Contents?: true

Size: 815 Bytes

Versions: 4

Compression:

Stored size: 815 Bytes

Contents

module EveOnline
  class Item
    attr_reader :options

    def initialize(options)
      @options = options
    end

    def as_json
      {
        item_id: item_id,
        location_id: location_id,
        type_id: type_id,
        quantity: quantity,
        flag: flag,
        singleton: singleton,
        raw_quantity: raw_quantity
      }
    end

    def item_id
      options.fetch('@itemID').to_i
    end

    def location_id
      options.fetch('@locationID').to_i
    end

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

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

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

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

    def raw_quantity
      options.fetch('@rawQuantity').to_i
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
eve_online-0.12.0 lib/eve_online/item.rb
eve_online-0.11.0 lib/eve_online/item.rb
eve_online-0.10.0 lib/eve_online/item.rb
eve_online-0.9.0 lib/eve_online/item.rb