Sha256: e6377aacab61dffc9be48a03b894a2315b152e55536779b395832862913a66a8

Contents?: true

Size: 659 Bytes

Versions: 2

Compression:

Stored size: 659 Bytes

Contents

module Captivus
  class Configuration
    def initialize(attrs = {}, &block)
      defaults = {
        :scheme => 'http',
        :host => 'api.captiv.us',
        :environment => 'production',
        :development_environments => %w[development test]
      }
      configure defaults.merge(attrs), &block
    end

    attr_accessor :host, :scheme, :api_key, :api_secret_key, :environment, :development_environments

    def configure(attrs = {})
      attrs.each { |attr, value| send "#{attr}=", value }
      yield self if block_given?
      self
    end

    def ==(other)
      other.is_a?(Captivus::Configuration) && host == other.host
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
captivus-0.0.6 lib/captivus/configuration.rb
captivus-0.0.5 lib/captivus/configuration.rb