Sha256: 8968c700d66883a9ef8566597868bb37a192e9329d67c1c914d8da7f988a3a3c

Contents?: true

Size: 836 Bytes

Versions: 7

Compression:

Stored size: 836 Bytes

Contents

require "fastly-rails/engine"
require "fastly-rails/client"
require "fastly-rails/configuration"
require "fastly-rails/errors"

module FastlyRails

  def self.configuration
    @configuration ||= Configuration.new
  end

  def self.configure
    yield configuration if block_given?
  end

  def self.service_id
    raise NoServiceIdProvidedError if configuration.invalid_service_id?
    configuration.service_id
  end

  def self.purging_enabled?
    configuration.purging_enabled?
  end

  def self.purge_by_key(*args)
    client.purge_by_key(*args) if purging_enabled?
  end

  def self.client
    raise NoAPIKeyProvidedError unless configuration.authenticatable?

    @client ||= Client.new(
      :api_key  => configuration.api_key,
      :user     => configuration.user,
      :password => configuration.password,
    )
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fastly-rails-0.8.0 lib/fastly-rails.rb
fastly-rails-0.7.1 lib/fastly-rails.rb
fastly-rails-0.7.0 lib/fastly-rails.rb
fastly-rails-0.6.0 lib/fastly-rails.rb
fastly-rails-0.5.0 lib/fastly-rails.rb
fastly-rails-0.4.1 lib/fastly-rails.rb
fastly-rails-0.4.0 lib/fastly-rails.rb