Class: Giftrocket::Campaign

Inherits:
Object
  • Object
show all
Defined in:
lib/giftrocket/campaign.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#dataObject

Returns the value of attribute data.



4
5
6
# File 'lib/giftrocket/campaign.rb', line 4

def data
  @data
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/giftrocket/campaign.rb', line 4

def id
  @id
end

Class Method Details

.listObject



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.default_options,
    format: 'json'
  )[:campaigns].map do |org|
    Giftrocket::Campaign.new(org)
  end
end