Search code examples
ruby-on-railsrubyerror-handlinginitializergibbon

uninitialized constant Request (NameError)


I get this error: /LiveToChallenge/config/initializers/gibbon.rb:1:in '<top (required)>': uninitialized constant Gibbon::Request (NameError) when I try to start the server rails server.

app/config/initializers/gibbon.rb

require 'gibbon'
Gibbon::Request.api_key = "24e4a2233cd34debb76ed083dc3f8b5379-us8"
Gibbon::Request.timeout = 15

I followed gibbon gem instructions, which seemed simple enough. Maybe I'm missing something besides just gem install gibbon and adding api_key to initializer?

The gem is installed as gibbon (2.2.2, 2.2.1, 1.2.1)

And as added measure I put gem gibbon in the gemfile and ran bundle install

This problem is part of a larger problem I've been working on solving.


Solution

  • I experienced same issue with gibbon 2.0 version as it has updated some methods for initializations then i tried a previous version & it worked but first You should try it this way :

    gibbon = Gibbon::Request.new(api_key: "MailChimp_API_Key")
    gibbon.timeout = 10
    

    If no luck with this in app/config/initializers/gibbon.rb then you can try to do this direct in the controller just before using gibbon to retrieve or add list stuff for testing.