Sha256: 54cf8519dca447b640a22ecdc8f2cdfdcbcbbcd9cf6c8757c17a3cb823fee90e

Contents?: true

Size: 628 Bytes

Versions: 1

Compression:

Stored size: 628 Bytes

Contents

module Nifcloud
  module Uri
    module Configuration
      VALID_OPTIONS_KEYS = [:endpoint, :secret_key, :access_key].freeze

      attr_accessor(*VALID_OPTIONS_KEYS)

      def self.extended(base)
        base.reset
      end

      def configure
        yield self
      end

      def options
        VALID_OPTIONS_KEYS.inject({}) do |option, key|
          option.merge!(key => send(key))
        end
      end

      def reset
        self.endpoint = ENV['NIFCLOUD_API_ENDPOINT']
        self.secret_key = ENV['NIFCLOUD_API_SECRET_KEY']
        self.access_key = ENV['NIFCLOUD_API_ACCESS_KEY']
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nifcloud-uri-0.1.0 lib/nifcloud/uri/configuration.rb