Created
July 20, 2020 21:31
-
-
Save HopperMCS/8b59f35408afd3bd433a8dc873fa3a8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.api_public_key | |
begin | |
@@public = File.open(File.expand_path("~/.newsfeed_key")).read.strip | |
rescue | |
puts "No public key found. Please follow the instructions at https://newsapi.org to get your keys." | |
# create public key | |
puts "Please enter your public key:" | |
@@public = gets.strip | |
return if @@public == "exit" | |
File.open(File.expand_path("~/.newsfeed_key"), "w") do |file| | |
file.print @@public | |
end | |
end | |
@@public | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
module NatGeo
class API
end