Class: Sem4r::ManualCPCAdGroupBids
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
# File 'lib/sem4r/ad_group/ad_group_bids.rb', line 115
def self.from_element(el)
new do
kel = el.at_xpath("keywordMaxCpc")
if kel
el_amount = kel.at_xpath("amount")
keyword_max_cpc(el_amount.at_xpath("microAmount").text.strip.to_i)
end
sel = el.at_xpath("siteMaxCpc")
if sel
el_amount = sel.at_xpath("amount")
site_max_cpc(el_amount.at_xpath("microAmount").text.strip.to_i)
end
end
end
|
Instance Method Details
#to_xml(builder = nil) ⇒ Object
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
# File 'lib/sem4r/ad_group/ad_group_bids.rb', line 89
def to_xml(builder = nil)
builder = Builder::XmlMarkup.new unless builder
xml(builder)
end
|
#xml(t) ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/sem4r/ad_group/ad_group_bids.rb', line 64
def xml(t)
return "" unless @keyword_max_cpc or @site_max_cpc
t.tag!('bids', 'xsi:type' => 'ManualCPCAdGroupBids') { |xml|
xml.tag!('AdGroupBids.Type') { xml.text! 'ManualCPCAdGroupBids' }
if @keyword_max_cpc
xml.keywordMaxCpc {
xml.amount {
xml.tag!('ComparableValue.Type') { xml.text! 'Money' }
xml.microAmount keyword_max_cpc
}
}
end
if @site_max_cpc
xml.siteMaxCpc {
xml.amount {
xml.tag!('ComparableValue.Type') { xml.text! 'Money' }
xml.microAmount site_max_cpc
}
}
end
}
end
|