Module: Hominid::Campaign

Included in:
API
Defined in:
lib/hominid/campaign.rb

Instance Method Summary collapse

Instance Method Details

#find_campaign_by_id(campaign_id) ⇒ Object

Find a campaign by id



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

def find_campaign_by_id(campaign_id)
  campaigns({:campaign_id => campaign_id})['data']
end

#find_campaign_by_web_id(campaign_web_id) ⇒ Object

Find a campaign by web_id



10
11
12
# File 'lib/hominid/campaign.rb', line 10

def find_campaign_by_web_id(campaign_web_id)
  campaigns['data'].find {|c| c["web_id"] == campaign_web_id}
end

#find_campaigns_by_list_id(list_id, *args) ⇒ Object

Find campaigns by list id



25
26
27
# File 'lib/hominid/campaign.rb', line 25

def find_campaigns_by_list_id(list_id, *args)
  campaigns({:list_id => list_id}, *args)['data']
end

#find_campaigns_by_list_name(list_name, *args) ⇒ Object

Find campaigns by list name



20
21
22
# File 'lib/hominid/campaign.rb', line 20

def find_campaigns_by_list_name(list_name, *args)
  campaigns({:list_id => find_list_id_by_name(list_name)}, *args)['data']
end

#find_campaigns_by_title(campaign_title, *args) ⇒ Object

Find a campaign by name



15
16
17
# File 'lib/hominid/campaign.rb', line 15

def find_campaigns_by_title(campaign_title, *args)
  campaigns({:title => campaign_title}, *args)['data']
end

#find_campaigns_by_type(campaign_type, *args) ⇒ Object

Find campaigns by type



30
31
32
# File 'lib/hominid/campaign.rb', line 30

def find_campaigns_by_type(campaign_type, *args)
  campaigns({:type => campaign_type}, *args)['data']
end