Module: Email

Included in:
TessituraRest
Defined in:
lib/tessitura_rest/custom/email.rb

Instance Method Summary collapse

Instance Method Details

#send_email(recipient, body, subject, sender, options = {}) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/tessitura_rest/custom/email.rb', line 31

def send_email(recipient, body, subject, sender, options = {})
  parameters =
    {
      'RecipientAddress': recipient,
      'HtmlBody': body,
      'FromAddress': sender,
      'Subject': subject,
      'EmailProfileId': 7,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint('Emails/Send'), options)
end

#send_login_credentials(template_id, email, profile_id, _params = '', options = {}) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/tessitura_rest/custom/email.rb', line 2

def (template_id, email, profile_id, _params = '', options = {})
   = (email, 1)
  return false if .empty?

  parameters =
    {
      'TemplateId': template_id,
      'EmailAddress': email,
      'EmailProfileId': profile_id,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  post = self.class.post(base_api_endpoint("Emails/LoginCredentials/#{.first['Id']}/Send"), options)
  post.success?
end

#send_order_confirmation(template_id, email, profile_id, order_id, _params = '', options = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/tessitura_rest/custom/email.rb', line 18

def send_order_confirmation(template_id, email, profile_id, order_id, _params = '', options = {})
  parameters =
    {
      'TemplateId': template_id,
      'EmailAddress': email,
      'EmailProfileId': profile_id,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  post = self.class.post(base_api_endpoint("Emails/OrderConfirmation/#{order_id}/Send"), options)
  post.success?
end