Sha256: 82546011bc98f9c3cf5e2718360e62f0750bc97dbfa063e9829bcf56d53b7ff9

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 KB

Contents

module EveOnline
  class Blueprint
    attr_reader :options

    def initialize(options)
      @options = options
    end

    def as_json
      {
        item_id: item_id,
        location_id: location_id,
        type_id: type_id,
        type_name: type_name,
        flag_id: flag_id,
        quantity: quantity,
        time_efficiency: time_efficiency,
        material_efficiency: material_efficiency,
        runs: runs
      }
    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 type_name
      options.fetch('@typeName')
    end

    def flag_id
      options.fetch('@flagID').to_i
    end

    # TODO: return EveOnline::Blueprint::Quantity
    def quantity
      options.fetch('@quantity').to_i
    end

    def time_efficiency
      options.fetch('@timeEfficiency').to_i
    end

    def material_efficiency
      options.fetch('@materialEfficiency').to_i
    end

    def runs
      options.fetch('@runs').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/blueprint.rb
eve_online-0.11.0 lib/eve_online/blueprint.rb
eve_online-0.10.0 lib/eve_online/blueprint.rb
eve_online-0.9.0 lib/eve_online/blueprint.rb