Sha256: 78e1b01a7eff27ff02479e6e97b4714dae06486d37f7c35e31209613ef0d9e9a
Contents?: true
Size: 658 Bytes
Versions: 2
Compression:
Stored size: 658 Bytes
Contents
module GunBroker # Represents a GunBroker item (listing). class Item # @param item_id [Integer, String] The ID of the Item to find. # @return [Item] An Item instance. def self.find(item_id) new(GunBroker::API.get("/Items/#{item_id}")) end # @param attrs [Hash] The JSON attributes from the API response. def initialize(attrs = {}) @attrs = attrs end # @return [Integer] The Item ID. def id @attrs['itemID'] end # @param key [String] An Item attribute name (from the JSON response). # @return The value of the given `key` or `nil`. def [](key) @attrs[key] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gun_broker-0.4.1 | lib/gun_broker/item.rb |
gun_broker-0.4.0 | lib/gun_broker/item.rb |