Class: OpenX::Services::Banner
- Inherits:
-
Base
- Object
- Base
- OpenX::Services::Banner
show all
- Defined in:
- lib/openx/services/banner.rb
Constant Summary
collapse
- LOCAL_SQL =
'sql'
- LOCAL_WEB =
'web'
- EXTERNAL =
'url'
- HTML =
'html'
- TEXT =
'txt'
- RUNNING =
0
- PAUSED =
1
Constants inherited
from Base
OpenX::Services::Base::CONFIGURATION_YAML
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#<=>, configuration, configuration=, connection, connection=, create!, destroy, #destroy, has_one, #new_record?, openx_accessor, #save!
Constructor Details
#initialize(params = {}) ⇒ Banner
Returns a new instance of Banner.
74
75
76
77
78
|
# File 'lib/openx/services/banner.rb', line 74
def initialize(params = {})
raise ArgumentError.new("Missing campaign_id") unless params[:campaign_id] || params[:campaign]
params[:campaign_id] ||= params[:campaign].id
super(params)
end
|
Class Method Details
.find(id, *args) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/openx/services/banner.rb', line 16
def find(id, *args)
session = self.connection
server = XmlrpcClient.new2("#{session.url}")
if id == :all
responses = server.call(find_all(), session, *args)
response = responses.first
return [] unless response
responses = [response]
while response.key?('aImage')
response = response.delete('aImage')
break unless response
responses << response
end
responses.map { |response|
new(translate(response))
}
else
response = server.call(find_one(), session, id)
new(translate(response))
end
end
|
Instance Method Details
#statistics(start_on = Date.today, end_on = Date.today) ⇒ Object
80
81
82
83
|
# File 'lib/openx/services/banner.rb', line 80
def statistics start_on = Date.today, end_on = Date.today
session = self.class.connection
@server.call('ox.bannerDailyStatistics', session, self.id, start_on, end_on)
end
|
#targeting ⇒ Object
85
86
87
88
|
# File 'lib/openx/services/banner.rb', line 85
def targeting
session = self.class.connection
@server.call('ox.getBannerTargeting', session, self.id)
end
|
#targeting=(targeting) ⇒ Object
90
91
92
93
|
# File 'lib/openx/services/banner.rb', line 90
def targeting= targeting
session = self.class.connection
@server.call('ox.setBannerTargeting', session, self.id, targeting)
end
|