Module: PostageApp
- Defined in:
- lib/postageapp.rb,
lib/postageapp/version.rb
Defined Under Namespace
Modules: FailedRequest, HTTP, Mail, Rails Classes: Configuration, Diagnostics, Error, Logger, Mailer, Railtie, Request, Response
Constant Summary collapse
- VERSION =
'1.3.1'.freeze
Class Method Summary collapse
-
.configuration ⇒ Object
(also: config)
Accessor for the PostageApp::Configuration object Example use: PostageApp.configuration.api_key = ‘1234567890abcdef’.
- .configuration_reset! ⇒ Object
-
.configure(reset = false) {|self.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'
34 35 36 |
# File 'lib/postageapp.rb', line 34 def self.configuration @configuration ||= Configuration.new end |
.configuration_reset! ⇒ Object
38 39 40 |
# File 'lib/postageapp.rb', line 38 def self.configuration_reset! @configuration = nil end |
.configure(reset = false) {|self.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.
23 24 25 26 27 28 29 |
# File 'lib/postageapp.rb', line 23 def self.configure(reset = false) if (reset) self.configuration_reset! end yield(self.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 self.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 |