Class: PostageApp::Configuration
- Inherits:
-
Object
- Object
- PostageApp::Configuration
- Defined in:
- lib/postageapp/configuration.rb
Instance Attribute Summary collapse
-
#environment ⇒ Object
Environment gem is running in.
-
#framework ⇒ Object
The framework PostageApp gem runs in.
-
#host ⇒ Object
The host to connect to (default: ‘api.postageapp.com’).
-
#http_open_timeout ⇒ Object
The HTTP open timeout in seconds (defaults to 2).
-
#http_read_timeout ⇒ Object
The HTTP read timeout in seconds (defaults to 5).
-
#logger ⇒ Object
The logger used by this gem.
-
#port ⇒ Object
The port on which PostageApp service runs (default: 443 for secure, 80 for insecure connections).
-
#project_root ⇒ Object
The file path of the project.
-
#protocol ⇒ Object
The protocol used to connect to the service (default: ‘https’ for secure and ‘http’ for insecure connections).
-
#proxy_host ⇒ Object
The hostname of the proxy server (if using a proxy).
-
#proxy_pass ⇒ Object
The password for the proxy server (if using proxy).
-
#proxy_port ⇒ Object
The port of the proxy server (if using proxy).
-
#proxy_user ⇒ Object
The username for the proxy server (if using proxy).
-
#recipient_override ⇒ Object
The email address that all send_message method should address all messages while overriding original addresses.
-
#requests_to_resend ⇒ Object
A list of API method names payloads of which are captured and resent in case of service unavailability.
-
#secure ⇒ Object
(also: #secure?)
true
for https,false
for http connections (default: istrue
).
Instance Method Summary collapse
- #api_key ⇒ Object
- #api_key=(key) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #url ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
56 57 58 59 60 61 62 63 64 |
# File 'lib/postageapp/configuration.rb', line 56 def initialize @secure = true @host = 'api.postageapp.com' @http_open_timeout = 5 @http_read_timeout = 10 @requests_to_resend = %w( send_message ) @framework = 'undefined framework' @environment = 'production' end |
Instance Attribute Details
#environment ⇒ Object
Environment gem is running in
51 52 53 |
# File 'lib/postageapp/configuration.rb', line 51 def environment @environment end |
#framework ⇒ Object
The framework PostageApp gem runs in
48 49 50 |
# File 'lib/postageapp/configuration.rb', line 48 def framework @framework end |
#host ⇒ Object
The host to connect to (default: ‘api.postageapp.com’)
11 12 13 |
# File 'lib/postageapp/configuration.rb', line 11 def host @host end |
#http_open_timeout ⇒ Object
The HTTP open timeout in seconds (defaults to 2).
30 31 32 |
# File 'lib/postageapp/configuration.rb', line 30 def http_open_timeout @http_open_timeout end |
#http_read_timeout ⇒ Object
The HTTP read timeout in seconds (defaults to 5).
33 34 35 |
# File 'lib/postageapp/configuration.rb', line 33 def http_read_timeout @http_read_timeout end |
#logger ⇒ Object
The logger used by this gem
54 55 56 |
# File 'lib/postageapp/configuration.rb', line 54 def logger @logger end |
#port ⇒ Object
The port on which PostageApp service runs (default: 443 for secure, 80 for insecure connections)
15 16 17 |
# File 'lib/postageapp/configuration.rb', line 15 def port @port end |
#project_root ⇒ Object
The file path of the project. This is where logs and failed requests can be stored
45 46 47 |
# File 'lib/postageapp/configuration.rb', line 45 def project_root @project_root end |
#protocol ⇒ Object
The protocol used to connect to the service (default: ‘https’ for secure and ‘http’ for insecure connections)
8 9 10 |
# File 'lib/postageapp/configuration.rb', line 8 def protocol @protocol end |
#proxy_host ⇒ Object
The hostname of the proxy server (if using a proxy)
18 19 20 |
# File 'lib/postageapp/configuration.rb', line 18 def proxy_host @proxy_host end |
#proxy_pass ⇒ Object
The password for the proxy server (if using proxy)
27 28 29 |
# File 'lib/postageapp/configuration.rb', line 27 def proxy_pass @proxy_pass end |
#proxy_port ⇒ Object
The port of the proxy server (if using proxy)
21 22 23 |
# File 'lib/postageapp/configuration.rb', line 21 def proxy_port @proxy_port end |
#proxy_user ⇒ Object
The username for the proxy server (if using proxy)
24 25 26 |
# File 'lib/postageapp/configuration.rb', line 24 def proxy_user @proxy_user end |
#recipient_override ⇒ Object
The email address that all send_message method should address all messages while overriding original addresses
37 38 39 |
# File 'lib/postageapp/configuration.rb', line 37 def recipient_override @recipient_override end |
#requests_to_resend ⇒ Object
A list of API method names payloads of which are captured and resent in case of service unavailability
41 42 43 |
# File 'lib/postageapp/configuration.rb', line 41 def requests_to_resend @requests_to_resend end |
#secure ⇒ Object Also known as: secure?
true
for https, false
for http connections (default: is true
)
4 5 6 |
# File 'lib/postageapp/configuration.rb', line 4 def secure @secure end |
Instance Method Details
#api_key ⇒ Object
72 73 74 |
# File 'lib/postageapp/configuration.rb', line 72 def api_key @api_key || ENV['POSTAGEAPP_API_KEY'] end |
#api_key=(key) ⇒ Object
68 69 70 |
# File 'lib/postageapp/configuration.rb', line 68 def api_key=(key) @api_key = key end |
#url ⇒ Object
92 93 94 |
# File 'lib/postageapp/configuration.rb', line 92 def url "#{self.protocol}://#{self.host}:#{self.port}" end |