module LastFM

Constants

VERSION

Public Class Methods

api_key() click to toggle source
# File lib/last_fm.rb, line 16
def self.api_key
  load_api_key_from_env if not has_key?
  @api_key
end
api_key=(key) click to toggle source
# File lib/last_fm.rb, line 12
def self.api_key=(key)
  @api_key = key
end
has_key?() click to toggle source
# File lib/last_fm.rb, line 21
def self.has_key?
  !@api_key.nil? and @api_key != ''
end
load_api_key_from_env() click to toggle source
# File lib/last_fm.rb, line 25
def self.load_api_key_from_env
  @api_key = ENV['lastfm_api_key']
  if not has_key?
    raise "API key not found! Try 'export lastfm_api_key=YOUR_KEY'"
  end
end