Class: Sem4r::ManualCPMAdGroupBids
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from AdGroupBids
#initialize, #to_s
#_from_element, #_to_s, #_to_xml, included
Class Method Details
.from_element(el) ⇒ Object
159
160
161
162
163
164
165
166
167
|
# File 'lib/sem4r/ad_group/ad_group_bids.rb', line 159
def self.from_element(el)
new do
kel = el.xpath("maxCpm").first
if kel
el_amount = kel.xpath("amount").first
max_cpm el_amount.xpath("microAmount").first.text.strip.to_i
end
end
end
|
Instance Method Details
#to_xml(builder = nil) ⇒ Object
154
155
156
157
|
# File 'lib/sem4r/ad_group/ad_group_bids.rb', line 154
def to_xml(builder = nil)
builder = Builder::XmlMarkup.new unless builder
xml(builder)
end
|
#xml(t) ⇒ Object
141
142
143
144
145
146
147
148
149
150
151
152
|
# File 'lib/sem4r/ad_group/ad_group_bids.rb', line 141
def xml(t)
return "" unless @max_cpm
t.tag!('bids', 'xsi:type' => 'ManualCPMAdGroupBids') { |xml|
xml.tag!('AdGroupBids.Type') { xml.text! 'ManualCPMAdGroupBids' }
xml.maxCpm {
xml.amount {
xml.tag!('ComparableValue.Type') { xml.text! 'Money' }
xml.microAmount max_cpm
}
}
}
end
|