Module: SendGrid4r::REST::CancelScheduledSends
- Includes:
- Request
- Included in:
- API
- Defined in:
- lib/sendgrid4r/rest/cancel_scheduled_sends.rb
Overview
SendGrid Web API v3 CancelScheduledSends
Defined Under Namespace
Classes: ScheduledSend
Constant Summary
Constants included
from Request
Request::BASE_URL
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Request
#create_args, #delete, #execute, #finish, #get, #patch, #post, #process_array_params, #process_url_params, #put
Class Method Details
.batch_url(batch_id = nil) ⇒ Object
12
13
14
15
16
|
# File 'lib/sendgrid4r/rest/cancel_scheduled_sends.rb', line 12
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) ⇒ Object
31
32
33
34
|
# File 'lib/sendgrid4r/rest/cancel_scheduled_sends.rb', line 31
def self.create_scheduled_send(resp)
return resp if resp.nil?
ScheduledSend.new(resp['batch_id'], resp['status'])
end
|
.create_scheduled_sends(resp) ⇒ Object
24
25
26
27
28
29
|
# File 'lib/sendgrid4r/rest/cancel_scheduled_sends.rb', line 24
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) ⇒ Object
18
19
20
21
22
|
# File 'lib/sendgrid4r/rest/cancel_scheduled_sends.rb', line 18
def self.scheduled_sends_url(batch_id = nil)
url = "#{BASE_URL}/user/scheduled_sends"
url = "#{url}/#{batch_id}" unless batch_id.nil?
url
end
|
Instance Method Details
#delete_scheduled_send(batch_id:, &block) ⇒ Object
73
74
75
76
|
# File 'lib/sendgrid4r/rest/cancel_scheduled_sends.rb', line 73
def delete_scheduled_send(batch_id:, &block)
endpoint = CancelScheduledSends.scheduled_sends_url(batch_id)
delete(@auth, endpoint, nil, &block)
end
|
#generate_batch_id(&block) ⇒ Object
#get_scheduled_sends(batch_id: nil, &block) ⇒ Object
#patch_scheduled_send(batch_id:, status:, &block) ⇒ Object
67
68
69
70
71
|
# File 'lib/sendgrid4r/rest/cancel_scheduled_sends.rb', line 67
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) ⇒ Object
#validate_batch_id(batch_id:, &block) ⇒ Object