Class: OpenX::Services::Zone
Constant Summary collapse
- BANNER =
Delivery types
'delivery-b'
- INTERSTITIAL =
'delivery-i'
- TEXT =
'delivery-t'
- EMAIL =
'delivery-e'
- JAVASCRIPT =
Tag Types
'adjs'
- LOCAL =
'local'
- IFRAME =
'adframe'
- XMLRPC_TAG =
'xmlrpc'
Class Method Summary collapse
-
.deliver(zone_id, options = {}) ⇒ Object
Deliver
zone_id
toip_address
withcookies
,.
Instance Method Summary collapse
-
#generate_tags(tag_type = IFRAME) ⇒ Object
Generate tags for displaying this zone using
tag_type
. -
#initialize(params = {}) ⇒ Zone
constructor
A new instance of Zone.
-
#link_banner(banner) ⇒ Object
Link this zone to
banner
. -
#link_campaign(campaign) ⇒ Object
Link this zone to
campaign
. -
#unlink_banner(banner) ⇒ Object
Unlink this zone from
banner
. -
#unlink_campaign(campaign) ⇒ Object
Unlink this zone from
campaign
.
Methods inherited from Base
#<=>, establish_connection, has_one, #new_record?, openx_accessor, remote, with_connection
Methods included from Persistance::ClassMethods
Methods included from Persistance::InstanceMethods
Constructor Details
#initialize(params = {}) ⇒ Zone
Returns a new instance of Zone.
42 43 44 45 46 |
# File 'lib/openx/services/zone.rb', line 42 def initialize(params = {}) raise "need publisher" unless params[:publisher_id] || params[:publisher] params[:publisher_id] ||= params[:publisher].id super(params) end |
Class Method Details
.deliver(zone_id, options = {}) ⇒ Object
Deliver zone_id
to ip_address
with cookies
,
34 35 36 37 38 |
# File 'lib/openx/services/zone.rb', line 34 def deliver(zone_id, = {}) = { 'ip_address' => '192.168.1.1', 'cookies' => [] }.update() server = XmlrpcClient.new("#{connection.host}/delivery/axmlrpc.php") server.call('openads.view', , "zone:#{zone_id}", 0, '', '', true, []) end |
Instance Method Details
#generate_tags(tag_type = IFRAME) ⇒ Object
Generate tags for displaying this zone using tag_type
77 78 79 |
# File 'lib/openx/services/zone.rb', line 77 def (tag_type = IFRAME) remote.call("ox.generateTags", self.id, tag_type, []) end |
#link_banner(banner) ⇒ Object
Link this zone to banner
63 64 65 66 67 |
# File 'lib/openx/services/zone.rb', line 63 def () raise "Zone must be saved" if new_record? raise ArgumentError.new("Banner must be saved")if .new_record? remote.call("ox.linkBanner", self.id, .id) end |
#link_campaign(campaign) ⇒ Object
Link this zone to campaign
49 50 51 52 53 |
# File 'lib/openx/services/zone.rb', line 49 def link_campaign(campaign) raise "Zone must be saved" if new_record? raise ArgumentError.new("Campaign must be saved")if campaign.new_record? remote.call("ox.linkCampaign", self.id, campaign.id) end |
#unlink_banner(banner) ⇒ Object
Unlink this zone from banner
70 71 72 73 74 |
# File 'lib/openx/services/zone.rb', line 70 def () raise "Zone must be saved" if new_record? raise ArgumentError.new("Banner must be saved")if .new_record? remote.call("ox.unlinkBanner", self.id, .id) end |
#unlink_campaign(campaign) ⇒ Object
Unlink this zone from campaign
56 57 58 59 60 |
# File 'lib/openx/services/zone.rb', line 56 def unlink_campaign(campaign) raise "Zone must be saved" if new_record? raise ArgumentError.new("Campaign must be saved")if campaign.new_record? remote.call("ox.unlinkCampaign", self.id, campaign.id) end |