onebusaway-sdk 1.1.3 → 1.2.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: def9ed837e0cb9e3d967a75155f818ad39d5a5649c007e763a958b4ab07d39c1
4
- data.tar.gz: a8f37adbd50e566ea295df17270a4f8436723a2c5890848a9080761e643b6c6f
3
+ metadata.gz: fd9f3733adca20bf1e54cb55ed65474e38b7841a2ec54724f51246278517787a
4
+ data.tar.gz: 93b5a53886d460bfb4f073715de353010ec276fddfa34b5a0a0593075d65403d
5
5
  SHA512:
6
- metadata.gz: 69af154b7157400b173b17cffb3e82e9cc3f442f968b5a9f3c5fcf50031b9a119c2cdaed1de3828dadaebb56870f254903fcad5a7e70e276bcd8ba18497ee648
7
- data.tar.gz: 6047ff2b532c3d41ca7bb4e3eecfdc2da29312d5a02ac947ddbc90d306bbebb99071f750a641f0f037c3417f1e7d69bb025b9216be166129daeff37ad3d11fee
6
+ metadata.gz: '026279c2a0a74715175f20579401cf905a50376f84fec804a32fe1cb532950b8b0704aa041286522bf9b8954ce90ec84c724759c175842886d830b96ce94158b'
7
+ data.tar.gz: 746060654536b6ea0b940b95b66e6ed68b341a528ada39b78d72b7214002965e73dfa9b6c2a826411409beb2ebdd6583847bc0f04a17c2910161915013616dbf
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.1 (2025-11-04)
4
+
5
+ Full Changelog: [v1.2.0...v1.2.1](https://github.com/OneBusAway/ruby-sdk/compare/v1.2.0...v1.2.1)
6
+
7
+ ### Chores
8
+
9
+ * bump dependency version and update sorbet types ([316d259](https://github.com/OneBusAway/ruby-sdk/commit/316d25916d82a7b0c65190ba1b7d25285a766910))
10
+
11
+ ## 1.2.0 (2025-10-24)
12
+
13
+ Full Changelog: [v1.1.3...v1.2.0](https://github.com/OneBusAway/ruby-sdk/compare/v1.1.3...v1.2.0)
14
+
15
+ ### Features
16
+
17
+ * handle thread interrupts in the core HTTP client ([53092d4](https://github.com/OneBusAway/ruby-sdk/commit/53092d4d8a2665c63273a4190c192ba3382bacb9))
18
+
3
19
  ## 1.1.3 (2025-10-16)
4
20
 
5
21
  Full Changelog: [v1.1.2...v1.1.3](https://github.com/OneBusAway/ruby-sdk/compare/v1.1.2...v1.1.3)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "onebusaway-sdk", "~> 1.1.3"
20
+ gem "onebusaway-sdk", "~> 1.2.1"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -201,7 +201,8 @@ module OnebusawaySDK
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 OnebusawaySDK
219
220
  # @return [Hash{String=>String}]
220
221
  private def auth_query = {}
221
222
 
223
+ # @api private
224
+ #
225
+ # @return [String]
226
+ private def user_agent = "#{self.class.name}/Ruby #{OnebusawaySDK::VERSION}"
227
+
222
228
  # @api private
223
229
  #
224
230
  # @return [String]
@@ -128,40 +128,48 @@ module OnebusawaySDK
128
128
  url, deadline = request.fetch_values(:url, :deadline)
129
129
 
130
130
  req = nil
131
- eof = false
132
131
  finished = false
133
- closing = nil
134
132
 
135
133
  # rubocop:disable Metrics/BlockLength
136
134
  enum = Enumerator.new do |y|
137
135
  next if finished
138
136
 
139
137
  with_pool(url, deadline: deadline) do |conn|
140
- req, closing = self.class.build_request(request) do
141
- self.class.calibrate_socket_timeout(conn, deadline)
142
- end
143
-
144
- self.class.calibrate_socket_timeout(conn, deadline)
145
- unless conn.started?
146
- conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT
147
- conn.start
148
- end
138
+ eof = false
139
+ closing = nil
140
+ ::Thread.handle_interrupt(Object => :never) do
141
+ ::Thread.handle_interrupt(Object => :immediate) do
142
+ req, closing = self.class.build_request(request) do
143
+ self.class.calibrate_socket_timeout(conn, deadline)
144
+ end
149
145
 
150
- self.class.calibrate_socket_timeout(conn, deadline)
151
- conn.request(req) do |rsp|
152
- y << [req, rsp]
153
- break if finished
154
-
155
- rsp.read_body do |bytes|
156
- y << bytes.force_encoding(Encoding::BINARY)
157
- break if finished
146
+ self.class.calibrate_socket_timeout(conn, deadline)
147
+ unless conn.started?
148
+ conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT
149
+ conn.start
150
+ end
158
151
 
159
152
  self.class.calibrate_socket_timeout(conn, deadline)
153
+ conn.request(req) do |rsp|
154
+ y << [req, rsp]
155
+ break if finished
156
+
157
+ rsp.read_body do |bytes|
158
+ y << bytes.force_encoding(Encoding::BINARY)
159
+ break if finished
160
+
161
+ self.class.calibrate_socket_timeout(conn, deadline)
162
+ end
163
+ eof = true
164
+ end
165
+ end
166
+ ensure
167
+ begin
168
+ conn.finish if !eof && conn&.started?
169
+ ensure
170
+ closing&.call
160
171
  end
161
- eof = true
162
172
  end
163
- ensure
164
- conn.finish if !eof && conn&.started?
165
173
  end
166
174
  rescue Timeout::Error
167
175
  raise OnebusawaySDK::Errors::APITimeoutError.new(url: url, request: req)
@@ -174,8 +182,6 @@ module OnebusawaySDK
174
182
  body = OnebusawaySDK::Internal::Util.fused_enum(enum, external: true) do
175
183
  finished = true
176
184
  loop { enum.next }
177
- ensure
178
- closing&.call
179
185
  end
180
186
  [Integer(response.code), response, body]
181
187
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OnebusawaySDK
4
- VERSION = "1.1.3"
4
+ VERSION = "1.2.1"
5
5
  end
@@ -180,6 +180,11 @@ module OnebusawaySDK
180
180
  private def auth_query
181
181
  end
182
182
 
183
+ # @api private
184
+ sig { returns(String) }
185
+ private def user_agent
186
+ end
187
+
183
188
  # @api private
184
189
  sig { returns(String) }
185
190
  private def generate_idempotency_key
@@ -31,7 +31,7 @@ module OnebusawaySDK
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: OnebusawaySDK::Internal::Type::BaseModel).void }
35
35
  def inherited(child)
36
36
  end
37
37
 
@@ -282,9 +282,13 @@ module OnebusawaySDK
282
282
 
283
283
  # Create a new instance of a model.
284
284
  sig do
285
- params(data: T.any(T::Hash[Symbol, T.anything], T.self_type)).returns(
286
- T.attached_class
287
- )
285
+ params(
286
+ data:
287
+ T.any(
288
+ T::Hash[Symbol, T.anything],
289
+ OnebusawaySDK::Internal::Type::BaseModel
290
+ )
291
+ ).returns(T.attached_class)
288
292
  end
289
293
  def self.new(data = {})
290
294
  end
@@ -87,6 +87,8 @@ module OnebusawaySDK
87
87
 
88
88
  private def auth_query: -> ::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: (
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onebusaway-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Onebusaway SDK
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-17 00:00:00.000000000 Z
11
+ date: 2025-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool