Created
June 16, 2012 23:32
-
-
Save brettfishman/2942832 to your computer and use it in GitHub Desktop.
Configuring Nori when upgrading Savon from 0.8.6 to 1.0.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Calling #to_hash on the Savon response in earlier version of Savon (0.8.6) return namespace keys formatted | |
# as such: :type, :ns14, :xsi. But in Savon 1.0.0, #to_hash returns namespace keys like :"@xsi:type", | |
# :"@xmlns:ns14", and :"@xmlns:xsi". This broke some parsing logic we had set up for the hashed Savon response. | |
# To change the format of these tags (or any tag, for that matter) in the hashed response, | |
# you can configure Nori like so: | |
Nori.configure do |config| | |
config.convert_tags_to do |tag| | |
converted_tag = tag[0] == "@" ? (tag.split(":")[1] || tag[1..-1]) : tag | |
converted_tag.snakecase.to_sym | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment