Class: Mailosaur::MailosaurClient
- Inherits:
-
Object
- Object
- Mailosaur::MailosaurClient
- Defined in:
- lib/mailosaur.rb
Overview
The Mailosaur client — the main entry point to the Mailosaur API. Construct an instance with your API key (or set the MAILOSAUR_API_KEY environment variable), then use the operations namespaces (messages, servers, files, devices, analysis, previews, usage) to automate email and SMS testing.
Instance Method Summary collapse
-
#analysis ⇒ Analysis
Operations for analyzing email content and deliverability, including spam scoring.
-
#devices ⇒ Devices
Operations for managing virtual security devices and retrieving their one-time passwords.
-
#files ⇒ Files
Operations for downloading attachments, EML source, and email preview screenshots.
-
#initialize(api_key = nil, base_url: 'https://mailosaur.com/') ⇒ MailosaurClient
constructor
Returns an instance of the Mailosaur client.
-
#messages ⇒ Messages
Operations for finding, retrieving, creating, and managing email and SMS messages.
-
#previews ⇒ Previews
Operations for discovering the email clients available for generating email previews.
-
#servers ⇒ Servers
Operations for creating and managing your Mailosaur inboxes (servers).
-
#usage ⇒ Usage
Operations for inspecting account usage limits and recent transactional usage.
Constructor Details
#initialize(api_key = nil, base_url: 'https://mailosaur.com/') ⇒ MailosaurClient
Returns an instance of the Mailosaur client.
76 77 78 79 80 81 82 83 |
# File 'lib/mailosaur.rb', line 76 def initialize(api_key = nil, base_url: 'https://mailosaur.com/') resolved_api_key = api_key || ENV['MAILOSAUR_API_KEY'] raise ArgumentError, "'api_key' must be set. Set the MAILOSAUR_API_KEY environment variable or pass it to the MailosaurClient constructor." unless resolved_api_key @api_key = resolved_api_key @base_url = base_url end |
Instance Method Details
#analysis ⇒ Analysis
Operations for analyzing email content and deliverability, including spam scoring.
87 88 89 |
# File 'lib/mailosaur.rb', line 87 def analysis @analysis ||= Analysis.new(connection, method(:handle_http_error)) end |
#devices ⇒ Devices
Operations for managing virtual security devices and retrieving their one-time passwords.
117 118 119 |
# File 'lib/mailosaur.rb', line 117 def devices @devices ||= Devices.new(connection, method(:handle_http_error)) end |
#files ⇒ Files
Operations for downloading attachments, EML source, and email preview screenshots.
93 94 95 |
# File 'lib/mailosaur.rb', line 93 def files @files ||= Files.new(connection, method(:handle_http_error)) end |
#messages ⇒ Messages
Operations for finding, retrieving, creating, and managing email and SMS messages.
99 100 101 |
# File 'lib/mailosaur.rb', line 99 def @messages ||= Messages.new(connection, method(:handle_http_error)) end |
#previews ⇒ Previews
Operations for discovering the email clients available for generating email previews.
123 124 125 |
# File 'lib/mailosaur.rb', line 123 def previews @previews ||= Previews.new(connection, method(:handle_http_error)) end |