Yelp ruby gem on Heroku -


i have code initializer in yelp.rb:

yelp.client.configure |config|  config.consumer_key = env['config.consumer_key']  config.consumer_secret = env['config.consumer_secret']  config.token = env['config.token']  config.token_secret = env['config.token_secret'] end 

i have yelp.yml file loads in , works great in development.

as push heroku (i have keys set in heroku , have triple verified no spelling errors) error 'yelp::error::missingapikeys: you're missing api key'

i've ran code in rails c on development (see below) , passes, ran exact same code in rails c on heroku side , error. tried without using env , used exact api keys , same error.

client = yelp::client.new({     consumer_key = env['config.consumer_key'],   consumer_secret = env['config.consumer_secret'],   token = env['config.token'],   token_secret = env['config.token_secret'] }) 

what different between production , development?

update: got working... able working way...

def index       current_user.zip_code.present? ? @zip = current_user.zip_code :     @zip = "94101"       parameters = { term: 'auto repair', limit: 9 }       @search = client.search(@zip, parameters)   end    private   def client      @client ||= yelp::client.new({ consumer_key: env['config.consumer_key'],       consumer_secret: env['config.consumer_secret'],       token: env['config.token'],       token_secret: env['config.token_secret']     })   end 

run heroku config --app app-name check if config variables being set correctly, if looks correct. try running rails console on heroku using heroku run rails console --app app-name check if yelp::client loading env properly.

if follow env naming convention provided in gem readme might avoid issue altogether.

yelp.client.configure |config|   config.consumer_key = your_consumer_key   config.consumer_secret = your_consumer_secret   config.token = your_token   config.token_secret = your_token_secret end 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -