Class: Giftrocket::Style
- Inherits:
-
Object
- Object
- Giftrocket::Style
- Defined in:
- lib/giftrocket/style.rb
Instance Attribute Summary collapse
-
#card ⇒ Object
Returns the value of attribute card.
-
#id ⇒ Object
Returns the value of attribute id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Style
constructor
A new instance of Style.
- #url ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Style
Returns a new instance of Style.
6 7 8 9 10 |
# File 'lib/giftrocket/style.rb', line 6 def initialize(attributes) attributes = attributes.with_indifferent_access self.id = attributes[:id] self.card = attributes[:card] end |
Instance Attribute Details
#card ⇒ Object
Returns the value of attribute card.
4 5 6 |
# File 'lib/giftrocket/style.rb', line 4 def card @card end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/giftrocket/style.rb', line 4 def id @id end |
Class Method Details
.list(filters = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/giftrocket/style.rb', line 16 def self.list(filters={}) = filters.merge(Giftrocket.) response = Giftrocket::Request.get 'styles', query: , format: 'json' response[:styles].map do |style_attributes| Giftrocket::Style.new(style_attributes) end end |
Instance Method Details
#url ⇒ Object
12 13 14 |
# File 'lib/giftrocket/style.rb', line 12 def url card && card[:url] end |