resend 1.2.0 → 1.3.0.alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 13e9893105c9d1705651fc015dd4a5470a1435b4795b298f81c82a3eb2dc0d26
4
- data.tar.gz: ac95ef5612d8dee6416078acacd04901eac4928d8df6295de2abc86a286774db
3
+ metadata.gz: f24e34c0760ad761ed66a50704d45c0b9f18392a1b35d67140b2c675b06856ff
4
+ data.tar.gz: 7e92911d150c0978bf08b31d3eae728194d752ec68bc5aad8c5c24d3c41d1d89
5
5
  SHA512:
6
- metadata.gz: 6412b702e99234f46770677a8e878357d90eb31aaab04885f0e6d55c4291cfa427bba5aa6761f8fa63c13cec48d0a718c8629f81ea89a775bee62cf59b7aeaab
7
- data.tar.gz: 7f1b1583e3a775420b30e79a5db00525d85e55f112c69e71a340b3d724ec7628a7b15d18ea121bfec2e3cd070b04927d28223b05cb8c5da53fbbc65ec9b34b7e
6
+ metadata.gz: 4112b82ee2b08625a00a615b23856fc54496a248b76206d9a20851e35367053d2753441d64afbed174a30fe76f6fcd9210bbca4bd6398e5c863661ba2df0ba1b
7
+ data.tar.gz: 8c9413c58ba5008dcfbca990f0b1a043b3f7fbf6c24728f7829235bc6600fd121103b03e5ea2dd831604858fe868a3350726b55066c2d951369ec2d05a79f7fc
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Resend
4
+ module Automations
5
+ # Automation Runs api wrapper
6
+ module Runs
7
+ class << self
8
+ # https://resend.com/docs/api-reference/automations/list-automation-runs
9
+ def list(automation_id, params = {})
10
+ base_path = "automations/#{automation_id}/runs"
11
+ path = Resend::PaginationHelper.build_paginated_path(base_path, params)
12
+ Resend::Request.new(path, {}, "get").perform
13
+ end
14
+
15
+ # https://resend.com/docs/api-reference/automations/get-automation-run
16
+ def get(automation_id, run_id)
17
+ Resend::Request.new("automations/#{automation_id}/runs/#{run_id}", {}, "get").perform
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Resend
4
+ # automations api wrapper
5
+ module Automations
6
+ class << self
7
+ # https://resend.com/docs/api-reference/automations/create-automation
8
+ def create(params = {})
9
+ Resend::Request.new("automations", params, "post").perform
10
+ end
11
+
12
+ # https://resend.com/docs/api-reference/automations/get-automation
13
+ def get(automation_id = "")
14
+ Resend::Request.new("automations/#{automation_id}", {}, "get").perform
15
+ end
16
+
17
+ # https://resend.com/docs/api-reference/automations/update-automation
18
+ def update(params = {})
19
+ path = "automations/#{params[:automation_id]}"
20
+ payload = params.reject { |k, _| k == :automation_id }
21
+ Resend::Request.new(path, payload, "patch").perform
22
+ end
23
+
24
+ # https://resend.com/docs/api-reference/automations/delete-automation
25
+ def remove(automation_id = "")
26
+ Resend::Request.new("automations/#{automation_id}", {}, "delete").perform
27
+ end
28
+
29
+ # https://resend.com/docs/api-reference/automations/stop-automation
30
+ def stop(automation_id = "")
31
+ Resend::Request.new("automations/#{automation_id}/stop", {}, "post").perform
32
+ end
33
+
34
+ # https://resend.com/docs/api-reference/automations/list-automations
35
+ def list(params = {})
36
+ path = Resend::PaginationHelper.build_paginated_path("automations", params)
37
+ Resend::Request.new(path, {}, "get").perform
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Resend
4
+ # events api wrapper
5
+ module Events
6
+ class << self
7
+ # https://resend.com/docs/api-reference/events/create-event
8
+ def create(params = {})
9
+ Resend::Request.new("events", params, "post").perform
10
+ end
11
+
12
+ # https://resend.com/docs/api-reference/events/get-event
13
+ # identifier can be a UUID or an event name (e.g. "user.signed_up")
14
+ def get(identifier = "")
15
+ path = "events/#{CGI.escape(identifier.to_s)}"
16
+ Resend::Request.new(path, {}, "get").perform
17
+ end
18
+
19
+ # https://resend.com/docs/api-reference/events/update-event
20
+ def update(params = {})
21
+ identifier = params[:identifier]
22
+ path = "events/#{CGI.escape(identifier.to_s)}"
23
+ payload = params.reject { |k, _| k == :identifier }
24
+ Resend::Request.new(path, payload, "patch").perform
25
+ end
26
+
27
+ # https://resend.com/docs/api-reference/events/delete-event
28
+ # identifier can be a UUID or an event name (e.g. "user.signed_up")
29
+ def remove(identifier = "")
30
+ path = "events/#{CGI.escape(identifier.to_s)}"
31
+ Resend::Request.new(path, {}, "delete").perform
32
+ end
33
+
34
+ # https://resend.com/docs/api-reference/events/send-event
35
+ def send(params = {})
36
+ Resend::Request.new("events/send", params, "post").perform
37
+ end
38
+
39
+ # https://resend.com/docs/api-reference/events/list-events
40
+ def list(params = {})
41
+ path = Resend::PaginationHelper.build_paginated_path("events", params)
42
+ Resend::Request.new(path, {}, "get").perform
43
+ end
44
+ end
45
+ end
46
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Resend
4
- VERSION = "1.2.0"
4
+ VERSION = "1.3.0.alpha.1"
5
5
  end
data/lib/resend.rb CHANGED
@@ -31,6 +31,9 @@ require "resend/emails/receiving/attachments"
31
31
  require "resend/logs"
32
32
  require "resend/topics"
33
33
  require "resend/webhooks"
34
+ require "resend/automations"
35
+ require "resend/automations/runs"
36
+ require "resend/events"
34
37
 
35
38
  # Rails
36
39
  require "resend/railtie" if defined?(Rails) && defined?(ActionMailer)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resend
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derich Pacheco
@@ -46,6 +46,8 @@ files:
46
46
  - README.md
47
47
  - lib/resend.rb
48
48
  - lib/resend/api_keys.rb
49
+ - lib/resend/automations.rb
50
+ - lib/resend/automations/runs.rb
49
51
  - lib/resend/batch.rb
50
52
  - lib/resend/broadcasts.rb
51
53
  - lib/resend/client.rb
@@ -59,6 +61,7 @@ files:
59
61
  - lib/resend/emails/receiving.rb
60
62
  - lib/resend/emails/receiving/attachments.rb
61
63
  - lib/resend/errors.rb
64
+ - lib/resend/events.rb
62
65
  - lib/resend/logs.rb
63
66
  - lib/resend/mailer.rb
64
67
  - lib/resend/pagination_helper.rb