Module: Ecircle::Helper

Extended by:
Helper
Included in:
Helper
Defined in:
lib/ecircle/helper.rb

Instance Method Summary collapse

Instance Method Details

#build_group_xml(attrs) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ecircle/helper.rb', line 19

def build_group_xml attrs
  # Important note: Actually I have no idea what ecircle wants here. This works for me. Just go with the flow.
  xml = Builder::XmlMarkup.new
  xml.tag! 'group', :xmlns => 'http://webservices.ecircle-ag.com/ecm', 'group-id' => 'new', 'preferred-channel' => 'email' do
    xml.name attrs[:name]
    xml.description attrs[:description]
    xml.tag! 'email-channel' do
      xml.email attrs[:email]
    end
  end
  xml.target!.gsub('"', "'").gsub('\\', '')
end

#build_user_xml(attributes) ⇒ Object



12
13
14
15
16
17
# File 'lib/ecircle/helper.rb', line 12

def build_user_xml attributes
  '<user>' + attributes.each_with_object('') do |slice, xml|
    name, value = slice.first, slice.last;
    xml << "<#{name}>#{value}</#{name}>"
  end+'</user>'
end