2012-11-01 26 views

回答

2

您應該使用自定義格式化程序來滿足您的需求,像這樣的東西可能是很好的解決方案。

class PrestaXMLFormatter 
    include ActiveResource::Formats::XmlFormat 

    def decode(xml) 
    ActiveResource::Formats::XmlFormat.decode(xml)['prestashop'] 
    end 
end 

class Order < ActiveResource::Base 
    self.format = PrestaXMLFormatter.new 
end 
0

我有幾個外部服務,我必須談談non-rails風格的API。我使用了Savon gem組合來創建SOAP請求和解析SOAP響應,並使用Roxml gem將實際XML映射到ruby對象。