Class: FilepickerRails::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/filepicker_rails/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_key=(value) ⇒ Object

Define your API Key to be used.

Examples

This is to be used on the config/application.rb:

 config.filepicker_rails.api_key = 'Your filepicker.io API Key'

12
13
14
# File 'lib/filepicker_rails/configuration.rb', line 12

def api_key=(value)
  @api_key = value
end

#cdn_host=(value) ⇒ Object

Set your CDN Path to be used

More info about CDN on Ink documentation

Examples

This is to be used on the config/application.rb:

 config.filepicker_rails.cdn_host = 'Your CDN host name'

39
40
41
# File 'lib/filepicker_rails/configuration.rb', line 39

def cdn_host=(value)
  @cdn_host = value
end

#secret_key=(value) ⇒ Object

Define your Secret key to be used on Policy.

More info about Policy on Ink documentation

Examples

This is to be used on the config/application.rb:

 config.filepicker_rails.secret_key = 'Your filepicker.io Secret Key'

24
25
26
# File 'lib/filepicker_rails/configuration.rb', line 24

def secret_key=(value)
  @secret_key = value
end

Instance Method Details

#expiry=(expiry) ⇒ Object

Define the expire time when using Policy.

By default the expiry time is 10 minutes. If you need to change the expiry time this should be an integer and it is expressed in seconds since the Epoch.

Examples

This is to be used on the config/application.rb:

 config.filepicker_rails.expiry = -> { (Time.zone.now + 5.minutes).to_i }
 # Define the expiry time to 5 minutes

If you need always the same url, a static expiry time, to do some cache. You can set a date starting of the Epoch.

config.filepicker_rails.expiry = -> { 100.years.since(Time.at(0)).to_i }

Raises:

  • (ArgumentError)

67
68
69
70
# File 'lib/filepicker_rails/configuration.rb', line 67

def expiry=(expiry)
  raise ArgumentError, 'Must be a callable' unless expiry.respond_to?(:call)
  @expiry = expiry
end