Class: TigerdataMailer

Inherits:
ApplicationMailer show all
Defined in:
app/mailers/tigerdata_mailer.rb

Instance Method Summary collapse

Instance Method Details

#project_activationObject

Raises:

  • (ArgumentError)


28
29
30
31
32
33
34
35
36
37
38
# File 'app/mailers/tigerdata_mailer.rb', line 28

def project_activation
  config = Rails.application.config.tigerdata_mail[:project_activation]
  @project_id = params[:project_id]
  raise(ArgumentError, "Invalid Project ID provided for the TigerdataMailer: #{@project_id}") if project.nil?

  @user_email = params[:user].email
  @message_body = params[:activation_failure_msg]

  subject = "Project Failed to Activate"
  mail(to: user_email, cc: config[:cc_email], subject:, template_name: 'activate')
end

#project_creationObject

Raises:

  • (ArgumentError)


3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/mailers/tigerdata_mailer.rb', line 3

def project_creation
  config = Rails.application.config.tigerdata_mail[:project_creation]
  @project_id = params[:project_id]

  raise(ArgumentError, "Invalid Project ID provided for the TigerdataMailer: #{@project_id}") if project.nil?

  # attaching json response  to the mailer
  json_content = .to_json
  attachments["#{filebase}.json"] = {
    mime_type: "application/json",
    content: json_content
  }

  # attaching xml response to the mailer
  @xml_content = project.to_xml.html_safe

  attachments["#{filebase}.xml"] = {
    mime_type: "application/xml",
    content: @xml_content
  }

  subject = "New Project Request Ready for Review"
  mail(to: config[:to_email], cc: config[:cc_email], subject:)
end