module SendGrid4r::REST::CancelScheduledSends
SendGrid Web API
v3 CancelScheduledSends
Constants
- ScheduledSend
Public Class Methods
batch_url(batch_id = nil)
click to toggle source
# File lib/sendgrid4r/rest/cancel_scheduled_sends.rb, line 11 def self.batch_url(batch_id = nil) url = "#{BASE_URL}/mail/batch" url = "#{url}/#{batch_id}" unless batch_id.nil? url end
create_scheduled_send(resp)
click to toggle source
# File lib/sendgrid4r/rest/cancel_scheduled_sends.rb, line 30 def self.create_scheduled_send(resp) return resp if resp.nil? ScheduledSend.new(resp['batch_id'], resp['status']) end
create_scheduled_sends(resp)
click to toggle source
# File lib/sendgrid4r/rest/cancel_scheduled_sends.rb, line 23 def self.create_scheduled_sends(resp) return resp if resp.nil? resp.map do |scheduled_send| CancelScheduledSends.create_scheduled_send(scheduled_send) end end
scheduled_sends_url(batch_id = nil)
click to toggle source
# File lib/sendgrid4r/rest/cancel_scheduled_sends.rb, line 17 def self.scheduled_sends_url(batch_id = nil) url = "#{BASE_URL}/user/scheduled_sends" url = "#{url}/#{batch_id}" unless batch_id.nil? url end
Public Instance Methods
delete_scheduled_send(batch_id:, &block)
click to toggle source
# File lib/sendgrid4r/rest/cancel_scheduled_sends.rb, line 72 def delete_scheduled_send(batch_id:, &block) endpoint = CancelScheduledSends.scheduled_sends_url(batch_id) delete(@auth, endpoint, nil, &block) end
generate_batch_id(&block)
click to toggle source
# File lib/sendgrid4r/rest/cancel_scheduled_sends.rb, line 35 def generate_batch_id(&block) resp = post(@auth, CancelScheduledSends.batch_url, nil, &block) finish(resp, @raw_resp) do |r| CancelScheduledSends.create_scheduled_send(r) end end
get_scheduled_sends(batch_id: nil, &block)
click to toggle source
# File lib/sendgrid4r/rest/cancel_scheduled_sends.rb, line 58 def get_scheduled_sends(batch_id: nil, &block) endpoint = CancelScheduledSends.scheduled_sends_url(batch_id) resp = get(@auth, endpoint, nil, nil, &block) finish(resp, @raw_resp) do |r| CancelScheduledSends.create_scheduled_sends(r) end end
patch_scheduled_send(batch_id:, status:, &block)
click to toggle source
# File lib/sendgrid4r/rest/cancel_scheduled_sends.rb, line 66 def patch_scheduled_send(batch_id:, status:, &block) endpoint = CancelScheduledSends.scheduled_sends_url(batch_id) payload = { status: status } patch(@auth, endpoint, payload, &block) end
post_scheduled_send(batch_id:, status:, &block)
click to toggle source
# File lib/sendgrid4r/rest/cancel_scheduled_sends.rb, line 49 def post_scheduled_send(batch_id:, status:, &block) endpoint = CancelScheduledSends.scheduled_sends_url payload = { batch_id: batch_id, status: status } resp = post(@auth, endpoint, payload, &block) finish(resp, @raw_resp) do |r| CancelScheduledSends.create_scheduled_send(r) end end
validate_batch_id(batch_id:, &block)
click to toggle source
# File lib/sendgrid4r/rest/cancel_scheduled_sends.rb, line 42 def validate_batch_id(batch_id:, &block) resp = get(@auth, CancelScheduledSends.batch_url(batch_id), nil, &block) finish(resp, @raw_resp) do |r| CancelScheduledSends.create_scheduled_send(r) end end