class Outliers::Provider

Attributes

account[R]

Public Class Methods

collections() click to toggle source
# File lib/outliers/provider.rb, line 32
def self.collections
  Outliers::Resources.collections.select {|r| r.to_human =~ /^#{to_human}/}
end
connect_to(account) click to toggle source
# File lib/outliers/provider.rb, line 14
def self.connect_to(account)
  provider_name = account.fetch 'provider'

  if exists? provider_name
    find_by_name(provider_name).new account
  else
    raise Outliers::Exceptions::UnknownProvider.new "Invalid provider '#{provider_name}'."
  end
end
exists?(name) click to toggle source
# File lib/outliers/provider.rb, line 10
def self.exists?(name)
  find_by_name(name) != nil
end
find_by_name(name) click to toggle source
# File lib/outliers/provider.rb, line 6
def self.find_by_name(name)
  Outliers::Providers.name_map.fetch name, nil
end
new(account) click to toggle source
# File lib/outliers/provider.rb, line 36
def initialize(account)
  @account = account
  @logger      = Outliers.logger
  settings account.keys_to_sym
end
resources() click to toggle source
# File lib/outliers/provider.rb, line 28
def self.resources
  Outliers::Resources.resources.select {|r| r.to_human =~ /^#{to_human}/}
end
to_human() click to toggle source
# File lib/outliers/provider.rb, line 24
def self.to_human
  (self.to_s.split('::') - ['Outliers', 'Providers']).map { |p| p.underscore }.join('_').downcase
end

Public Instance Methods

logger() click to toggle source
# File lib/outliers/provider.rb, line 42
def logger
  @logger
end