Module: Filepreviews::Config
- Included in:
- Filepreviews
- Defined in:
- lib/filepreviews/config.rb
Overview
Configurable module for API key and options
Instance Attribute Summary collapse
-
#api_key ⇒ String
API/Secret key to be used.
-
#api_key, :secret_key ⇒ String
API/Secret key to be used.
-
#secret_key ⇒ String
API/Secret key to be used.
Class Method Summary collapse
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Configures api_key and options Usage example: Filepreviews.configure do |config| config.api_key = ‘your_api_key_here’ config.secret_key = ‘your_api_key_here’ end.
Instance Attribute Details
#api_key ⇒ String
Returns API/Secret key to be used.
11 12 13 |
# File 'lib/filepreviews/config.rb', line 11 def api_key @api_key end |
#api_key, :secret_key ⇒ String
Returns API/Secret key to be used.
11 |
# File 'lib/filepreviews/config.rb', line 11 attr_accessor :api_key, :secret_key |
#secret_key ⇒ String
Returns API/Secret key to be used.
11 12 13 |
# File 'lib/filepreviews/config.rb', line 11 def secret_key @secret_key end |
Class Method Details
.included(base) ⇒ Object
5 6 7 |
# File 'lib/filepreviews/config.rb', line 5 def self.included(base) base.extend(self) end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Configures api_key and options
Usage example:
Filepreviews.configure do |config|
config.api_key = 'your_api_key_here'
config.secret_key = 'your_api_key_here'
end
Alternate way:
Filepreviews.api_key = ENV['YOUR_API_KEY']
Filepreviews.secret_key = ENV['YOUR_SECRET_KEY']
25 26 27 |
# File 'lib/filepreviews/config.rb', line 25 def configure yield self if block_given? end |