Module: BrowseEverything

Defined in:
lib/browse_everything/auth/google/credentials.rb,
lib/browse_everything.rb,
lib/browse_everything/engine.rb,
lib/browse_everything/browser.rb,
lib/browse_everything/version.rb,
lib/browse_everything/driver/s3.rb,
lib/browse_everything/retriever.rb,
lib/browse_everything/driver/box.rb,
lib/browse_everything/file_entry.rb,
lib/browse_everything/driver/base.rb,
lib/browse_everything/driver/dropbox.rb,
lib/browse_everything/driver/file_system.rb,
lib/browse_everything/driver/google_drive.rb,
lib/browse_everything/driver/authentication_factory.rb,
lib/browse_everything/auth/google/request_parameters.rb

Overview

Manages request parameters for the request to the Google Drive API

Defined Under Namespace

Modules: Auth, Driver Classes: Browser, ConfigGenerator, ConfigurationError, DownloadError, Engine, FileEntry, InitializationError, InstallGenerator, NotAuthorizedError, NotImplementedError, Retriever

Constant Summary collapse

VERSION =
'1.0.0.rc2'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject


74
75
76
77
78
79
80
# File 'lib/browse_everything.rb', line 74

def config
  if @config.nil?
    config_path = Rails.root.join 'config', 'browse_everything_providers.yml'
    configure config_path.to_s
  end
  @config
end

Class Method Details

.configure(value) ⇒ Object


50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/browse_everything.rb', line 50

def configure(value)
  return if value.nil?
  if value.is_a?(Hash)
    @config = ActiveSupport::HashWithIndifferentAccess.new value
  elsif value.is_a?(String)
    begin
      config_file_content = File.read(value)
      config_file_template = ERB.new(config_file_content)
      config_values = YAML.safe_load(config_file_template.result, [Symbol])
      @config = ActiveSupport::HashWithIndifferentAccess.new config_values
      @config.deep_symbolize_keys
    rescue Errno::ENOENT
      raise ConfigurationError, 'Missing browse_everything_providers.yml configuration file'
    end
  else
    raise InitializationError, "Unrecognized configuration: #{value.inspect}"
  end

  if @config.include? 'drop_box' # rubocop:disable Style/GuardClause
    warn '[DEPRECATION] `drop_box` is deprecated.  Please use `dropbox` instead.'
    @config['dropbox'] = @config.delete('drop_box')
  end
end