Class: AdGear::WebPlacement

Inherits:
Base
  • Object
show all
Defined in:
lib/ad_gear/web_placement.rb

Instance Method Summary collapse

Methods inherited from Base

belongs_to, belongs_to_associations, #encode, has_many, has_many_collections, ignorable_attributes, #initialize, #to_xml

Constructor Details

This class inherits a constructor from AdGear::Base

Instance Method Details

#selection_mechanismObject



6
7
8
9
10
11
12
# File 'lib/ad_gear/web_placement.rb', line 6

def selection_mechanism
  case value = attributes["selection_mechanism"]
  when "R" ; "rotated"
  when "W" ; "weighted"
  else     ; value
  end
end

#selection_mechanism=(value) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ad_gear/web_placement.rb', line 14

def selection_mechanism=(value)
  case value
  when /^r/i
    attributes["selection_mechanism"] = "rotated"
  when /^w/i
    attributes["selection_mechanism"] = "weighted"
  else
    # Assign whatever we received, and hope for the best
    attributes["selection_mechanism"] = value.to_s.downcase
  end
end