Was muss ich tun, damit Hash.from_xml () funktioniert?

Ich habe 'ActiveSupport' installiert und benötige 'active_support' in meinem Code, bekomme aber einen "No Method Error", wenn ich versuche, das zu verwendenHash.from_xml() Methode.

Was vermisse ich?

$ gem list

kehrt zurück:

\*** LOCAL GEMS \***

activesupport (3.2.6)  
bundler (1.1.4)  
i18n (0.6.0)  
json (1.7.3)  
mime-types (1.19)  
multi_json (1.3.6)  
rake (0.9.2.2)  
rest-client (1.6.7)  
rubygems-bundler (1.0.3)  
rvm (1.11.3.5)

Und:

$ ruby -v

kehrt zurück:

ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]

Die Inhalte vonfile.rb sind:

require 'active_support'  
require 'rest-client'  
require 'json'  
token = "xxx"  
user = "xxx"  
survey_id = "xxx"  
responses_from_api = RestClient.get "https://survey.qualtrics.com/WRAPI/ControlPanel/api.php?Request=getLegacyResponseData&User=#{user}&Token=#{token}&Version=2.0&SurveyID=#{survey_id}&Format=XML"  
responses = Hash.from_xml(responses_from_api).to_json  
puts responses

Und:

$ ruby file.rb

kehrt zurück:

file.rb:8:in `<main>': undefined method `from_xml' for Hash:Class (NoMethodError)

Antworten auf die Frage(1)

Ihre Antwort auf die Frage