class Grubber::Command
Public Instance Methods
auth()
click to toggle source
# File lib/grubber/command.rb, line 24 def auth config = Grubber::Config.load say("\nGrubber requires Yelp API v2 credentials") say("To learn more go to: http://www.yelp.com/developers") if config.has_auth? say("\nYelp authentication already set:") say("Consumer Key: #{config.consumer_key}") say("Consumer Secret: #{config.consumer_secret}\n") say("Token Key: #{config.token_key}\n") say("Token Sec: #{config.token_secret}\n") overwrite = ask('Overwrite? (y,n)') return unless overwrite.downcase == 'y' end c_key = ask("\nConsumer Key: ") c_sec = ask('Consumer Secret: ') t_key = ask('Token Key: ') t_sec = ask('Token Sec: ') if Grubber::Config.update_auth(c_key, c_sec, t_key, t_sec) say("Complete!", :green) else say("Failed", :red) end end
list()
click to toggle source
# File lib/grubber/command.rb, line 13 def list Presenter.new( Restaurant.all ).present end
locate()
click to toggle source
# File lib/grubber/command.rb, line 18 def locate lat, lng = Grubber::Config.update_location say "Updated coordinates to: #{lat}, #{lng}", :green end
pick()
click to toggle source
# File lib/grubber/command.rb, line 8 def pick Presenter.new( Restaurant.random ).present end