resend 0.17.2 → 0.18.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af2645da5d602105cd60b47747972b1fa8de2d24623a8b2632f3d218f91842ca
4
- data.tar.gz: 1b903aab1f8868d1b29611e71a02f4a081f0921690b8d5091f0463fb631a6b21
3
+ metadata.gz: 767d6913b962d3ed93b05c04675368f1890fd6275963fc58e865a008cad85e24
4
+ data.tar.gz: 1d4559ae1bb176f8cf3ace48133fd0c0a12a02dbf6f4bec356149c1f5f7a3dda
5
5
  SHA512:
6
- metadata.gz: dc0183b4adc0123f612f41df6dd71a0a9e8faebae93feb82beb4a6545a8b3866acc578078d70c49157397215e1c40d4dfc480f5639e2101ae600972aa2012024
7
- data.tar.gz: 669e1db9676210717c02f7508a7f0f67fbe225f2fec238827b53903ddb8117c7f6b41a92bc64681fb1c955ee128bcbc348233f703ca950507454f1df86858562
6
+ metadata.gz: df4ee127839e025a307c5d077a2de30149b0166d12329d5a0360eb4da4e7878e615b3cd6431456fa2a8fe81b2a4c88233ab029dacf9e0fff5a281c7814c2e07b
7
+ data.tar.gz: d0c046663acce27285dcd91220249154086ba4666310b0487cfe4ea97882632e8bfa0d5fcfcd7a36c2fb9b957b2c4ee4f70441d67d753fb1fe93cf7db9a9ce14
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "resend/request"
4
- require "resend/errors"
5
-
6
3
  module Resend
7
4
  # api keys api wrapper
8
5
  module ApiKeys
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "resend/request"
4
- require "resend/errors"
5
-
6
3
  module Resend
7
4
  # Audiences api wrapper
8
5
  module Audiences
data/lib/resend/batch.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "resend/request"
4
-
5
3
  module Resend
6
4
  # Module responsible for wrapping Batch email sending API
7
5
  module Batch
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "resend/request"
4
- require "resend/errors"
5
-
6
3
  module Resend
7
4
  # broadcasts api wrapper
8
5
  module Broadcasts
data/lib/resend/client.rb CHANGED
@@ -1,13 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "resend/audiences"
4
- require "resend/api_keys"
5
- require "resend/broadcasts"
6
- require "resend/batch"
7
- require "resend/contacts"
8
- require "resend/domains"
3
+ # backwards compatibility
9
4
  require "resend/emails"
10
- require "httparty"
11
5
 
12
6
  module Resend
13
7
  # Client class.
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "resend/request"
4
- require "resend/errors"
5
-
6
3
  module Resend
7
4
  # Contacts api wrapper
8
5
  module Contacts
@@ -19,6 +16,10 @@ module Resend
19
16
  Resend::Request.new(path, {}, "get").perform
20
17
  end
21
18
 
19
+ #
20
+ # List contacts in an audience
21
+ #
22
+ # @param audience_id [String] the audience id
22
23
  # https://resend.com/docs/api-reference/contacts/list-contacts
23
24
  def list(audience_id)
24
25
  path = "audiences/#{audience_id}/contacts"
@@ -37,9 +38,15 @@ module Resend
37
38
  Resend::Request.new(path, {}, "delete").perform
38
39
  end
39
40
 
41
+ #
42
+ # Update a contact
43
+ #
44
+ # @param params [Hash] the contact params
40
45
  # https://resend.com/docs/api-reference/contacts/update-contact
41
46
  def update(params)
42
- path = "audiences/#{params[:audience_id]}/contacts/#{params[:id]}"
47
+ raise ArgumentError, "id or email is required" if params[:id].nil? && params[:email].nil?
48
+
49
+ path = "audiences/#{params[:audience_id]}/contacts/#{params[:id] || params[:email]}"
43
50
  Resend::Request.new(path, params, "patch").perform
44
51
  end
45
52
  end
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "resend/request"
4
- require "resend/errors"
5
-
6
3
  module Resend
7
4
  # domains api wrapper
8
5
  module Domains
data/lib/resend/emails.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "resend/request"
4
-
5
3
  module Resend
6
4
  # Module responsible for wrapping email sending API
7
5
  module Emails
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "resend/version"
4
- require "resend/errors"
5
- require "httparty"
6
-
7
3
  module Resend
8
4
  # This class is responsible for making the appropriate HTTP calls
9
5
  # and raising the specific errors based on the response.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Resend
4
- VERSION = "0.17.2"
4
+ VERSION = "0.18.1"
5
5
  end
data/lib/resend.rb CHANGED
@@ -1,8 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Version
3
4
  require "resend/version"
5
+
6
+ # Utils
7
+ require "httparty"
8
+ require "json"
9
+ require "resend/errors"
4
10
  require "resend/client"
11
+ require "resend/request"
12
+
13
+ # API Operations
14
+ require "resend/audiences"
15
+ require "resend/api_keys"
16
+ require "resend/broadcasts"
17
+ require "resend/batch"
18
+ require "resend/contacts"
19
+ require "resend/domains"
20
+ require "resend/emails"
5
21
 
22
+ # Rails
6
23
  require "resend/railtie" if defined?(Rails) && defined?(ActionMailer)
7
24
 
8
25
  # Main Resend module
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.2
4
+ version: 0.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derich Pacheco
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-16 00:00:00.000000000 Z
11
+ date: 2025-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty