class BananaPeels::API

Attributes

api_key[R]

Public Class Methods

cache?() click to toggle source
# File lib/banana_peels/api.rb, line 72
def cache?
  ['true', 't', 'yes', 'y', 'on'].include?(ENV['BANANA_PEELS_CACHE'].to_s.downcase)
end
cache_get(key) click to toggle source
# File lib/banana_peels/api.rb, line 63
def cache_get(key)
  cache[key]
end
cache_set(key, value) click to toggle source
# File lib/banana_peels/api.rb, line 67
def cache_set(key, value)
  cache[key] = value if cache?
  value
end
new(api_key) click to toggle source
# File lib/banana_peels/api.rb, line 86
def initialize(api_key)
  @api_key = api_key
end

Private Class Methods

cache() click to toggle source
# File lib/banana_peels/api.rb, line 79
def cache
  @cache ||= {}
end

Public Instance Methods

method_missing(method, *args) click to toggle source
# File lib/banana_peels/api.rb, line 90
def method_missing(method, *args)
  Proxy.new(@api_key, method)
end