class Mailosaur::Files

Attributes

conn[R]

@return [Connection] the client connection.

Public Class Methods

new(conn, handle_http_error) click to toggle source

Creates and initializes a new instance of the Files class. @param client connection.

# File lib/Mailosaur/files.rb, line 7
def initialize(conn, handle_http_error)
  @conn = conn
  @handle_http_error = handle_http_error
end

Public Instance Methods

get_attachment(id) click to toggle source

Download an attachment

Downloads a single attachment. Simply supply the unique identifier for the required attachment.

@param id The identifier of the attachment to be downloaded.

@return [NOT_IMPLEMENTED] operation results.

# File lib/Mailosaur/files.rb, line 25
def get_attachment(id)
  response = conn.get 'api/files/attachments/' + id
  @handle_http_error.call(response) unless response.status == 200
  response.body
end
get_email(id) click to toggle source

Download EML

Downloads an EML file representing the specified email. Simply supply the unique identifier for the required email.

@param id The identifier of the email to be downloaded.

@return [NOT_IMPLEMENTED] operation results.

# File lib/Mailosaur/files.rb, line 41
def get_email(id)
  response = conn.get 'api/files/email/' + id
  @handle_http_error.call(response) unless response.status == 200
  response.body
end