module SendGrid4r::REST::Settings::Mail

SendGrid Web API v3 Settings - Mail

Constants

AddressWhitelist
Bcc
BouncePurge
ForwardBounce
ForwardSpam
PlainContent
SpamCheck
Template

Public Class Methods

create_address_whitelist(resp) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 12
def self.create_address_whitelist(resp)
  return resp if resp.nil?
  AddressWhitelist.new(resp['enabled'], resp['list'])
end
create_bcc(resp) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 19
def self.create_bcc(resp)
  return resp if resp.nil?
  Bcc.new(resp['enabled'], resp['email'])
end
create_bounce_purge(resp) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 26
def self.create_bounce_purge(resp)
  return resp if resp.nil?
  BouncePurge.new(
    resp['enabled'], resp['hard_bounces'], resp['soft_bounces']
  )
end
create_forward_bounce(resp) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 44
def self.create_forward_bounce(resp)
  return resp if resp.nil?
  ForwardBounce.new(resp['enabled'], resp['email'])
end
create_forward_spam(resp) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 51
def self.create_forward_spam(resp)
  return resp if resp.nil?
  ForwardSpam.new(resp['enabled'], resp['email'])
end
create_plain_content(resp) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 72
def self.create_plain_content(resp)
  return resp if resp.nil?
  PlainContent.new(resp['enabled'])
end
create_spam_check(resp) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 58
def self.create_spam_check(resp)
  return resp if resp.nil?
  SpamCheck.new(resp['enabled'], resp['url'], resp['max_score'])
end
create_template(resp) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 65
def self.create_template(resp)
  return resp if resp.nil?
  Template.new(resp['enabled'], resp['html_content'])
end
url(name = nil) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 77
def self.url(name = nil)
  url = "#{BASE_URL}/mail_settings"
  url = "#{url}/#{name}" unless name.nil?
  url
end

Public Instance Methods

get_mail_settings(limit: nil, offset: nil, &block) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 83
def get_mail_settings(limit: nil, offset: nil, &block)
  params = {}
  params[:limit] = limit unless limit.nil?
  params[:offset] = offset unless offset.nil?
  resp = get(@auth, Settings::Mail.url, params, &block)
  finish(resp, @raw_resp) { |r| Settings.create_results(r) }
end
get_settings_address_whitelist(&block) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 91
def get_settings_address_whitelist(&block)
  resp = get(@auth, Settings::Mail.url(:address_whitelist), &block)
  finish(resp, @raw_resp) do |r|
    Settings::Mail.create_address_whitelist(r)
  end
end
get_settings_bcc(&block) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 106
def get_settings_bcc(&block)
  resp = get(@auth, Settings::Mail.url(:bcc), &block)
  finish(resp, @raw_resp) do |r|
    Settings::Mail.create_bcc(r)
  end
end
get_settings_bounce_purge(&block) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 121
def get_settings_bounce_purge(&block)
  resp = get(@auth, Settings::Mail.url(:bounce_purge), &block)
  finish(resp, @raw_resp) do |r|
    Settings::Mail.create_bounce_purge(r)
  end
end
get_settings_forward_bounce(&block) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 150
def get_settings_forward_bounce(&block)
  resp = get(@auth, Settings::Mail.url(:forward_bounce), &block)
  finish(resp, @raw_resp) do |r|
    Settings::Mail.create_forward_bounce(r)
  end
end
get_settings_forward_spam(&block) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 165
def get_settings_forward_spam(&block)
  resp = get(@auth, Settings::Mail.url(:forward_spam), &block)
  finish(resp, @raw_resp) do |r|
    Settings::Mail.create_forward_spam(r)
  end
end
get_settings_plain_content(&block) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 210
def get_settings_plain_content(&block)
  resp = get(@auth, Settings::Mail.url(:plain_content), &block)
  finish(resp, @raw_resp) do |r|
    Settings::Mail.create_plain_content(r)
  end
end
get_settings_spam_check(&block) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 180
def get_settings_spam_check(&block)
  resp = get(@auth, Settings::Mail.url(:spam_check), &block)
  finish(resp, @raw_resp) do |r|
    Settings::Mail.create_spam_check(r)
  end
end
get_settings_template(&block) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 195
def get_settings_template(&block)
  resp = get(@auth, Settings::Mail.url(:template), &block)
  finish(resp, @raw_resp) do |r|
    Settings::Mail.create_template(r)
  end
end
patch_settings_address_whitelist(params:, &block) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 98
def patch_settings_address_whitelist(params:, &block)
  endpoint = Settings::Mail.url(:address_whitelist)
  resp = patch(@auth, endpoint, params.to_h, &block)
  finish(resp, @raw_resp) do |r|
    Settings::Mail.create_address_whitelist(r)
  end
end
patch_settings_bcc(params:, &block) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 113
def patch_settings_bcc(params:, &block)
  endpoint = Settings::Mail.url(:bcc)
  resp = patch(@auth, endpoint, params.to_h, &block)
  finish(resp, @raw_resp) do |r|
    Settings::Mail.create_bcc(r)
  end
end
patch_settings_bounce_purge(params:, &block) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 128
def patch_settings_bounce_purge(params:, &block)
  endpoint = Settings::Mail.url(:bounce_purge)
  resp = patch(@auth, endpoint, params.to_h, &block)
  finish(resp, @raw_resp) do |r|
    Settings::Mail.create_bounce_purge(r)
  end
end
patch_settings_forward_bounce(params:, &block) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 157
def patch_settings_forward_bounce(params:, &block)
  endpoint = Settings::Mail.url(:forward_bounce)
  resp = patch(@auth, endpoint, params.to_h, &block)
  finish(resp, @raw_resp) do |r|
    Settings::Mail.create_forward_bounce(r)
  end
end
patch_settings_forward_spam(params:, &block) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 172
def patch_settings_forward_spam(params:, &block)
  endpoint = Settings::Mail.url(:forward_spam)
  resp = patch(@auth, endpoint, params.to_h, &block)
  finish(resp, @raw_resp) do |r|
    Settings::Mail.create_forward_spam(r)
  end
end
patch_settings_plain_content(params:, &block) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 217
def patch_settings_plain_content(params:, &block)
  endpoint = Settings::Mail.url(:plain_content)
  resp = patch(@auth, endpoint, params.to_h, &block)
  finish(resp, @raw_resp) do |r|
    Settings::Mail.create_plain_content(r)
  end
end
patch_settings_spam_check(params:, &block) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 187
def patch_settings_spam_check(params:, &block)
  endpoint = Settings::Mail.url(:spam_check)
  resp = patch(@auth, endpoint, params.to_h, &block)
  finish(resp, @raw_resp) do |r|
    Settings::Mail.create_spam_check(r)
  end
end
patch_settings_template(params:, &block) click to toggle source
# File lib/sendgrid4r/rest/settings/mail.rb, line 202
def patch_settings_template(params:, &block)
  endpoint = Settings::Mail.url(:template)
  resp = patch(@auth, endpoint, params.to_h, &block)
  finish(resp, @raw_resp) do |r|
    Settings::Mail.create_template(r)
  end
end