Module: UniOne::Client::Email

Included in:
UniOne::Client
Defined in:
lib/unione/client/email.rb

Instance Method Summary collapse

Instance Method Details

#send_email(message) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/unione/client/email.rb', line 6

def send_email(message)
  post 'email/send.json', message
  validate_response({
    'type' => 'object', 'required' => ['status', 'job_id', 'emails'], 'properties' => {
      'status' => {'type' => 'string'},
      'job_id' => {'type' => 'string'},
      'emails' => {'items' => {'type' => 'string'}},
      'failed_emails' => {'type' => 'object'}}
  })
end

#subscribe_email(email_address_from:, email_address_to:, name_from:) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/unione/client/email.rb', line 17

def subscribe_email(email_address_from:, email_address_to:, name_from:)
  params = {
    email_address_from: email_address_from,
    email_address_to: email_address_to,
    name_from: name_from
  }
  post 'email/subscribe.json', params
  validate_response({
    'type' => 'object', 'required' => ['status'], 'properties' => {
      'status' => {'type' => 'string'}}
  })
end