module SendGrid4r::REST::Sm::GlobalUnsubscribes
SendGrid Web API
v3 Suppression Management - Global Unsubscribes
Constants
- Unsubscribe
Public Class Methods
create_supressions(resp)
click to toggle source
# File lib/sendgrid4r/rest/sm/global_unsubscribes.rb, line 22 def self.create_supressions(resp) return resp if resp.nil? resp.map do |suppression| created = Time.at(suppression['created']) Unsubscribe.new(created, suppression['email']) end end
url(email_address = nil)
click to toggle source
# File lib/sendgrid4r/rest/sm/global_unsubscribes.rb, line 12 def self.url(email_address = nil) url = "#{BASE_URL}/asm/suppressions/global" url = "#{url}/#{email_address}" unless email_address.nil? url end
url_unsubscribes()
click to toggle source
# File lib/sendgrid4r/rest/sm/global_unsubscribes.rb, line 18 def self.url_unsubscribes "#{BASE_URL}/suppression/unsubscribes" end
Public Instance Methods
delete_global_suppressed_email(email_address:, &block)
click to toggle source
# File lib/sendgrid4r/rest/sm/global_unsubscribes.rb, line 57 def delete_global_suppressed_email(email_address:, &block) delete(@auth, Sm::GlobalUnsubscribes.url(email_address), &block) end
Also aliased as: delete_global_unsubscribe
get_global_suppressed_email(email_address:, &block)
click to toggle source
# File lib/sendgrid4r/rest/sm/global_unsubscribes.rb, line 52 def get_global_suppressed_email(email_address:, &block) resp = get(@auth, Sm::GlobalUnsubscribes.url(email_address), &block) finish(resp, @raw_resp) { |r| Sm.create_recipient_email(r) } end
Also aliased as: get_global_unsubscribe
get_global_unsubscribes( start_time: nil, end_time: nil, limit: nil, offset: nil, &block )
click to toggle source
# File lib/sendgrid4r/rest/sm/global_unsubscribes.rb, line 30 def get_global_unsubscribes( start_time: nil, end_time: nil, limit: nil, offset: nil, &block ) params = {} params[:start_time] = start_time.to_i unless start_time.nil? params[:end_time] = end_time.to_i unless end_time.nil? params[:limit] = limit.to_i unless limit.nil? params[:offset] = offset.to_i unless offset.nil? endpoint = Sm::GlobalUnsubscribes.url_unsubscribes resp = get(@auth, endpoint, params, &block) finish(resp, @raw_resp) do |r| Sm::GlobalUnsubscribes.create_supressions(r) end end
post_global_suppressed_emails(recipient_emails:, &block)
click to toggle source
# File lib/sendgrid4r/rest/sm/global_unsubscribes.rb, line 45 def post_global_suppressed_emails(recipient_emails:, &block) params = { recipient_emails: recipient_emails } endpoint = Sm::GlobalUnsubscribes.url resp = post(@auth, endpoint, params, &block) finish(resp, @raw_resp) { |r| Sm.create_recipient_emails(r) } end
Also aliased as: post_global_unsubscribes