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