Class: Mailosaur::Previews
- Inherits:
-
Object
- Object
- Mailosaur::Previews
- Defined in:
- lib/Mailosaur/previews.rb
Overview
Operations for discovering the email clients available for generating email previews (screenshots of an email rendered in real clients). Accessed via client.previews.
Instance Attribute Summary collapse
-
#conn ⇒ Connection
readonly
The client connection.
Instance Method Summary collapse
-
#initialize(conn, handle_http_error) ⇒ Previews
constructor
Creates and initializes a new instance of the Previews class.
-
#list_email_clients ⇒ Mailosaur::Models::EmailClientListResult
List all email clients that can be used to generate email previews.
Constructor Details
#initialize(conn, handle_http_error) ⇒ Previews
Creates and initializes a new instance of the Previews class.
10 11 12 13 |
# File 'lib/Mailosaur/previews.rb', line 10 def initialize(conn, handle_http_error) @conn = conn @handle_http_error = handle_http_error end |
Instance Attribute Details
#conn ⇒ Connection (readonly)
Returns the client connection.
16 17 18 |
# File 'lib/Mailosaur/previews.rb', line 16 def conn @conn end |
Instance Method Details
#list_email_clients ⇒ Mailosaur::Models::EmailClientListResult
List all email clients that can be used to generate email previews.
23 24 25 26 27 28 |
# File 'lib/Mailosaur/previews.rb', line 23 def list_email_clients response = conn.get 'api/screenshots/clients' @handle_http_error.call(response) unless response.status == 200 model = JSON.parse(response.body) Mailosaur::Models::EmailClientListResult.new(model) end |