Module: XMLConverters
- Included in:
- HashConverters
- Defined in:
- lib/kalibro_client/helpers/xml_converters.rb
Instance Method Summary collapse
Instance Method Details
#get_xml(field, field_value) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/kalibro_client/helpers/xml_converters.rb', line 9 def get_xml(field, field_value) hash = Hash.new if field_value.is_a?(KalibroClient::Entities::Base) hash = {:attributes! => {}} hash[:attributes!][field.to_sym] = { 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:type' => 'kalibro:' + xml_instance_class_name(field_value) } end hash end |
#xml_instance_class_name(object) ⇒ Object
2 3 4 5 6 7 |
# File 'lib/kalibro_client/helpers/xml_converters.rb', line 2 def xml_instance_class_name(object) xml_name = object.class.name xml_name["KalibroClient::Entities::"] = "" if xml_name.start_with?("KalibroClient::Entities::") xml_name[0..0] = xml_name[0..0].downcase xml_name + "Xml" end |