trycourier 3.4.0.pre.alpha7 → 3.4.0.pre.alpha8

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: 5fa5020a219e691d41a4ff4c23818a3bc0ae64841f594d0e4645b8c32455bfdd
4
- data.tar.gz: '06091225ad3b4a3491ffbe05c2cbc24298dedfa8113205bee1839b65ea985fef'
3
+ metadata.gz: c24857f2fe7b863b581727fb9b2526d2a977e8efd507b366a9b51488c7c28994
4
+ data.tar.gz: 0f34f6666d7a0efb91e8b558e4a27b00845b5d2cc2e3d1dc1415d78bf8667993
5
5
  SHA512:
6
- metadata.gz: b9c05ff1d3cc88b637a338435d34d33b581ec3d70e732446047a714d36db15ac72c499507d6c30321307757919007e0a1832eab632ae353c686e5fc2e9bf9c63
7
- data.tar.gz: f5c6608c5e5ee3842b138d45effcdb326c40431337a72ed1f8b22f0d975c4e1e18461681663767f67799380d56417abbff018996e06f9fc67b91ba6225b16913
6
+ metadata.gz: e7f54fefd82a6e8546aff83ea4cfeedd3ed10bc70c0a34dd58b0313b443038cb4d10319f5f0e2fb69f32f95686fc10e900e435847ae70092b1442f4971769d62
7
+ data.tar.gz: 6eb225d37b38405d5a2e7e726d00a08e53dc5f5a411e545ff16bd59a11d1863ac4103c9f05ca380befbbdf7f5f04a3fd6ce232f43920d493c000a0fa552c6640
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.4.0-alpha8 (2025-11-05)
4
+
5
+ Full Changelog: [v3.4.0-alpha7...v3.4.0-alpha8](https://github.com/trycourier/courier-ruby/compare/v3.4.0-alpha7...v3.4.0-alpha8)
6
+
7
+ ### Features
8
+
9
+ * Attempt kick off again ([a5ffc84](https://github.com/trycourier/courier-ruby/commit/a5ffc84f9ed318eb757d6736eca3562d1d71b2e8))
10
+ * Kick off the change (Change to user profile in descriptions) ([f4dc8ff](https://github.com/trycourier/courier-ruby/commit/f4dc8ffe56eb34a7ae471473ead69550db011aaa))
11
+ * Organization update ([c6f7b97](https://github.com/trycourier/courier-ruby/commit/c6f7b970508aca2bd1fca5d69e83c76def40058d))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * better thread safety via early initializing SSL store during HTTP client creation ([f3dfeec](https://github.com/trycourier/courier-ruby/commit/f3dfeec90dc59b454f787ef88e0b1a7b2af02ef7))
17
+
18
+
19
+ ### Chores
20
+
21
+ * bump dependency version and update sorbet types ([4d9baaa](https://github.com/trycourier/courier-ruby/commit/4d9baaac7f0ac9365f648ba0a3f10edb646e70a8))
22
+
3
23
  ## 3.4.0-alpha7 (2025-10-31)
4
24
 
5
25
  Full Changelog: [v3.4.0-alpha6...v3.4.0-alpha7](https://github.com/trycourier/courier-ruby/compare/v3.4.0-alpha6...v3.4.0-alpha7)
data/README.md CHANGED
@@ -8,6 +8,8 @@ It is generated with [Stainless](https://www.stainless.com/).
8
8
 
9
9
  Documentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/trycourier).
10
10
 
11
+ The REST API documentation can be found on [www.courier.com](https://www.courier.com/docs).
12
+
11
13
  ## Installation
12
14
 
13
15
  To use this gem, install via Bundler by adding the following to your application's `Gemfile`:
@@ -15,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
15
17
  <!-- x-release-please-start-version -->
16
18
 
17
19
  ```ruby
18
- gem "trycourier", "~> 3.4.0.pre.alpha7"
20
+ gem "trycourier", "~> 3.4.0.pre.alpha8"
19
21
  ```
20
22
 
21
23
  <!-- x-release-please-end -->
@@ -31,7 +33,7 @@ courier = Trycourier::Client.new(
31
33
  )
32
34
 
33
35
  response = courier.send_.message(
34
- message: {to: {user_id: "your_user_id"}, template: "your_template", data: {foo: "bar"}}
36
+ message: {to: {user_id: "your_user_id"}, template: "your_template_id", data: {foo: "bar"}}
35
37
  )
36
38
 
37
39
  puts(response.requestId)
@@ -44,7 +46,7 @@ When the library is unable to connect to the API, or if the API returns a non-su
44
46
  ```ruby
45
47
  begin
46
48
  send_ = courier.send_.message(
47
- message: {to: {user_id: "your_user_id"}, template: "your_template", data: {foo: "bar"}}
49
+ message: {to: {user_id: "your_user_id"}, template: "your_template_id", data: {foo: "bar"}}
48
50
  )
49
51
  rescue Trycourier::Errors::APIConnectionError => e
50
52
  puts("The server could not be reached")
@@ -89,7 +91,7 @@ courier = Trycourier::Client.new(
89
91
 
90
92
  # Or, configure per-request:
91
93
  courier.send_.message(
92
- message: {to: {user_id: "your_user_id"}, template: "your_template", data: {foo: "bar"}},
94
+ message: {to: {user_id: "your_user_id"}, template: "your_template_id", data: {foo: "bar"}},
93
95
  request_options: {max_retries: 5}
94
96
  )
95
97
  ```
@@ -106,7 +108,7 @@ courier = Trycourier::Client.new(
106
108
 
107
109
  # Or, configure per-request:
108
110
  courier.send_.message(
109
- message: {to: {user_id: "your_user_id"}, template: "your_template", data: {foo: "bar"}},
111
+ message: {to: {user_id: "your_user_id"}, template: "your_template_id", data: {foo: "bar"}},
110
112
  request_options: {timeout: 5}
111
113
  )
112
114
  ```
@@ -140,7 +142,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete
140
142
  ```ruby
141
143
  response =
142
144
  courier.send_.message(
143
- message: {to: {user_id: "your_user_id"}, template: "your_template", data: {foo: "bar"}},
145
+ message: {to: {user_id: "your_user_id"}, template: "your_template_id", data: {foo: "bar"}},
144
146
  request_options: {
145
147
  extra_query: {my_query_parameter: value},
146
148
  extra_body: {my_body_parameter: value},
@@ -189,7 +191,7 @@ You can provide typesafe request parameters like so:
189
191
  courier.send_.message(
190
192
  message: Trycourier::SendMessageParams::Message.new(
191
193
  to: Trycourier::UserRecipient.new(user_id: "your_user_id"),
192
- template: "your_template",
194
+ template: "your_template_id",
193
195
  data: {foo: "bar"}
194
196
  )
195
197
  )
@@ -200,14 +202,14 @@ Or, equivalently:
200
202
  ```ruby
201
203
  # Hashes work, but are not typesafe:
202
204
  courier.send_.message(
203
- message: {to: {user_id: "your_user_id"}, template: "your_template", data: {foo: "bar"}}
205
+ message: {to: {user_id: "your_user_id"}, template: "your_template_id", data: {foo: "bar"}}
204
206
  )
205
207
 
206
208
  # You can also splat a full Params class:
207
209
  params = Trycourier::SendMessageParams.new(
208
210
  message: Trycourier::SendMessageParams::Message.new(
209
211
  to: Trycourier::UserRecipient.new(user_id: "your_user_id"),
210
- template: "your_template",
212
+ template: "your_template_id",
211
213
  data: {foo: "bar"}
212
214
  )
213
215
  )
data/SECURITY.md CHANGED
@@ -18,6 +18,10 @@ before making any information public.
18
18
  If you encounter security issues that are not directly related to SDKs but pertain to the services
19
19
  or products provided by Courier, please follow the respective company's security reporting guidelines.
20
20
 
21
+ ### Courier Terms and Policies
22
+
23
+ Please contact support@courier.com for any questions or concerns regarding the security of our services.
24
+
21
25
  ---
22
26
 
23
27
  Thank you for helping us keep the SDKs and systems they interact with secure.
@@ -201,7 +201,8 @@ module Trycourier
201
201
  self.class::PLATFORM_HEADERS,
202
202
  {
203
203
  "accept" => "application/json",
204
- "content-type" => "application/json"
204
+ "content-type" => "application/json",
205
+ "user-agent" => user_agent
205
206
  },
206
207
  headers
207
208
  )
@@ -219,6 +220,11 @@ module Trycourier
219
220
  # @return [Hash{String=>String}]
220
221
  private def auth_headers = {}
221
222
 
223
+ # @api private
224
+ #
225
+ # @return [String]
226
+ private def user_agent = "#{self.class.name}/Ruby #{Trycourier::VERSION}"
227
+
222
228
  # @api private
223
229
  #
224
230
  # @return [String]
@@ -16,10 +16,11 @@ module Trycourier
16
16
  class << self
17
17
  # @api private
18
18
  #
19
+ # @param cert_store [OpenSSL::X509::Store]
19
20
  # @param url [URI::Generic]
20
21
  #
21
22
  # @return [Net::HTTP]
22
- def connect(url)
23
+ def connect(cert_store:, url:)
23
24
  port =
24
25
  case [url.port, url.scheme]
25
26
  in [Integer, _]
@@ -33,6 +34,8 @@ module Trycourier
33
34
  Net::HTTP.new(url.host, port).tap do
34
35
  _1.use_ssl = %w[https wss].include?(url.scheme)
35
36
  _1.max_retries = 0
37
+
38
+ (_1.cert_store = cert_store) if _1.use_ssl?
36
39
  end
37
40
  end
38
41
 
@@ -102,7 +105,7 @@ module Trycourier
102
105
  pool =
103
106
  @mutex.synchronize do
104
107
  @pools[origin] ||= ConnectionPool.new(size: @size) do
105
- self.class.connect(url)
108
+ self.class.connect(cert_store: @cert_store, url: url)
106
109
  end
107
110
  end
108
111
 
@@ -192,6 +195,7 @@ module Trycourier
192
195
  def initialize(size: self.class::DEFAULT_MAX_CONNECTIONS)
193
196
  @mutex = Mutex.new
194
197
  @size = size
198
+ @cert_store = OpenSSL::X509::Store.new.tap(&:set_default_paths)
195
199
  @pools = {}
196
200
  end
197
201
 
@@ -11,7 +11,7 @@ module Trycourier
11
11
  #
12
12
  # @overload retrieve(user_id, cursor: nil, request_options: {})
13
13
  #
14
- # @param user_id [String] A unique identifier representing the user associated with the requested profile.
14
+ # @param user_id [String] A unique identifier representing the user associated with the requested user pro
15
15
  #
16
16
  # @param cursor [String, nil] A unique identifier that allows for fetching the next set of message statuses.
17
17
  #
@@ -62,7 +62,7 @@ module Trycourier
62
62
  #
63
63
  # @overload subscribe(user_id, lists:, request_options: {})
64
64
  #
65
- # @param user_id [String] A unique identifier representing the user associated with the requested profile.
65
+ # @param user_id [String] A unique identifier representing the user associated with the requested user pro
66
66
  #
67
67
  # @param lists [Array<Trycourier::Models::SubscribeToListsRequestItem>]
68
68
  #
@@ -64,7 +64,7 @@ module Trycourier
64
64
  #
65
65
  # @overload update(user_id, patch:, request_options: {})
66
66
  #
67
- # @param user_id [String] A unique identifier representing the user associated with the requested profile.
67
+ # @param user_id [String] A unique identifier representing the user associated with the requested user pro
68
68
  #
69
69
  # @param patch [Array<Trycourier::Models::ProfileUpdateParams::Patch>] List of patch operations to apply to the profile.
70
70
  #
@@ -91,7 +91,7 @@ module Trycourier
91
91
  #
92
92
  # @overload delete(user_id, request_options: {})
93
93
  #
94
- # @param user_id [String] A unique identifier representing the user associated with the requested profile.
94
+ # @param user_id [String] A unique identifier representing the user associated with the requested user pro
95
95
  #
96
96
  # @param request_options [Trycourier::RequestOptions, Hash{Symbol=>Object}, nil]
97
97
  #
@@ -118,7 +118,7 @@ module Trycourier
118
118
  #
119
119
  # @overload replace(user_id, profile:, request_options: {})
120
120
  #
121
- # @param user_id [String] A unique identifier representing the user associated with the requested profile.
121
+ # @param user_id [String] A unique identifier representing the user associated with the requested user pro
122
122
  #
123
123
  # @param profile [Hash{Symbol=>Object}]
124
124
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Trycourier
4
- VERSION = "3.4.0.pre.alpha7"
4
+ VERSION = "3.4.0.pre.alpha8"
5
5
  end
data/lib/trycourier.rb CHANGED
@@ -9,6 +9,7 @@ require "erb"
9
9
  require "etc"
10
10
  require "json"
11
11
  require "net/http"
12
+ require "openssl"
12
13
  require "pathname"
13
14
  require "rbconfig"
14
15
  require "securerandom"
data/manifest.yaml CHANGED
@@ -6,6 +6,7 @@ dependencies:
6
6
  - etc
7
7
  - json
8
8
  - net/http
9
+ - openssl
9
10
  - pathname
10
11
  - rbconfig
11
12
  - securerandom
@@ -178,6 +178,11 @@ module Trycourier
178
178
  private def auth_headers
179
179
  end
180
180
 
181
+ # @api private
182
+ sig { returns(String) }
183
+ private def user_agent
184
+ end
185
+
181
186
  # @api private
182
187
  sig { returns(String) }
183
188
  private def generate_idempotency_key
@@ -26,8 +26,12 @@ module Trycourier
26
26
 
27
27
  class << self
28
28
  # @api private
29
- sig { params(url: URI::Generic).returns(Net::HTTP) }
30
- def connect(url)
29
+ sig do
30
+ params(cert_store: OpenSSL::X509::Store, url: URI::Generic).returns(
31
+ Net::HTTP
32
+ )
33
+ end
34
+ def connect(cert_store:, url:)
31
35
  end
32
36
 
33
37
  # @api private
@@ -31,7 +31,7 @@ module Trycourier
31
31
  #
32
32
  # Assumes superclass fields are totally defined before fields are accessed /
33
33
  # defined on subclasses.
34
- sig { params(child: T.self_type).void }
34
+ sig { params(child: Trycourier::Internal::Type::BaseModel).void }
35
35
  def inherited(child)
36
36
  end
37
37
 
@@ -276,9 +276,13 @@ module Trycourier
276
276
 
277
277
  # Create a new instance of a model.
278
278
  sig do
279
- params(data: T.any(T::Hash[Symbol, T.anything], T.self_type)).returns(
280
- T.attached_class
281
- )
279
+ params(
280
+ data:
281
+ T.any(
282
+ T::Hash[Symbol, T.anything],
283
+ Trycourier::Internal::Type::BaseModel
284
+ )
285
+ ).returns(T.attached_class)
282
286
  end
283
287
  def self.new(data = {})
284
288
  end
@@ -13,7 +13,8 @@ module Trycourier
13
13
  ).returns(Trycourier::Models::Profiles::ListRetrieveResponse)
14
14
  end
15
15
  def retrieve(
16
- # A unique identifier representing the user associated with the requested profile.
16
+ # A unique identifier representing the user associated with the requested user
17
+ # profile.
17
18
  user_id,
18
19
  # A unique identifier that allows for fetching the next set of message statuses.
19
20
  cursor: nil,
@@ -45,7 +46,8 @@ module Trycourier
45
46
  ).returns(Trycourier::Models::Profiles::ListSubscribeResponse)
46
47
  end
47
48
  def subscribe(
48
- # A unique identifier representing the user associated with the requested profile.
49
+ # A unique identifier representing the user associated with the requested user
50
+ # profile.
49
51
  user_id,
50
52
  lists:,
51
53
  request_options: {}
@@ -46,7 +46,8 @@ module Trycourier
46
46
  ).void
47
47
  end
48
48
  def update(
49
- # A unique identifier representing the user associated with the requested profile.
49
+ # A unique identifier representing the user associated with the requested user
50
+ # profile.
50
51
  user_id,
51
52
  # List of patch operations to apply to the profile.
52
53
  patch:,
@@ -62,7 +63,8 @@ module Trycourier
62
63
  ).void
63
64
  end
64
65
  def delete(
65
- # A unique identifier representing the user associated with the requested profile.
66
+ # A unique identifier representing the user associated with the requested user
67
+ # profile.
66
68
  user_id,
67
69
  request_options: {}
68
70
  )
@@ -81,7 +83,8 @@ module Trycourier
81
83
  ).returns(Trycourier::Models::ProfileReplaceResponse)
82
84
  end
83
85
  def replace(
84
- # A unique identifier representing the user associated with the requested profile.
86
+ # A unique identifier representing the user associated with the requested user
87
+ # profile.
85
88
  user_id,
86
89
  profile:,
87
90
  request_options: {}
@@ -87,6 +87,8 @@ module Trycourier
87
87
 
88
88
  private def auth_headers: -> ::Hash[String, String]
89
89
 
90
+ private def user_agent: -> String
91
+
90
92
  private def generate_idempotency_key: -> String
91
93
 
92
94
  private def build_request: (
@@ -17,7 +17,10 @@ module Trycourier
17
17
 
18
18
  DEFAULT_MAX_CONNECTIONS: Integer
19
19
 
20
- def self.connect: (URI::Generic url) -> top
20
+ def self.connect: (
21
+ cert_store: OpenSSL::X509::Store,
22
+ url: URI::Generic
23
+ ) -> top
21
24
 
22
25
  def self.calibrate_socket_timeout: (top conn, Float deadline) -> void
23
26
 
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: 3.4.0.pre.alpha7
4
+ version: 3.4.0.pre.alpha8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Courier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-31 00:00:00.000000000 Z
11
+ date: 2025-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  description:
28
- email: ''
28
+ email: support@courier.com
29
29
  executables: []
30
30
  extensions: []
31
31
  extra_rdoc_files: