Skip to content

Instantly share code, notes, and snippets.

@hartct
Created October 25, 2012 03:55
Show Gist options
  • Save hartct/3950336 to your computer and use it in GitHub Desktop.
Save hartct/3950336 to your computer and use it in GitHub Desktop.
Example of using post_save method with xml-mapping gem
class InstitutionLogin
include XML::Mapping
# added namespaces to make root element compliant with recipients's expectation
def post_save xml, options={:mapping=>:_default}
xml.root.add_attributes("xmlns"=>"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1")
xml.root.add_namespace "xsi", "http://www.w3.org/2001/XMLSchema-instance"
xml.root.add_namespace "xsd", "http://www.w3.org/2001/XMLSchema"
end
self.root_element_name "InstitutionLogin"
object_node :credentials, "credentials", :default_value => nil
object_node :challenge_responses, "challengeResponses", :default_value => nil
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment