Class: PewPew::Resources::Messages

Inherits:
Object
  • Object
show all
Includes:
PewPew::Resource
Defined in:
lib/pew_pew/resources/messages.rb

Instance Method Summary collapse

Instance Method Details

#send_email(params) ⇒ Mash

Sends an email.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :from (String)

    email address to use for the From header

  • :to (String, Array<String>)

    recipient or list of recipient email addresses

  • :cc (String)

    same as :to, but for CC

  • :bcc (String)

    same as :to, but for BCC

  • :subject (String)

    message subject

  • :text (String)

    text version of the message body

  • :html (String)

    HTML version of the message body

  • :attachment (File, Array<File>)

    file attachments

  • :inline (File, Array<File>)

    inline file attachments

Returns:

  • (Mash)

    the response body



20
21
22
# File 'lib/pew_pew/resources/messages.rb', line 20

def send_email(params)
  post("#{domain}/messages", params)
end

#send_mime(params) ⇒ Mash

Sends a MIME email.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :to (String, Array<String>)

    recipient or list of recipient email addresses

  • :message (File)

    file containing the full MIME content of the message

Returns:

  • (Mash)

    the response body



31
32
33
34
# File 'lib/pew_pew/resources/messages.rb', line 31

def send_mime(params)
  headers = { content_type: 'multipart/form-data' }
  post("#{domain}/messages.mime", params, headers)
end