Class: OpenX::Services::Channel
- Defined in:
- lib/openx/services/channel.rb
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Channel
constructor
A new instance of Channel.
-
#targeting ⇒ Object
Retrieves targeting from channel.
-
#targeting=(rules) ⇒ Object
Applied targeting to channel.
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 = {}) ⇒ Channel
Returns a new instance of Channel.
20 21 22 23 24 |
# File 'lib/openx/services/channel.rb', line 20 def initialize(params = {}) raise "need publisher" unless params[:publisher_id] || params[:publisher] params[:publisher_id] ||= params[:publisher].id super(params) end |
Instance Method Details
#targeting ⇒ Object
Retrieves targeting from channel
27 28 29 30 31 32 |
# File 'lib/openx/services/channel.rb', line 27 def targeting raise "Channel must be saved" if new_record? remote.call("ox.getChannelTargeting", self.id).map do |line| TargetingRule.instantiate(line) end end |
#targeting=(rules) ⇒ Object
Applied targeting to channel. See OpenX::TargetingRules for details
35 36 37 38 |
# File 'lib/openx/services/channel.rb', line 35 def targeting=(rules) raise "Channel must be saved" if new_record? remote.call("ox.setChannelTargeting", self.id, rules) end |