Class: AdRoll::Api::Campaign

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

Class Method Summary collapse

Class Method Details

.create(advertisable:, budget:, is_retargeting: nil, is_fbx_newsfeed: nil, adgroups: nil, cpc: nil, cpm: nil, start_date: nil, end_date: nil, name: nil, status: nil, max_cpm: nil, networks: nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/adroll/campaign.rb', line 5

def create(advertisable:, budget:, is_retargeting: nil, is_fbx_newsfeed: nil,
           adgroups: nil, cpc: nil, cpm: nil, start_date: nil, end_date: nil,
           name: nil, status: nil, max_cpm: nil, networks: nil)

  params = {
    advertisable: advertisable,
    budget: budget,
    is_retargeting: is_retargeting,
    is_fbx_newsfeed: is_fbx_newsfeed,
    adgroups: adgroups,
    cpc: cpc,
    cpm: cpm,
    start_date: start_date,
    end_date: end_date,
    name: name,
    status: status,
    max_cpm: max_cpm,
    networks: networks
  }.reject { |_, value| value.nil? }

  call_api(:post, __method__, params)
end

.edit(campaign:, budget: nil, is_retargeting: nil, cpc: nil, cpm: nil, start_date: nil, end_date: nil, name: nil) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/adroll/campaign.rb', line 28

def edit(campaign:, budget: nil, is_retargeting: nil,
         cpc: nil, cpm: nil, start_date: nil, end_date: nil,
         name: nil)

  params = {
    campaign: campaign,
    budget: budget,
    is_retargeting: is_retargeting,
    cpc: cpc,
    cpm: cpm,
    start_date: start_date,
    end_date: end_date,
    name: name
  }.reject { |_, value| value.nil? }

  call_api(:put, __method__, params)
end

.get(campaign:) ⇒ Object



46
47
48
49
50
51
52
# File 'lib/adroll/campaign.rb', line 46

def get(campaign:)
  params = {
    campaign: campaign
  }.reject { |_, value| value.nil? }

  call_api(:get, __method__, params)
end

.get_adgroups(campaign:) ⇒ Object



54
55
56
57
58
59
60
# File 'lib/adroll/campaign.rb', line 54

def get_adgroups(campaign:)
  params = {
    campaign: campaign
  }.reject { |_, value| value.nil? }

  call_api(:get, __method__, params)
end

.get_ip_range_exclusions(campaign:) ⇒ Object



62
63
64
65
66
67
68
# File 'lib/adroll/campaign.rb', line 62

def get_ip_range_exclusions(campaign:)
  params = {
    campaign: campaign
  }.reject { |_, value| value.nil? }

  call_api(:get, __method__, params)
end

.pause(campaign:) ⇒ Object



70
71
72
73
74
75
76
# File 'lib/adroll/campaign.rb', line 70

def pause(campaign:)
  params = {
    campaign: campaign
  }.reject { |_, value| value.nil? }

  call_api(:get, __method__, params)
end

.pause_ads(campaign:, ads:) ⇒ Object



78
79
80
81
82
83
84
85
# File 'lib/adroll/campaign.rb', line 78

def pause_ads(campaign:, ads:)
  params = {
    campaign: campaign,
    ads: ads
  }.reject { |_, value| value.nil? }

  call_api(:get, __method__, params)
end

.unpause(campaign:) ⇒ Object



87
88
89
90
91
92
93
# File 'lib/adroll/campaign.rb', line 87

def unpause(campaign:)
  params = {
    campaign: campaign
  }.reject { |_, value| value.nil? }

  call_api(:get, __method__, params)
end

.unpause_ads(campaign:, ads:) ⇒ Object



95
96
97
98
99
100
101
102
# File 'lib/adroll/campaign.rb', line 95

def unpause_ads(campaign:, ads:)
  params = {
    campaign: campaign,
    ads: ads
  }.reject { |_, value| value.nil? }

  call_api(:get, __method__, params)
end