Class: Mailosaur::Previews
- Inherits:
-
Object
- Object
- Mailosaur::Previews
- Defined in:
- lib/Mailosaur/previews.rb
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 ⇒ PreviewEmailClientListResult
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.
7 8 9 10 |
# File 'lib/Mailosaur/previews.rb', line 7 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.
13 14 15 |
# File 'lib/Mailosaur/previews.rb', line 13 def conn @conn end |
Instance Method Details
#list_email_clients ⇒ PreviewEmailClientListResult
List all email clients that can be used to generate email previews.
Returns a list of available email clients.
22 23 24 25 26 27 |
# File 'lib/Mailosaur/previews.rb', line 22 def list_email_clients response = conn.get 'api/previews/clients' @handle_http_error.call(response) unless response.status == 200 model = JSON.parse(response.body) Mailosaur::Models::PreviewEmailClientListResult.new(model) end |