Class: Nylas::RawMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/nylas/raw_message.rb

Overview

Allows sending of email with nylas from an rfc822 compatible string

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mime_compatible_string, api:) ⇒ RawMessage

Returns a new instance of RawMessage.



8
9
10
11
# File 'lib/nylas/raw_message.rb', line 8

def initialize(mime_compatible_string, api:)
  self.api = api
  self.mime_compatible_string = mime_compatible_string
end

Instance Attribute Details

#apiObject

Returns the value of attribute api.



6
7
8
# File 'lib/nylas/raw_message.rb', line 6

def api
  @api
end

#mime_compatible_stringObject

Returns the value of attribute mime_compatible_string.



6
7
8
# File 'lib/nylas/raw_message.rb', line 6

def mime_compatible_string
  @mime_compatible_string
end

Instance Method Details

#send!Object



13
14
15
16
17
18
19
20
# File 'lib/nylas/raw_message.rb', line 13

def send!
  Message.new(**api.execute(
    method: :post,
    path: "/send",
    payload: mime_compatible_string,
    headers: HEADERS
  ).merge(api: api))
end