Class: Sem4r::CountryTargetSearchParameter

Inherits:
Object
  • Object
show all
Includes:
Sem4rSoap::SoapAttributes
Defined in:
lib/sem4r/targeting_idea/targeting_idea_selector.rb

Instance Method Summary collapse

Methods included from Sem4rSoap::SoapAttributes

#_from_element, #_to_s, #_to_xml, included

Constructor Details

#initialize(&block) ⇒ CountryTargetSearchParameter

Returns a new instance of CountryTargetSearchParameter.



104
105
106
107
108
# File 'lib/sem4r/targeting_idea/targeting_idea_selector.rb', line 104

def initialize(&block)
  if block_given?
    block.arity < 1 ? instance_eval(&block) : block.call(self)
  end
end

Instance Method Details

#to_xmlObject



110
111
112
113
114
115
116
117
118
119
# File 'lib/sem4r/targeting_idea/targeting_idea_selector.rb', line 110

def to_xml
  xml = ""
  xml << '<s:searchParameters xsi:type="s:CountryTargetSearchParameter">'
  country_codes.each do |t|
    # tag contryCode is into the cm namespace (sem4r main namespace)
    # tag contryTarget is into o namespace (sem4r service namespace)
    xml << "<s:countryTargets><countryCode>#{t}</countryCode></s:countryTargets>"
  end
  xml << '</s:searchParameters>'
end