-1

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
Pradeep
  • 3,093
  • 17
  • 21

1 Answers1

0

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

egor_hm
  • 290
  • 2
  • 9