Sha256: 6b5784eea81fcac39795442fe58da8151fb025a06a5ba7777420a49d0dff0b0d

Contents?: true

Size: 949 Bytes

Versions: 1

Compression:

Stored size: 949 Bytes

Contents

module Framey
  
  module Configuration
    VERSION = '1.0.1'.freeze unless defined?(VERSION)
    
    DEFAULT_API_HOST = "http://framey.com".freeze
    DEFAULT_USER_AGENT = "Framey Ruby Gem #{VERSION}".freeze
    DEFAULT_RUN_ENV = "production"
    
    CONFIGURATION_OPTIONS = {
      :api_key => nil,
      :api_secret => nil,
      :api_timeout => 15, # minutes
      :max_recording_time => 30, # seconds
      :api_host => DEFAULT_API_HOST,
      :run_env => DEFAULT_RUN_ENV,
      :user_agent => DEFAULT_USER_AGENT
    }.freeze
    
    attr_accessor *(CONFIGURATION_OPTIONS.map { |k,v| k })
    
    def self.extended(base)
      base.reset
    end
        
    def configure(&blk)
      yield(self)
    end
    
    def options
      options = {}
      CONFIGURATION_OPTIONS.each{|k| options[k] = send(k) }
      options
    end

    def reset
      CONFIGURATION_OPTIONS.each do |k,v|
        send("#{k}=",v)
      end
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
framey-1.0.1 lib/framey/configuration.rb