Module: Filepreviews::Config

Included in:
Filepreviews
Defined in:
lib/filepreviews/config.rb

Overview

Configurable module for API key and options

Author:

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_keyString

Returns API/Secret key to be used.

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_keyString

Returns API/Secret key to be used.

Returns:

  • API/Secret key to be used



11
# File 'lib/filepreviews/config.rb', line 11

attr_accessor :api_key, :secret_key

#secret_keyString

Returns API/Secret key to be used.

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']

Parameters:

  • api/secret key to use

Yields:

  • (_self)

Yield Parameters:



25
26
27
# File 'lib/filepreviews/config.rb', line 25

def configure
  yield self if block_given?
end