Class: Keplars::Resources::Emails
- Inherits:
-
Base
- Object
- Base
- Keplars::Resources::Emails
show all
- Defined in:
- lib/keplars/resources.rb
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#schedule(**args) ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/keplars/resources.rb', line 34
def schedule(**args)
body = args.dup
if body.key?(:scheduled_for) && !body.key?(:scheduled_at)
warn '[Keplars] Deprecated: :scheduled_for is deprecated since v2.7.0. Use :scheduled_at instead.'
body[:scheduled_at] = body.delete(:scheduled_for)
end
scheduled_at = body.delete(:scheduled_at)
timezone = body.delete(:timezone)
body.delete(:priority)
raise ArgumentError, 'scheduled_at is required for scheduling emails' unless scheduled_at
email_body = normalize_email_args(body).compact
payload = { scheduled_at: scheduled_at, email: email_body }
payload[:timezone] = timezone if timezone
@client.request('POST', '/api/v1/send-email/schedule', body: payload)[:data]
end
|
#send(**args) ⇒ Object
30
31
32
|
# File 'lib/keplars/resources.rb', line 30
def send(**args)
send_async(**args)
end
|
#send_async(**args) ⇒ Object
20
21
22
23
|
# File 'lib/keplars/resources.rb', line 20
def send_async(**args)
body = normalize_email_args(args)
@client.request('POST', '/api/v1/send-email/async', body: body)[:data]
end
|
#send_bulk(**args) ⇒ Object
25
26
27
28
|
# File 'lib/keplars/resources.rb', line 25
def send_bulk(**args)
body = normalize_email_args(args)
@client.request('POST', '/api/v1/send-email/bulk', body: body)[:data]
end
|
#send_high(**args) ⇒ Object
15
16
17
18
|
# File 'lib/keplars/resources.rb', line 15
def send_high(**args)
body = normalize_email_args(args)
@client.request('POST', '/api/v1/send-email/high', body: body)[:data]
end
|
#send_instant(**args) ⇒ Object
10
11
12
13
|
# File 'lib/keplars/resources.rb', line 10
def send_instant(**args)
body = normalize_email_args(args)
@client.request('POST', '/api/v1/send-email/instant', body: body)[:data]
end
|