Class: BananaPeels::API
- Inherits:
-
Object
- Object
- BananaPeels::API
- Defined in:
- lib/banana_peels/api.rb
Defined Under Namespace
Classes: Proxy
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(api_key) ⇒ API
constructor
A new instance of API.
- #method_missing(method, *args) ⇒ Object
Constructor Details
#initialize(api_key) ⇒ API
Returns a new instance of API.
86 87 88 |
# File 'lib/banana_peels/api.rb', line 86 def initialize(api_key) @api_key = api_key end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
58 59 60 |
# File 'lib/banana_peels/api.rb', line 58 def api_key @api_key end |
Class Method Details
.cache? ⇒ Boolean
72 73 74 |
# 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) ⇒ Object
63 64 65 |
# File 'lib/banana_peels/api.rb', line 63 def cache_get(key) cache[key] end |
.cache_set(key, value) ⇒ Object
67 68 69 70 |
# File 'lib/banana_peels/api.rb', line 67 def cache_set(key, value) cache[key] = value if cache? value end |