Module: PostageApp
- Defined in:
- lib/postageapp.rb,
lib/postageapp/version.rb
Defined Under Namespace
Modules: FailedRequest, Rails Classes: Configuration, Error, Logger, Mailer, Railtie, Request, Response
Constant Summary collapse
- VERSION =
begin IO.read(File.join(File.dirname(__FILE__), '/../../VERSION')).chomp rescue 'UNKNOWN' end
Class Method Summary collapse
-
.configuration ⇒ Object
(also: config)
Accessor for the PostageApp::Configuration object Example use: PostageApp.configuration.api_key = ‘1234567890abcdef’.
-
.configure {|configuration| ... } ⇒ Object
Call this method to modify your configuration Example: PostageApp.configure do |config| config.api_key = ‘1234567890abcdef’ config.recipient_override = ‘[email protected]’ if Rails.env.staging? end.
-
.logger ⇒ Object
Logger for the plugin.
Class Method Details
.configuration ⇒ Object Also known as: config
Accessor for the PostageApp::Configuration object Example use:
PostageApp.configuration.api_key = '1234567890abcdef'
41 42 43 |
# File 'lib/postageapp.rb', line 41 def configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object
Call this method to modify your configuration Example:
PostageApp.configure do |config|
config.api_key = '1234567890abcdef'
config.recipient_override = '[email protected]' if Rails.env.staging?
end
If you do not want/need to initialize the gem in this way, you can use the environment variable POSTAGEAPP_API_KEY to set up your key.
34 35 36 |
# File 'lib/postageapp.rb', line 34 def configure yield configuration end |
.logger ⇒ Object
Logger for the plugin
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/postageapp.rb', line 47 def logger @logger ||= begin configuration.logger || PostageApp::Logger.new( if configuration.project_root FileUtils.mkdir_p(File.join(File.(configuration.project_root), 'log')) File.join(configuration.project_root, "log/postageapp_#{configuration.environment}.log") else STDOUT end ) end end |