class BananaPeels::API::Proxy
Public Class Methods
new(api_key, mod)
click to toggle source
# File lib/banana_peels/api.rb, line 97 def initialize(api_key, mod) @api_key = api_key @mod = mod end
Public Instance Methods
method_missing(method, *args)
click to toggle source
# File lib/banana_peels/api.rb, line 102 def method_missing(method, *args) if API.cache? cache_keys = [ @api_key, @mod.to_s, method.to_s ] cache_keys.concat(args) cache_key = cache_keys.to_json cache_val = API.cache_get(cache_key) return cache_val if cache_val end cache_val = Mailchimp::API.new(@api_key).__send__(@mod).__send__(method, *args) API.cache_set(cache_key, cache_val) if API.cache? cache_val end