Getting error: ./http.rb:13: undefined method `code' for # (NoMethodError)
#!/usr/bin/ruby
require 'rubygems'
require 'httparty'
class Foo
include HTTParty
end
# Simple get with full url
r = Foo.get('http://www.google.com/')
p r.code
Getting error: ./http.rb:13: undefined method `code' for # (NoMethodError)
#!/usr/bin/ruby
require 'rubygems'
require 'httparty'
class Foo
include HTTParty
end
# Simple get with full url
r = Foo.get('http://www.google.com/')
p r.code
Include HTTParty adds the method code of the specified module to the Foo class as well. See mixin!
module HTTParty
module AllowedFormatsDeprecation
def get
#...
end
end
end
mixin HTTParty into Foo should work