Module: SendGrid4r::Factory::MailFactory
- Defined in:
- lib/sendgrid4r/factory/mail_factory.rb
Overview
SendGrid Web API v3 MailFactory implementation
Class Method Summary collapse
- .create_address(email:, name: nil) ⇒ Object
- .create_attachment(content:, filename:) ⇒ Object
- .create_content(type:, value:) ⇒ Object
- .create_mail_settings ⇒ Object
- .create_params(personalizations:, from:, subject:, content:) ⇒ Object
- .create_personalization(to:) ⇒ Object
- .create_tracking_settings ⇒ Object
Class Method Details
.create_address(email:, name: nil) ⇒ Object
23 24 25 |
# File 'lib/sendgrid4r/factory/mail_factory.rb', line 23 def self.create_address(email:, name: nil) SendGrid4r::REST::Mail::Address.new(email, name) end |
.create_attachment(content:, filename:) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/sendgrid4r/factory/mail_factory.rb', line 35 def self.(content:, filename:) SendGrid4r::REST::Mail::Attachment.new( nil, nil, nil, nil, nil ).tap do || .content = content .filename = filename end end |
.create_content(type:, value:) ⇒ Object
52 53 54 |
# File 'lib/sendgrid4r/factory/mail_factory.rb', line 52 def self.create_content(type:, value:) SendGrid4r::REST::Mail::Content.new(type, value) end |
.create_mail_settings ⇒ Object
44 45 46 |
# File 'lib/sendgrid4r/factory/mail_factory.rb', line 44 def self.create_mail_settings SendGrid4r::REST::Mail::MailSettings.new(nil, nil, nil, nil, nil) end |
.create_params(personalizations:, from:, subject:, content:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/sendgrid4r/factory/mail_factory.rb', line 9 def self.create_params( personalizations:, from:, subject:, content: ) SendGrid4r::REST::Mail::Params.new( nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil ).tap do |params| params.personalizations = personalizations params.from = from params.content = content params.subject = subject end end |
.create_personalization(to:) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/sendgrid4r/factory/mail_factory.rb', line 27 def self.create_personalization(to:) SendGrid4r::REST::Mail::Personalization.new( nil, nil, nil, nil, nil, nil, nil, nil ).tap do |personalization| personalization.to = to end end |
.create_tracking_settings ⇒ Object
48 49 50 |
# File 'lib/sendgrid4r/factory/mail_factory.rb', line 48 def self.create_tracking_settings SendGrid4r::REST::Mail::TrackingSettings.new(nil, nil, nil, nil) end |