Module: Postmark
- Defined in:
- lib/postmark/response_parsers/active_support.rb,
lib/postmark.rb,
lib/postmark/json.rb,
lib/postmark/bounce.rb,
lib/postmark/http_client.rb,
lib/postmark/response_parsers/json.rb,
lib/postmark/response_parsers/yajl.rb
Overview
assume activesupport is already loaded
Defined Under Namespace
Modules: HttpClient, Json, ResponseParsers Classes: Bounce, InternalServerError, InvalidApiKeyError, InvalidMessageError, UnknownError
Constant Summary collapse
- HEADERS =
{ 'Content-type' => 'application/json', 'Accept' => 'application/json' }
- MAX_RETRIES =
2
Class Attribute Summary collapse
-
.api_key ⇒ Object
Returns the value of attribute api_key.
-
.host ⇒ Object
The host to connect to.
-
.http_open_timeout ⇒ Object
Returns the value of attribute http_open_timeout.
-
.http_read_timeout ⇒ Object
Returns the value of attribute http_read_timeout.
-
.max_retries ⇒ Object
Returns the value of attribute max_retries.
-
.path_prefix ⇒ Object
The path of the listener.
-
.port ⇒ Object
The port on which your Postmark server runs.
-
.proxy_host ⇒ Object
Returns the value of attribute proxy_host.
-
.proxy_pass ⇒ Object
Returns the value of attribute proxy_pass.
-
.proxy_port ⇒ Object
Returns the value of attribute proxy_port.
-
.proxy_user ⇒ Object
Returns the value of attribute proxy_user.
- .response_parser_class ⇒ Object
-
.secure ⇒ Object
Returns the value of attribute secure.
-
.sleep_between_retries ⇒ Object
Returns the value of attribute sleep_between_retries.
Class Method Summary collapse
- .configure {|_self| ... } ⇒ Object
- .delivery_stats ⇒ Object
-
.send_through_postmark(message) ⇒ Object
:nodoc:.
Class Attribute Details
.api_key ⇒ Object
Returns the value of attribute api_key.
32 33 34 |
# File 'lib/postmark.rb', line 32 def api_key @api_key end |
.host ⇒ Object
The host to connect to.
47 48 49 |
# File 'lib/postmark.rb', line 47 def host @host end |
.http_open_timeout ⇒ Object
Returns the value of attribute http_open_timeout.
32 33 34 |
# File 'lib/postmark.rb', line 32 def http_open_timeout @http_open_timeout end |
.http_read_timeout ⇒ Object
Returns the value of attribute http_read_timeout.
32 33 34 |
# File 'lib/postmark.rb', line 32 def http_read_timeout @http_read_timeout end |
.max_retries ⇒ Object
Returns the value of attribute max_retries.
32 33 34 |
# File 'lib/postmark.rb', line 32 def max_retries @max_retries end |
.path_prefix ⇒ Object
The path of the listener
52 53 54 |
# File 'lib/postmark.rb', line 52 def path_prefix @path_prefix end |
.port ⇒ Object
The port on which your Postmark server runs.
42 43 44 |
# File 'lib/postmark.rb', line 42 def port @port end |
.proxy_host ⇒ Object
Returns the value of attribute proxy_host.
32 33 34 |
# File 'lib/postmark.rb', line 32 def proxy_host @proxy_host end |
.proxy_pass ⇒ Object
Returns the value of attribute proxy_pass.
32 33 34 |
# File 'lib/postmark.rb', line 32 def proxy_pass @proxy_pass end |
.proxy_port ⇒ Object
Returns the value of attribute proxy_port.
32 33 34 |
# File 'lib/postmark.rb', line 32 def proxy_port @proxy_port end |
.proxy_user ⇒ Object
Returns the value of attribute proxy_user.
32 33 34 |
# File 'lib/postmark.rb', line 32 def proxy_user @proxy_user end |
.response_parser_class ⇒ Object
37 38 39 |
# File 'lib/postmark.rb', line 37 def response_parser_class @response_parser_class ||= Object.const_defined?(:ActiveSupport) ? :ActiveSupport : :Json end |
.secure ⇒ Object
Returns the value of attribute secure.
32 33 34 |
# File 'lib/postmark.rb', line 32 def secure @secure end |
.sleep_between_retries ⇒ Object
Returns the value of attribute sleep_between_retries.
32 33 34 |
# File 'lib/postmark.rb', line 32 def sleep_between_retries @sleep_between_retries end |
Class Method Details
.configure {|_self| ... } ⇒ Object
72 73 74 |
# File 'lib/postmark.rb', line 72 def configure yield self end |
.delivery_stats ⇒ Object
90 91 92 |
# File 'lib/postmark.rb', line 90 def delivery_stats HttpClient.get("deliverystats") end |
.send_through_postmark(message) ⇒ Object
:nodoc:
76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/postmark.rb', line 76 def send_through_postmark() #:nodoc: @retries = 0 begin HttpClient.post("email", Postmark::Json.encode(convert_mail())) rescue Exception => e if @retries < max_retries @retries += 1 retry else raise end end end |