Sha256: 999d285699705062697e821fb982789c545bda5a6a98e5b5ab1011490489a937

Contents?: true

Size: 721 Bytes

Versions: 6

Compression:

Stored size: 721 Bytes

Contents

module FastlyRails
  class Configuration
    # 30 days
    MAX_AGE_DEFAULT = '2592000'

    attr_accessor :api_key, :user, :password, :max_age, :service_id
    attr_writer :purging_enabled

    def self.max_age_default
      MAX_AGE_DEFAULT
    end

    def initialize
      @max_age = MAX_AGE_DEFAULT
      @purging_enabled = true
    end

    def authenticatable?
      !!api_key
    end

    def invalid_service_id?
      service_id_nil? || service_id_blank?
    end

    def purging_enabled?
      @purging_enabled
    end

    private

    def has_credentials?
      user && password
    end

    def service_id_nil?
      service_id.nil?
    end

    def service_id_blank?
      service_id.blank?
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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