Module: IntuitIdsAggcat::Rails

Defined in:
lib/intuit_ids_aggcat/rails.rb

Overview

A handful of useful Rails integration methods.

If you require this gem inside a Rails application (via config.gem for rails 2 and bundler for rails 3) then Rails.setup is called automatically.

Class Method Summary collapse

Class Method Details

.load_yaml_configObject

Loads Intuit IDS AggCat configuration options from RAILS_ROOT/config/intuit_ids_aggcat.yml.

This configuration file is optional. You can omit this file and instead use ruby to configure the gem inside a configuration initialization script (e.g. RAILS_ROOT/config/intializers/intuit_ids_aggcat.rb).

If you have a yaml configuration file it should be formatted like the standard database.yml file in a Rails application. This means there should be one section for Rails environment:

development:
  certificate_path: path to private key
  issuer_id: SAML issuer ID provided by intuit
  oauth_consumer_key: OAuth consumer key
  oauth_consumer_secret: OAuth consumer secret

production:
  certificate_path: path to private key
  issuer_id: SAML issuer ID provided by intuit
  oauth_consumer_key: OAuth consumer key
  oauth_consumer_secret: OAuth consumer secret


65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/intuit_ids_aggcat/rails.rb', line 65

def self.load_yaml_config

  path = Pathname.new("#{rails_root}/config/intuit_ids_aggcat.yml")

  if File.exists?(path)
    cfg = YAML::load(ERB.new(File.read(path)).result)
    unless cfg[rails_env]
      raise "config/intuit_ids_aggcat.yml is missing a section for `#{rails_env}`"
    end
    IntuitIdsAggcat.config(cfg[rails_env])
  end

end

.log_to_rails_loggernil

Configures gem to log to the Rails default logger.

Returns:

  • (nil)


82
83
84
85
# File 'lib/intuit_ids_aggcat/rails.rb', line 82

def self.log_to_rails_logger
 # AWS.config(:logger => rails_logger)
  nil
end

.setupnil

Returns:

  • (nil)


37
38
39
40
41
# File 'lib/intuit_ids_aggcat/rails.rb', line 37

def self.setup
  load_yaml_config
  log_to_rails_logger
  nil
end