Sha256: 7ce8021b56f2eccf066cb422d007e26d324f86fc8f42ce1152e12cdc25b1cb09

Contents?: true

Size: 870 Bytes

Versions: 3

Compression:

Stored size: 870 Bytes

Contents

require 'layervault/version'
require 'layervault/middleware/raise_error'

module LayerVault
  module Default

    API_ENDPOINT = "https://api.layervault.com/api/v1/".freeze
    USER_AGENT   = "LayerVault Ruby Gem #{LayerVault::VERSION}".freeze

    MIDDLEWARE = Faraday::Builder.new do |builder|
      builder.use LayerVault::Middleware::RaiseError
      builder.request :url_encoded
      builder.adapter Faraday.default_adapter
    end

    class << self
      def options
        Hash[LayerVault::Configurable.keys.map{|key| [key, send(key)]}]
      end

      def access_token
        ENV['LAYERVAULT_ACCESS_TOKEN']
      end

      def api_endpoint
        ENV['LAYERVAULT_API_ENDPOINT'] || API_ENDPOINT
      end

      def user_agent
        ENV['LAYERVAULT_USER_AGENT'] || USER_AGENT
      end

      def middleware
        MIDDLEWARE
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
layervault-0.1.2 lib/layervault/default_options.rb
layervault-0.1.1 lib/layervault/default_options.rb
layervault-0.1.0 lib/layervault/default_options.rb