Class: Giftrocket::Catalog
- Inherits:
-
Object
- Object
- Giftrocket::Catalog
- Defined in:
- lib/giftrocket/catalog.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#raw ⇒ Object
Returns the value of attribute raw.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Catalog
constructor
A new instance of Catalog.
Constructor Details
#initialize(attributes) ⇒ Catalog
Returns a new instance of Catalog.
6 7 8 9 10 11 |
# File 'lib/giftrocket/catalog.rb', line 6 def initialize(attributes) attributes = attributes.with_indifferent_access self.id = attributes[:id] self.name = attributes[:name] self.raw = attributes end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
4 5 6 |
# File 'lib/giftrocket/catalog.rb', line 4 def data @data end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/giftrocket/catalog.rb', line 4 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/giftrocket/catalog.rb', line 4 def name @name end |
#raw ⇒ Object
Returns the value of attribute raw.
4 5 6 |
# File 'lib/giftrocket/catalog.rb', line 4 def raw @raw end |
Class Method Details
.list(filters = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/giftrocket/catalog.rb', line 13 def self.list(filters={}) Giftrocket::Request.get( 'catalog', query: filters.merge(Giftrocket.), format: 'json' )[:catalog].map do |item| Giftrocket::Catalog.new(item) end end |