Sha256: e8ac6bac422449be9d20e103c673ae0a43d4532060cf8995510b5478cce9a9b0

Contents?: true

Size: 732 Bytes

Versions: 4

Compression:

Stored size: 732 Bytes

Contents

module Outliers
  class Provider

    attr_reader :credentials

    def self.connect_to(credentials)
      provider = credentials.fetch 'provider'
      Outliers::Providers.name_map.fetch(provider).new credentials
    rescue KeyError
      raise Outliers::Exceptions::UnknownProvider.new "Unkown provider '#{provider.join('_').downcase}'."
    end

    def self.to_human
      (self.to_s.split('::') - ['Outliers', 'Providers']).map { |p| p.underscore }.join('_').downcase
    end

    def self.credential_arguments
      {}
    end

    def initialize(credentials)
      @credentials = credentials
      @logger      = Outliers.logger
      settings credentials.keys_to_sym
    end

    def logger
      @logger
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
outliers-0.2.0 lib/outliers/provider.rb
outliers-0.1.1 lib/outliers/provider.rb
outliers-0.1.0 lib/outliers/provider.rb
outliers-0.0.1 lib/outliers/provider.rb