class CoffeeHunt::API

Constants

API_HOST
BUSINESS_PATH
SEARCH_PATH

Public Class Methods

api_key() click to toggle source
# File lib/Coffee_Hunt/api.rb, line 13
def self.api_key 
  begin
    @@key = File.open(File.expand_path("~/.yelp-api-key")).read.strip
  rescue 
    puts "Uh Oh! Looks like you are missing your Yelp API key! You can sign up for a new key and enter it or exit the CLI."
    @@key = gets.strip 
    return if @@key == "exit"
      File.open(File.expand_path("~/.yelp-api-key"), "w") do |file|
      file.print @@key
    end
  end
  @@key

end