Search code examples
rubyyelp

Yelp API Unitialized Constant


I've ready through a lot of the documentation and question here on S/O, but I can't seem to find what I'm doing wrong.

Yelp is giving me an unitiailized constant. I've installed the gem and it's deps, have an api key, and require 'yelp' is present in my code.

Here's my error:

 yelp.rb:12:in `<main>': uninitialized constant Yelp::Review     (NameError)

Here's my code:

require 'yelp'

client = Yelp::Client.new({ consumer_key: '[struck]',
                        consumer_secret: '[struct]',
                        token: '[struck]',
                        token_secret: '[struck]'
                      })

city = 'Terre Haute'


req = Yelp::Review::Request::Location.new(
    :city => city,
    :state => 'IN',
    :category => ['coffee', 'potatoes']
    )
res = client.search(req)
puts res

EDIT: I always forgot stupid stuff -_-


Solution

  • Maybe you're using this library https://github.com/Yelp/yelp-ruby but you're following the documentation of another one https://github.com/shaper/yelp?

    They both have similar Client initialization, but the official library doesn't have Review.