Sha256: 3930ff8658e3881d5554961ea701586235e5058448eae1fb325911174354057c

Contents?: true

Size: 601 Bytes

Versions: 2

Compression:

Stored size: 601 Bytes

Contents

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

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

    def self.max_age_default
      MAX_AGE_DEFAULT
    end

    def initialize
      @max_age = MAX_AGE_DEFAULT
    end

    def authenticatable?
      !!api_key
    end

    def invalid_service_id?
      service_id_nil? || service_id_blank?
    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

2 entries across 2 versions & 1 rubygems

Version Path
fastly-rails-0.3.0 lib/fastly-rails/configuration.rb
fastly-rails-0.2.0 lib/fastly-rails/configuration.rb