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



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

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.



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

def ajax
  @ajax
end

#private_keyObject

Returns the value of attribute private_key.



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

def private_key
  @private_key
end

#public_keyObject

Returns the value of attribute public_key.



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

def public_key
  @public_key
end

Instance Method Details

#campaigns_add(name:) ⇒ Object

param string name Campaign name



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

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



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

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



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

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



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

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



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

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



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

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



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

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


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

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



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

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



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

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



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

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

#zonegroups_delete(zgID:) ⇒ Object

param int zgID Zone Group ID



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

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

#zonegroups_list(zgID: nil) ⇒ Object

param int zgID Zone Group ID



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

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)



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

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



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

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



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

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



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

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