Dal Rai
Dal Rai

Reputation: 1

decode file stream in savon client

I have a file stream generated by .xlsm file as savon response ruby. How do I decode or convert the stream and save it to file_name.xlsm?

@body= "http://schemas.xmlsoap.org/soap/envelope/\">http://tempuri.org/\">212706.0_PCT.xlsmhttp://tempuri.org/\">UEsDBBQABgAIAFs+Lk1un6t7iQIAAMkWAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...........

Upvotes: 0

Views: 98

Answers (1)

Steffen Roller
Steffen Roller

Reputation: 3484

Use the Nokogiri gem to extract the content from the element in @body. Then use Base64.decode64() to convert the data into binary and finally write it to a file.

Upvotes: 1

Related Questions