我试图愚弄Vacuum gem,但我对这个例子有些疑问。当我按照首页上描述的那样运行代码时:
req = Vacuum.new
req.configure key: 'foo',
secret: 'secret',
tag: 'biz-val'
params = { 'Operation' => 'ItemSearch',
'SearchIndex' => 'Books',
'Keywords' => 'Architecture' }
res = req.get query: params # XPath is your friend.
我在从响应中获取XML时遇到问题。我可以看到对象类型是Excon::Response
并且实际上包含数据,但是如何检索它包含的XML?
我已尝试使用res.to_xml和res.xml,甚至将其加载到Nokogiri中,但没有成功。
答案 0 :(得分:0)
我发现了。 XML已保存在响应中的对象Body中。