Sha256: a816c668f062abc7e67efdae69051488ff72beda766d39a251c122031bb67ddb

Contents?: true

Size: 648 Bytes

Versions: 4

Compression:

Stored size: 648 Bytes

Contents

module Outliers
  class Provider

    attr_reader :account

    def self.connect_to(account)
      provider = account.fetch 'provider'
      Outliers::Providers.name_map.fetch(provider).new account
    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 initialize(account)
      @account = account
      @logger      = Outliers.logger
      settings account.keys_to_sym
    end

    def logger
      @logger
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
outliers-0.5.0 lib/outliers/provider.rb
outliers-0.5.0.beta3 lib/outliers/provider.rb
outliers-0.5.0.beta2 lib/outliers/provider.rb
outliers-0.5.0.beta1 lib/outliers/provider.rb