Class: Access::Campaign

Inherits:
Object
  • Object
show all
Includes:
MuchMeta
Defined in:
lib/access/campaign.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from MuchMeta

#set_up_methods, #set_values

Constructor Details

#initialize(values) ⇒ Campaign

Returns a new instance of Campaign.



17
18
19
20
21
22
23
24
25
26
# File 'lib/access/campaign.rb', line 17

def initialize(values)
  @used_fields = []
  set_up_methods(values)
  set_values(values)
  @spots = Access::Spot.process_batch(@spots) if @spots
  @spot_list = Access::Spot.process_batch(@spot_list) if @spot_list
  @channels = Access::Channel.process_batch(@channels) if @channels
  @channel_list = Access::Channel.process_batch(@channel_list) if @channel_list
  @links = Access::Link.process_batch(@links) if @links
end

Class Method Details

.find(campaign_key, options = {}) ⇒ Object



9
10
11
# File 'lib/access/campaign.rb', line 9

def self.find(campaign_key, options = {})
  Access::Api.new.find_campaign campaign_key, options
end

.process_batch(chunk) ⇒ Object



13
14
15
# File 'lib/access/campaign.rb', line 13

def self.process_batch(chunk)
  chunk.map { |campaign| new(campaign) }
end

.search(options = {}) ⇒ Object



5
6
7
# File 'lib/access/campaign.rb', line 5

def self.search(options = {})
  Access::Api.new.search_campaigns options
end