trycourier 6.13.0 → 7.0.0

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: adeed3b02658fe1c360d234bbd24ce3c2c3dcd34637b766514178b3ea473cbb5
4
- data.tar.gz: dfc4345ec2d9db5bbd66bca95fae14eb11fb5a8a19d8afa7b7493a0325786583
3
+ metadata.gz: b9d4b4d9f0e21df74b5356c321cf2971644a8958e3c342508f8e7f578ce30735
4
+ data.tar.gz: bb6ec33f377d16e6a10207ef9e34795e14fe6de3211228717cb49e315f653a39
5
5
  SHA512:
6
- metadata.gz: 0e7711edd3bc7c6b0602ed7e8545cadadf2c10727de043474aec07e7ad121b1bfe324ac8d8c11efa77a15082a600c3ac26725146198359876a16b49178979b5d
7
- data.tar.gz: 9cf63697464b8a65544002c1c50552c6a8c835012fad7cecd94373f5fbba7233361fde3bf16f41c4919409f6f5892092d12ea45f5d369bae960d0afc5ce017a1
6
+ metadata.gz: bb567ddaa62750f34f3d813b0da206ad46689dfeebad205849409d09435470ed4252a3244a36e1d8c09e336cdc571ba356f3048fa6475d7b74b86fbedfba8936
7
+ data.tar.gz: '09c56af2f9959df9cf30a0683b1f766339b381ab415b6c4273d49405a712d6e42ebeaa730f3cf1d83c4cd8342e757db3b95b0ccbcb7fd3892aa3e6b5ef2b1ca4'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [7.0.0](https://github.com/trycourier/courier-ruby/compare/v6.13.0...v7.0.0) (2026-10-29)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * **api:** PATCH /providers/{id} takes JSON Patch operations [C-22022] ([#182](https://github.com/trycourier/courier-ruby/issues/182))
9
+
10
+ ### Features
11
+
12
+ * **api:** PATCH /providers/{id} takes JSON Patch operations [C-22022] ([#182](https://github.com/trycourier/courier-ruby/issues/182)) ([1f14f3f](https://github.com/trycourier/courier-ruby/commit/1f14f3f8011a1a237fdd067a77e64f0499530685))
13
+
3
14
  ## [6.13.0](https://github.com/trycourier/courier-ruby/compare/v6.12.0...v6.13.0) (2026-10-23)
4
15
 
5
16
 
data/README.md CHANGED
@@ -9,7 +9,7 @@ Add the gem to your `Gemfile`:
9
9
  <!-- x-release-please-start-version -->
10
10
 
11
11
  ```ruby
12
- gem "trycourier", "~> 6.13.0"
12
+ gem "trycourier", "~> 7.0.0"
13
13
  ```
14
14
 
15
15
  <!-- x-release-please-end -->
@@ -12,50 +12,80 @@ module Courier
12
12
  # @return [String]
13
13
  required :id, String
14
14
 
15
- # @!attribute alias_
16
- # Updated alias. Set to null to clear it.
15
+ # @!attribute patch
16
+ # Operations to apply, in order. Paths address the provider as it is returned:
17
+ # `/title`, `/alias`, `/provider`, and `/settings/<key>` with the snake_case
18
+ # setting keys, including nested paths such as `/settings/rate_limit/rate`. If any
19
+ # operation fails, for example a `test`, nothing is saved and the request returns
20
+ # a 400. The result can't change `provider`, remove `title`, or add other
21
+ # top-level fields. Removing `/alias` clears it.
17
22
  #
18
- # @return [String, nil]
19
- optional :alias_, String, api_name: :alias, nil?: true
23
+ # @return [Array<Courier::Models::ProviderPatchParams::Patch>]
24
+ required :patch, -> { Courier::Internal::Type::ArrayOf[Courier::ProviderPatchParams::Patch] }
20
25
 
21
- # @!attribute provider
22
- # The provider key identifying the type. Optional. When sent, it must match the
23
- # stored provider, otherwise the request returns a 400.
24
- #
25
- # @return [String, nil]
26
- optional :provider, String
27
-
28
- # @!attribute settings
29
- # Provider-specific settings (snake_case keys) to merge into the stored settings,
30
- # using JSON Merge Patch (RFC 7396). Each key you send replaces the stored value,
31
- # a key set to null is removed, nested objects merge recursively, and arrays
32
- # replace the stored value. Keys you omit keep their stored values. Set
33
- # `rate_limit` to null to remove this configuration's send rate limit.
34
- #
35
- # @return [Hash{Symbol=>Object}, nil]
36
- optional :settings, Courier::Internal::Type::HashOf[Courier::Internal::Type::Unknown]
37
-
38
- # @!attribute title
39
- # Updated display title.
40
- #
41
- # @return [String, nil]
42
- optional :title, String
43
-
44
- # @!method initialize(id:, alias_: nil, provider: nil, settings: nil, title: nil, request_options: {})
26
+ # @!method initialize(id:, patch:, request_options: {})
45
27
  # Some parameter documentations has been truncated, see
46
28
  # {Courier::Models::ProviderPatchParams} for more details.
47
29
  #
48
30
  # @param id [String]
49
31
  #
50
- # @param alias_ [String, nil] Updated alias. Set to null to clear it.
51
- #
52
- # @param provider [String] The provider key identifying the type. Optional. When sent, it must match the st
53
- #
54
- # @param settings [Hash{Symbol=>Object}] Provider-specific settings (snake_case keys) to merge into the stored settings,
55
- #
56
- # @param title [String] Updated display title.
32
+ # @param patch [Array<Courier::Models::ProviderPatchParams::Patch>] Operations to apply, in order. Paths address the provider as it is returned: `/t
57
33
  #
58
34
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]
35
+
36
+ class Patch < Courier::Internal::Type::BaseModel
37
+ # @!attribute op
38
+ # The operation to perform.
39
+ #
40
+ # @return [Symbol, Courier::Models::ProviderPatchParams::Patch::Op]
41
+ required :op, enum: -> { Courier::ProviderPatchParams::Patch::Op }
42
+
43
+ # @!attribute path
44
+ # JSON Pointer to the field to operate on, such as `/settings/api_key`.
45
+ #
46
+ # @return [String]
47
+ required :path, String
48
+
49
+ # @!attribute from
50
+ # JSON Pointer to the source field for `move` and `copy`.
51
+ #
52
+ # @return [String, nil]
53
+ optional :from, String
54
+
55
+ # @!attribute value
56
+ # The value for `add`, `replace` and `test`. Any JSON value.
57
+ #
58
+ # @return [Object, nil]
59
+ optional :value, Courier::Internal::Type::Unknown
60
+
61
+ # @!method initialize(op:, path:, from: nil, value: nil)
62
+ # One JSON Patch (RFC 6902) operation.
63
+ #
64
+ # @param op [Symbol, Courier::Models::ProviderPatchParams::Patch::Op] The operation to perform.
65
+ #
66
+ # @param path [String] JSON Pointer to the field to operate on, such as `/settings/api_key`.
67
+ #
68
+ # @param from [String] JSON Pointer to the source field for `move` and `copy`.
69
+ #
70
+ # @param value [Object] The value for `add`, `replace` and `test`. Any JSON value.
71
+
72
+ # The operation to perform.
73
+ #
74
+ # @see Courier::Models::ProviderPatchParams::Patch#op
75
+ module Op
76
+ extend Courier::Internal::Type::Enum
77
+
78
+ ADD = :add
79
+ REMOVE = :remove
80
+ REPLACE = :replace
81
+ MOVE = :move
82
+ COPY = :copy
83
+ TEST = :test
84
+
85
+ # @!method self.values
86
+ # @return [Array<Symbol>]
87
+ end
88
+ end
59
89
  end
60
90
  end
61
91
  end
@@ -152,28 +152,23 @@ module Courier
152
152
  # Some parameter documentations has been truncated, see
153
153
  # {Courier::Models::ProviderPatchParams} for more details.
154
154
  #
155
- # Updates part of a provider's configuration and keeps every field you omit.
156
- # Settings merge into the stored settings key by key, and a setting sent as null
157
- # is removed.
155
+ # Applies JSON Patch (RFC 6902) operations to a provider configuration and keeps
156
+ # every field the operations don't touch. Paths address the provider as it is
157
+ # returned: /title, /alias and /settings/<key>. The operations apply in order, and
158
+ # if one fails, nothing is saved.
158
159
  #
159
- # @overload patch(id, alias_: nil, provider: nil, settings: nil, title: nil, request_options: {})
160
+ # @overload patch(id, patch:, request_options: {})
160
161
  #
161
162
  # @param id [String] A unique identifier of the provider configuration to update.
162
163
  #
163
- # @param alias_ [String, nil] Updated alias. Set to null to clear it.
164
- #
165
- # @param provider [String] The provider key identifying the type. Optional. When sent, it must match the st
166
- #
167
- # @param settings [Hash{Symbol=>Object}] Provider-specific settings (snake_case keys) to merge into the stored settings,
168
- #
169
- # @param title [String] Updated display title.
164
+ # @param patch [Array<Courier::Models::ProviderPatchParams::Patch>] Operations to apply, in order. Paths address the provider as it is returned: `/t
170
165
  #
171
166
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
172
167
  #
173
168
  # @return [Courier::Models::Provider]
174
169
  #
175
170
  # @see Courier::Models::ProviderPatchParams
176
- def patch(id, params = {})
171
+ def patch(id, params)
177
172
  parsed, options = Courier::ProviderPatchParams.dump_request(params)
178
173
  @client.request(
179
174
  method: :patch,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Courier
4
- VERSION = "6.13.0"
4
+ VERSION = "7.0.0"
5
5
  end
@@ -14,61 +14,31 @@ module Courier
14
14
  sig { returns(String) }
15
15
  attr_accessor :id
16
16
 
17
- # Updated alias. Set to null to clear it.
18
- sig { returns(T.nilable(String)) }
19
- attr_accessor :alias_
20
-
21
- # The provider key identifying the type. Optional. When sent, it must match the
22
- # stored provider, otherwise the request returns a 400.
23
- sig { returns(T.nilable(String)) }
24
- attr_reader :provider
25
-
26
- sig { params(provider: String).void }
27
- attr_writer :provider
28
-
29
- # Provider-specific settings (snake_case keys) to merge into the stored settings,
30
- # using JSON Merge Patch (RFC 7396). Each key you send replaces the stored value,
31
- # a key set to null is removed, nested objects merge recursively, and arrays
32
- # replace the stored value. Keys you omit keep their stored values. Set
33
- # `rate_limit` to null to remove this configuration's send rate limit.
34
- sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
35
- attr_reader :settings
36
-
37
- sig { params(settings: T::Hash[Symbol, T.anything]).void }
38
- attr_writer :settings
39
-
40
- # Updated display title.
41
- sig { returns(T.nilable(String)) }
42
- attr_reader :title
43
-
44
- sig { params(title: String).void }
45
- attr_writer :title
17
+ # Operations to apply, in order. Paths address the provider as it is returned:
18
+ # `/title`, `/alias`, `/provider`, and `/settings/<key>` with the snake_case
19
+ # setting keys, including nested paths such as `/settings/rate_limit/rate`. If any
20
+ # operation fails, for example a `test`, nothing is saved and the request returns
21
+ # a 400. The result can't change `provider`, remove `title`, or add other
22
+ # top-level fields. Removing `/alias` clears it.
23
+ sig { returns(T::Array[Courier::ProviderPatchParams::Patch]) }
24
+ attr_accessor :patch
46
25
 
47
26
  sig do
48
27
  params(
49
28
  id: String,
50
- alias_: T.nilable(String),
51
- provider: String,
52
- settings: T::Hash[Symbol, T.anything],
53
- title: String,
29
+ patch: T::Array[Courier::ProviderPatchParams::Patch::OrHash],
54
30
  request_options: Courier::RequestOptions::OrHash
55
31
  ).returns(T.attached_class)
56
32
  end
57
33
  def self.new(
58
34
  id:,
59
- # Updated alias. Set to null to clear it.
60
- alias_: nil,
61
- # The provider key identifying the type. Optional. When sent, it must match the
62
- # stored provider, otherwise the request returns a 400.
63
- provider: nil,
64
- # Provider-specific settings (snake_case keys) to merge into the stored settings,
65
- # using JSON Merge Patch (RFC 7396). Each key you send replaces the stored value,
66
- # a key set to null is removed, nested objects merge recursively, and arrays
67
- # replace the stored value. Keys you omit keep their stored values. Set
68
- # `rate_limit` to null to remove this configuration's send rate limit.
69
- settings: nil,
70
- # Updated display title.
71
- title: nil,
35
+ # Operations to apply, in order. Paths address the provider as it is returned:
36
+ # `/title`, `/alias`, `/provider`, and `/settings/<key>` with the snake_case
37
+ # setting keys, including nested paths such as `/settings/rate_limit/rate`. If any
38
+ # operation fails, for example a `test`, nothing is saved and the request returns
39
+ # a 400. The result can't change `provider`, remove `title`, or add other
40
+ # top-level fields. Removing `/alias` clears it.
41
+ patch:,
72
42
  request_options: {}
73
43
  )
74
44
  end
@@ -77,16 +47,117 @@ module Courier
77
47
  override.returns(
78
48
  {
79
49
  id: String,
80
- alias_: T.nilable(String),
81
- provider: String,
82
- settings: T::Hash[Symbol, T.anything],
83
- title: String,
50
+ patch: T::Array[Courier::ProviderPatchParams::Patch],
84
51
  request_options: Courier::RequestOptions
85
52
  }
86
53
  )
87
54
  end
88
55
  def to_hash
89
56
  end
57
+
58
+ class Patch < Courier::Internal::Type::BaseModel
59
+ OrHash =
60
+ T.type_alias do
61
+ T.any(
62
+ Courier::ProviderPatchParams::Patch,
63
+ Courier::Internal::AnyHash
64
+ )
65
+ end
66
+
67
+ # The operation to perform.
68
+ sig { returns(Courier::ProviderPatchParams::Patch::Op::OrSymbol) }
69
+ attr_accessor :op
70
+
71
+ # JSON Pointer to the field to operate on, such as `/settings/api_key`.
72
+ sig { returns(String) }
73
+ attr_accessor :path
74
+
75
+ # JSON Pointer to the source field for `move` and `copy`.
76
+ sig { returns(T.nilable(String)) }
77
+ attr_reader :from
78
+
79
+ sig { params(from: String).void }
80
+ attr_writer :from
81
+
82
+ # The value for `add`, `replace` and `test`. Any JSON value.
83
+ sig { returns(T.nilable(T.anything)) }
84
+ attr_reader :value
85
+
86
+ sig { params(value: T.anything).void }
87
+ attr_writer :value
88
+
89
+ # One JSON Patch (RFC 6902) operation.
90
+ sig do
91
+ params(
92
+ op: Courier::ProviderPatchParams::Patch::Op::OrSymbol,
93
+ path: String,
94
+ from: String,
95
+ value: T.anything
96
+ ).returns(T.attached_class)
97
+ end
98
+ def self.new(
99
+ # The operation to perform.
100
+ op:,
101
+ # JSON Pointer to the field to operate on, such as `/settings/api_key`.
102
+ path:,
103
+ # JSON Pointer to the source field for `move` and `copy`.
104
+ from: nil,
105
+ # The value for `add`, `replace` and `test`. Any JSON value.
106
+ value: nil
107
+ )
108
+ end
109
+
110
+ sig do
111
+ override.returns(
112
+ {
113
+ op: Courier::ProviderPatchParams::Patch::Op::OrSymbol,
114
+ path: String,
115
+ from: String,
116
+ value: T.anything
117
+ }
118
+ )
119
+ end
120
+ def to_hash
121
+ end
122
+
123
+ # The operation to perform.
124
+ module Op
125
+ extend Courier::Internal::Type::Enum
126
+
127
+ TaggedSymbol =
128
+ T.type_alias do
129
+ T.all(Symbol, Courier::ProviderPatchParams::Patch::Op)
130
+ end
131
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
132
+
133
+ ADD =
134
+ T.let(:add, Courier::ProviderPatchParams::Patch::Op::TaggedSymbol)
135
+ REMOVE =
136
+ T.let(
137
+ :remove,
138
+ Courier::ProviderPatchParams::Patch::Op::TaggedSymbol
139
+ )
140
+ REPLACE =
141
+ T.let(
142
+ :replace,
143
+ Courier::ProviderPatchParams::Patch::Op::TaggedSymbol
144
+ )
145
+ MOVE =
146
+ T.let(:move, Courier::ProviderPatchParams::Patch::Op::TaggedSymbol)
147
+ COPY =
148
+ T.let(:copy, Courier::ProviderPatchParams::Patch::Op::TaggedSymbol)
149
+ TEST =
150
+ T.let(:test, Courier::ProviderPatchParams::Patch::Op::TaggedSymbol)
151
+
152
+ sig do
153
+ override.returns(
154
+ T::Array[Courier::ProviderPatchParams::Patch::Op::TaggedSymbol]
155
+ )
156
+ end
157
+ def self.values
158
+ end
159
+ end
160
+ end
90
161
  end
91
162
  end
92
163
  end
@@ -145,35 +145,27 @@ module Courier
145
145
  )
146
146
  end
147
147
 
148
- # Updates part of a provider's configuration and keeps every field you omit.
149
- # Settings merge into the stored settings key by key, and a setting sent as null
150
- # is removed.
148
+ # Applies JSON Patch (RFC 6902) operations to a provider configuration and keeps
149
+ # every field the operations don't touch. Paths address the provider as it is
150
+ # returned: /title, /alias and /settings/<key>. The operations apply in order, and
151
+ # if one fails, nothing is saved.
151
152
  sig do
152
153
  params(
153
154
  id: String,
154
- alias_: T.nilable(String),
155
- provider: String,
156
- settings: T::Hash[Symbol, T.anything],
157
- title: String,
155
+ patch: T::Array[Courier::ProviderPatchParams::Patch::OrHash],
158
156
  request_options: Courier::RequestOptions::OrHash
159
157
  ).returns(Courier::Provider)
160
158
  end
161
159
  def patch(
162
160
  # A unique identifier of the provider configuration to update.
163
161
  id,
164
- # Updated alias. Set to null to clear it.
165
- alias_: nil,
166
- # The provider key identifying the type. Optional. When sent, it must match the
167
- # stored provider, otherwise the request returns a 400.
168
- provider: nil,
169
- # Provider-specific settings (snake_case keys) to merge into the stored settings,
170
- # using JSON Merge Patch (RFC 7396). Each key you send replaces the stored value,
171
- # a key set to null is removed, nested objects merge recursively, and arrays
172
- # replace the stored value. Keys you omit keep their stored values. Set
173
- # `rate_limit` to null to remove this configuration's send rate limit.
174
- settings: nil,
175
- # Updated display title.
176
- title: nil,
162
+ # Operations to apply, in order. Paths address the provider as it is returned:
163
+ # `/title`, `/alias`, `/provider`, and `/settings/<key>` with the snake_case
164
+ # setting keys, including nested paths such as `/settings/rate_limit/rate`. If any
165
+ # operation fails, for example a `test`, nothing is saved and the request returns
166
+ # a 400. The result can't change `provider`, remove `title`, or add other
167
+ # top-level fields. Removing `/alias` clears it.
168
+ patch:,
177
169
  request_options: {}
178
170
  )
179
171
  end
@@ -1,13 +1,7 @@
1
1
  module Courier
2
2
  module Models
3
3
  type provider_patch_params =
4
- {
5
- id: String,
6
- alias_: String?,
7
- provider: String,
8
- settings: ::Hash[Symbol, top],
9
- title: String
10
- }
4
+ { id: String, patch: ::Array[Courier::ProviderPatchParams::Patch] }
11
5
  & Courier::Internal::Type::request_parameters
12
6
 
13
7
  class ProviderPatchParams < Courier::Internal::Type::BaseModel
@@ -16,37 +10,70 @@ module Courier
16
10
 
17
11
  attr_accessor id: String
18
12
 
19
- attr_accessor alias_: String?
20
-
21
- attr_reader provider: String?
22
-
23
- def provider=: (String) -> String
24
-
25
- attr_reader settings: ::Hash[Symbol, top]?
26
-
27
- def settings=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top]
28
-
29
- attr_reader title: String?
30
-
31
- def title=: (String) -> String
13
+ attr_accessor patch: ::Array[Courier::ProviderPatchParams::Patch]
32
14
 
33
15
  def initialize: (
34
16
  id: String,
35
- ?alias_: String?,
36
- ?provider: String,
37
- ?settings: ::Hash[Symbol, top],
38
- ?title: String,
17
+ patch: ::Array[Courier::ProviderPatchParams::Patch],
39
18
  ?request_options: Courier::request_opts
40
19
  ) -> void
41
20
 
42
21
  def to_hash: -> {
43
22
  id: String,
44
- alias_: String?,
45
- provider: String,
46
- settings: ::Hash[Symbol, top],
47
- title: String,
23
+ patch: ::Array[Courier::ProviderPatchParams::Patch],
48
24
  request_options: Courier::RequestOptions
49
25
  }
26
+
27
+ type patch =
28
+ {
29
+ op: Courier::Models::ProviderPatchParams::Patch::op,
30
+ path: String,
31
+ from: String,
32
+ value: top
33
+ }
34
+
35
+ class Patch < Courier::Internal::Type::BaseModel
36
+ attr_accessor op: Courier::Models::ProviderPatchParams::Patch::op
37
+
38
+ attr_accessor path: String
39
+
40
+ attr_reader from: String?
41
+
42
+ def from=: (String) -> String
43
+
44
+ attr_reader value: top?
45
+
46
+ def value=: (top) -> top
47
+
48
+ def initialize: (
49
+ op: Courier::Models::ProviderPatchParams::Patch::op,
50
+ path: String,
51
+ ?from: String,
52
+ ?value: top
53
+ ) -> void
54
+
55
+ def to_hash: -> {
56
+ op: Courier::Models::ProviderPatchParams::Patch::op,
57
+ path: String,
58
+ from: String,
59
+ value: top
60
+ }
61
+
62
+ type op = :add | :remove | :replace | :move | :copy | :test
63
+
64
+ module Op
65
+ extend Courier::Internal::Type::Enum
66
+
67
+ ADD: :add
68
+ REMOVE: :remove
69
+ REPLACE: :replace
70
+ MOVE: :move
71
+ COPY: :copy
72
+ TEST: :test
73
+
74
+ def self?.values: -> ::Array[Courier::Models::ProviderPatchParams::Patch::op]
75
+ end
76
+ end
50
77
  end
51
78
  end
52
79
  end
@@ -36,10 +36,7 @@ module Courier
36
36
 
37
37
  def patch: (
38
38
  String id,
39
- ?alias_: String?,
40
- ?provider: String,
41
- ?settings: ::Hash[Symbol, top],
42
- ?title: String,
39
+ patch: ::Array[Courier::ProviderPatchParams::Patch],
43
40
  ?request_options: Courier::request_opts
44
41
  ) -> Courier::Provider
45
42
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trycourier
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.13.0
4
+ version: 7.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Courier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-23 00:00:00.000000000 Z
11
+ date: 2026-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool