Class: Adglare

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(public_key:, private_key:, ajax: false) ⇒ Adglare

If ajax is true, the class will output the required Javascript to make the API call, instead of using CURL



9
10
11
12
13
# File 'lib/adglare.rb', line 9

def initialize public_key:, private_key:, ajax:false
  self.public_key = public_key
  self.private_key = private_key
  self.ajax = ajax
end

Instance Attribute Details

#ajaxObject

Returns the value of attribute ajax.



6
7
8
# File 'lib/adglare.rb', line 6

def ajax
  @ajax
end

#private_keyObject

Returns the value of attribute private_key.



6
7
8
# File 'lib/adglare.rb', line 6

def private_key
  @private_key
end

#public_keyObject

Returns the value of attribute public_key.



6
7
8
# File 'lib/adglare.rb', line 6

def public_key
  @public_key
end

Instance Method Details

#campaigns_add(name:) ⇒ Object

param string name Campaign name



63
64
65
# File 'lib/adglare.rb', line 63

def campaigns_add name:
  call_adglare_api 'campaigns_add', {name: name}
end

#campaigns_creatives_add(cID:, creativename:, bannerURL:, targetURL:) ⇒ Object

param int cID Campaign ID param string creativename param string bannerURL The URL on which the banner can be found. param string targetURL The landing page URL that should be opened upon clicking



100
101
102
# File 'lib/adglare.rb', line 100

def campaigns_creatives_add cID:, creativename:, bannerURL:, targetURL: 
  call_adglare_api 'campaigns_creatives_add', {cID: cID, creativename: creativename, bannerURL: bannerURL, targetURL: targetURL}
end

#campaigns_creatives_delete(cID:, crID:) ⇒ Object

param int cID Campaign ID param int crID Campaign Creative ID



116
117
118
# File 'lib/adglare.rb', line 116

def campaigns_creatives_delete cID:, crID: 
  call_adglare_api 'campaigns_creatives_delete', {cID: cID, crID: crID}
end

#campaigns_creatives_list(cID:) ⇒ Object

param int cID Campaign ID



91
92
93
# File 'lib/adglare.rb', line 91

def campaigns_creatives_list cID:
  call_adglare_api 'campaigns_creatives_list', {cID: cID}
end

#campaigns_creatives_modify(cID:, crID:, creativename: nil, targetURL: nil) ⇒ Object

param int cID Campaign ID param int crID Campaign Creative ID param string creativename param string targetURL The landing page URL that should be opened upon clicking



109
110
111
# File 'lib/adglare.rb', line 109

def campaigns_creatives_modify cID:, crID:, creativename: nil, targetURL: nil
  call_adglare_api 'campaigns_creatives_modify', {cID: cID, creativename: creativename, crID: crID, targetURL: targetURL}
end

#campaigns_delete(cID:) ⇒ Object

param int cID Campaign ID



85
86
87
# File 'lib/adglare.rb', line 85

def campaigns_delete cID: 
  call_adglare_api 'campaigns_delete', {cID: cID}
end

#campaigns_list(cID: nil, aID: nil) ⇒ Object

param int cID Campaign ID param int aID Advertiser ID



58
59
60
# File 'lib/adglare.rb', line 58

def campaigns_list cID: nil, aID: nil 
  call_adglare_api 'campaigns_list', {cID: cID, aID: aID}
end

#campaigns_modify(cID:, params: []) ⇒ Object

param int cID Campaign ID param array params at least one of the following:

int     aID                 (advertiser ID)
string  timestamp_start     (can be set to "immediately") example: 2015-12-03 15:59:59
string  runsuntil           example: 2015-12-03 15:59:59
string  name
string  status              (active, onhold, waitingreview, completed)
int     weight              (1-5)
int     tier                (1 for an In-House campaign, 2 for Normal and 3 for Override)
string  displaynetwork      (which zones this campaign should run. Use "#ALL#" to display in all zones, or delimit the zIDs by a # otherwise)
string  notes
string  notes_updatemethod  (overwrite, append, prepend) defaults to append


79
80
81
# File 'lib/adglare.rb', line 79

def campaigns_modify cID:, params: [] 
  call_adglare_api 'campaigns_modify', params + {cID: cID}
end

#reports_campaigns(date_from:, date_until:, cID: nil) ⇒ Object

param int cID Campaign ID param string date_from The start date of the result set. Use the format YYYY-MM-DD param string date_until The end date of the result set. Use the format YYYY-MM-DD



124
125
126
# File 'lib/adglare.rb', line 124

def reports_campaigns date_from:, date_until:, cID: nil
  call_adglare_api 'reports_campaigns', {date_from: date_from, date_until: date_until, cID: cID}
end

#reports_zones(date_from:, date_until:, zID: nil) ⇒ Object

param int zID Zone ID param string date_from The start date of the result set. Use the format YYYY-MM-DD param string date_until The end date of the result set. Use the format YYYY-MM-DD



132
133
134
# File 'lib/adglare.rb', line 132

def reports_zones date_from:, date_until:, zID: nil
  call_adglare_api 'reports_zones', {date_from: date_from, date_until: date_until, zID: zID}
end

#zonegroups_add(name:) ⇒ Object

param string name Zone name



21
22
23
# File 'lib/adglare.rb', line 21

def zonegroups_add name:  
  call_adglare_api 'zonegroups_add', { name: name }
end

#zonegroups_delete(zgID:) ⇒ Object

param int zgID Zone Group ID



26
27
28
# File 'lib/adglare.rb', line 26

def zonegroups_delete zgID:  
  call_adglare_api 'zonegroups_delete', { zgID: zgID }
end

#zonegroups_list(zgID: nil) ⇒ Object

param int zgID Zone Group ID



16
17
18
# File 'lib/adglare.rb', line 16

def zonegroups_list zgID: nil  
  call_adglare_api 'zonegroups_list', { zgID: zgID } 
end

#zones_add(name:, zgID:, adtype:) ⇒ Object

param string name Zone name param int zgID Zone Group ID param string adtype Ad type (jsonad or imagebanner)



39
40
41
# File 'lib/adglare.rb', line 39

def zones_add name:, zgID:, adtype: 
  call_adglare_api 'zones_add', {zgID: zgID, adtype: adtype, name: name}
end

#zones_delete(zID:) ⇒ Object

param int zID Zone ID



52
53
54
# File 'lib/adglare.rb', line 52

def zones_delete zID: 
  call_adglare_api 'zones_delete', {zID: zID}
end

#zones_list(zID: nil, zgID: nil) ⇒ Object

param int zID Zone ID param int zgID Zone Group ID



32
33
34
# File 'lib/adglare.rb', line 32

def zones_list zID: nil, zgID: nil  
  call_adglare_api 'zones_list', {zId: zID, zgID: zgID}
end

#zones_modify(zID:, name: nil, adformat: nil, zgID: nil) ⇒ Object

param int zID Zone ID param string name Zone name param string adformat The supported ad dimensions, in the format iab_000_000. Delimit and flag by a # if multiple dimensions are supported. example: #iab_468_60#iab_300_250# param int zgID Zone Group ID



47
48
49
# File 'lib/adglare.rb', line 47

def zones_modify zID:, name: nil, adformat: nil, zgID: nil 
  call_adglare_api 'zones_modify', {zID: zID, zgID: zgID, adformat: adformat, name: name}
end