Module: Postmark

Extended by:
Postmark
Included in:
Postmark
Defined in:
lib/postmark/response_parsers/active_support.rb,
lib/postmark.rb,
lib/postmark/json.rb,
lib/postmark/error.rb,
lib/postmark/bounce.rb,
lib/postmark/client.rb,
lib/postmark/inbound.rb,
lib/postmark/version.rb,
lib/postmark/inflector.rb,
lib/postmark/api_client.rb,
lib/postmark/http_client.rb,
lib/postmark/deprecations.rb,
lib/postmark/account_api_client.rb,
lib/postmark/helpers/hash_helper.rb,
lib/postmark/response_parsers/json.rb,
lib/postmark/response_parsers/yajl.rb,
lib/postmark/helpers/message_helper.rb,
lib/postmark/mail_message_converter.rb

Overview

assume activesupport is already loaded

Defined Under Namespace

Modules: Deprecations, HashHelper, Inbound, Inflector, Json, MessageHelper, ResponseParsers Classes: AccountApiClient, ApiClient, ApiInputError, Bounce, Client, Error, HttpClient, HttpClientError, HttpServerError, InactiveRecipientError, InternalServerError, InvalidApiKeyError, InvalidEmailRequestError, InvalidTemplateError, MailAdapterError, MailMessageConverter, TimeoutError, UnexpectedHttpResponseError, UnknownMessageType

Constant Summary collapse

HEADERS =
{
  'User-Agent'   => "Postmark Ruby Gem v#{VERSION}",
  'Content-type' => 'application/json',
  'Accept'       => 'application/json'
}
VERSION =
'1.25.1'
@@api_client_mutex =
Mutex.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_clientObject



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/postmark.rb', line 55

def api_client
  return @api_client if @api_client

  @@api_client_mutex.synchronize do
    @api_client ||= Postmark::ApiClient.new(
                      self.api_token,
                      :secure => self.secure,
                      :proxy_host => self.proxy_host,
                      :proxy_port => self.proxy_port,
                      :proxy_user => self.proxy_user,
                      :proxy_pass => self.proxy_pass,
                      :host => self.host,
                      :port => self.port,
                      :path_prefix => self.path_prefix,
                      :max_retries => self.max_retries
                    )
  end
end

#api_tokenObject Also known as: api_key

Returns the value of attribute api_token.



38
39
40
# File 'lib/postmark.rb', line 38

def api_token
  @api_token
end

#hostObject

Returns the value of attribute host.



38
39
40
# File 'lib/postmark.rb', line 38

def host
  @host
end

#http_open_timeoutObject

Returns the value of attribute http_open_timeout.



38
39
40
# File 'lib/postmark.rb', line 38

def http_open_timeout
  @http_open_timeout
end

#http_read_timeoutObject

Returns the value of attribute http_read_timeout.



38
39
40
# File 'lib/postmark.rb', line 38

def http_read_timeout
  @http_read_timeout
end

#max_retriesObject

Returns the value of attribute max_retries.



38
39
40
# File 'lib/postmark.rb', line 38

def max_retries
  @max_retries
end

#path_prefixObject

Returns the value of attribute path_prefix.



38
39
40
# File 'lib/postmark.rb', line 38

def path_prefix
  @path_prefix
end

#portObject

Returns the value of attribute port.



38
39
40
# File 'lib/postmark.rb', line 38

def port
  @port
end

#proxy_hostObject

Returns the value of attribute proxy_host.



38
39
40
# File 'lib/postmark.rb', line 38

def proxy_host
  @proxy_host
end

#proxy_passObject

Returns the value of attribute proxy_pass.



38
39
40
# File 'lib/postmark.rb', line 38

def proxy_pass
  @proxy_pass
end

#proxy_portObject

Returns the value of attribute proxy_port.



38
39
40
# File 'lib/postmark.rb', line 38

def proxy_port
  @proxy_port
end

#proxy_userObject

Returns the value of attribute proxy_user.



38
39
40
# File 'lib/postmark.rb', line 38

def proxy_user
  @proxy_user
end

#response_parser_classObject



47
48
49
# File 'lib/postmark.rb', line 47

def response_parser_class
  @response_parser_class ||= defined?(ActiveSupport::JSON) ? :ActiveSupport : :Json
end

#secureObject

Returns the value of attribute secure.



38
39
40
# File 'lib/postmark.rb', line 38

def secure
  @secure
end

Class Method Details

.const_missing(const_name) ⇒ Object



2
3
4
5
6
# File 'lib/postmark/deprecations.rb', line 2

def self.const_missing(const_name)
  replacement = Deprecations.deprecated_constants.fetch(const_name, nil) || super
  Deprecations.report("DEPRECATION WARNING: the class #{const_name} is deprecated. Use #{replacement} instead.")
  replacement
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Postmark)

    the object that the method was called on



51
52
53
# File 'lib/postmark.rb', line 51

def configure
  yield self
end

#deliver_message(*args) ⇒ Object Also known as: send_through_postmark



74
75
76
# File 'lib/postmark.rb', line 74

def deliver_message(*args)
  api_client.deliver_message(*args)
end

#deliver_messages(*args) ⇒ Object



79
80
81
# File 'lib/postmark.rb', line 79

def deliver_messages(*args)
  api_client.deliver_messages(*args)
end

#delivery_stats(*args) ⇒ Object



83
84
85
# File 'lib/postmark.rb', line 83

def delivery_stats(*args)
  api_client.delivery_stats(*args)
end