class FilepickerRails::Configuration

Attributes

api_key[W]

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'
cdn_host[RW]

Set your CDN Path to be used

More info about CDN on [Ink documentation](developers.filepicker.io/docs/cdn/)

#### Examples

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

config.filepicker_rails.cdn_host = 'Your CDN host name'
secret_key[RW]

Define your Secret key to be used on Policy.

More info about Policy on [Ink documentation](developers.filepicker.io/docs/security/)

#### Examples

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

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

Public Instance Methods

api_key() click to toggle source

@private

# File lib/filepicker_rails/configuration.rb, line 45
def api_key
  @api_key or raise "Set config.filepicker_rails.api_key"
end
expiry() click to toggle source

@private

# File lib/filepicker_rails/configuration.rb, line 73
def expiry
  @expiry ||= -> { Time.zone.now.to_i + 600 }
end
expiry=(expiry) click to toggle source

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](en.wikipedia.org/wiki/Unix_time).

#### 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 }
# 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