onebusaway-sdk 1.1.1 → 1.1.3

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: 0371471d4375b099bc7ec86a863dfe3ef0e45a95adabaa722c8b9bef70000332
4
- data.tar.gz: 2f5b6cc659f4fcdd5e9f70146193bd07146cc86e9e831cf3a1d2c5c6fc969793
3
+ metadata.gz: def9ed837e0cb9e3d967a75155f818ad39d5a5649c007e763a958b4ab07d39c1
4
+ data.tar.gz: a8f37adbd50e566ea295df17270a4f8436723a2c5890848a9080761e643b6c6f
5
5
  SHA512:
6
- metadata.gz: ce3492cac2e9272658b4b1d76230b1e556932fa301c99d7fdfeb67a39b7a18da046f16a08f2293885b78c632fa80b329a2629614379ac522f3dd14820da5d1ef
7
- data.tar.gz: 6b67a81836584cf80d99f44ee2ff1b492e50db77a483b49817555cc8678b811d9d026e4ef06015b7d0412003e4fb7f187b21401f218cd3b8455b1197625310da
6
+ metadata.gz: 69af154b7157400b173b17cffb3e82e9cc3f442f968b5a9f3c5fcf50031b9a119c2cdaed1de3828dadaebb56870f254903fcad5a7e70e276bcd8ba18497ee648
7
+ data.tar.gz: 6047ff2b532c3d41ca7bb4e3eecfdc2da29312d5a02ac947ddbc90d306bbebb99071f750a641f0f037c3417f1e7d69bb025b9216be166129daeff37ad3d11fee
data/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.3 (2025-10-16)
4
+
5
+ Full Changelog: [v1.1.2...v1.1.3](https://github.com/OneBusAway/ruby-sdk/compare/v1.1.2...v1.1.3)
6
+
7
+ ### Bug Fixes
8
+
9
+ * absolutely qualified uris should always override the default ([a1e088f](https://github.com/OneBusAway/ruby-sdk/commit/a1e088fd89b1155765ca359d6dc3a2e9ae2fb67e))
10
+
11
+ ## 1.1.2 (2025-10-15)
12
+
13
+ Full Changelog: [v1.1.1...v1.1.2](https://github.com/OneBusAway/ruby-sdk/compare/v1.1.1...v1.1.2)
14
+
15
+ ### Bug Fixes
16
+
17
+ * always send `filename=...` for multipart requests where a file is expected ([ae0a463](https://github.com/OneBusAway/ruby-sdk/commit/ae0a4631df4a0ba4ebb386e4bcd228977b8554c3))
18
+ * coroutine leaks from connection pool ([5c3a6f1](https://github.com/OneBusAway/ruby-sdk/commit/5c3a6f121a63c3046f39ce62fba651a5e4e57ba8))
19
+ * shorten multipart boundary sep to less than RFC specificed max length ([eee0939](https://github.com/OneBusAway/ruby-sdk/commit/eee0939d23255dbd6b3de367bbba02ea0a346425))
20
+ * should not reuse buffers for `IO.copy_stream` interop ([29dd5d7](https://github.com/OneBusAway/ruby-sdk/commit/29dd5d7e0bcfbaf3027fca84a6338c37131843e6))
21
+
22
+
23
+ ### Performance Improvements
24
+
25
+ * faster code formatting ([95c9921](https://github.com/OneBusAway/ruby-sdk/commit/95c99210f84f729076f9c6494a98729946bcb7d9))
26
+
27
+
28
+ ### Chores
29
+
30
+ * allow fast-format to use bsd sed as well ([ac285dc](https://github.com/OneBusAway/ruby-sdk/commit/ac285dcaff516a5d8755da3534f83dfa588bcb6d))
31
+ * ignore linter error for tests having large collections ([88b7a09](https://github.com/OneBusAway/ruby-sdk/commit/88b7a092d8bab6f77ee3fdc351e0b7d0fe41713a))
32
+ * improve example values ([c2ea3c6](https://github.com/OneBusAway/ruby-sdk/commit/c2ea3c65ba37c82b323cffafad37b17b10d04c3b))
33
+ * **internal:** codegen related update ([2a3af55](https://github.com/OneBusAway/ruby-sdk/commit/2a3af55696978980ca69da2e42caecf15c72ba2d))
34
+
3
35
  ## 1.1.1 (2025-09-20)
4
36
 
5
37
  Full Changelog: [v1.1.0...v1.1.1](https://github.com/OneBusAway/ruby-sdk/compare/v1.1.0...v1.1.1)
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.1"
20
+ gem "onebusaway-sdk", "~> 1.1.3"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -38,18 +38,21 @@ module OnebusawaySDK
38
38
  def to_yaml(*a) = read.to_yaml(*a)
39
39
 
40
40
  # @param content [Pathname, StringIO, IO, String]
41
- # @param filename [String, nil]
41
+ # @param filename [Pathname, String, nil]
42
42
  # @param content_type [String, nil]
43
43
  def initialize(content, filename: nil, content_type: nil)
44
- @content = content
44
+ @content_type = content_type
45
45
  @filename =
46
- case content
47
- in Pathname
48
- filename.nil? ? content.basename.to_path : ::File.basename(filename)
46
+ case [filename, (@content = content)]
47
+ in [String | Pathname, _]
48
+ ::File.basename(filename)
49
+ in [nil, Pathname]
50
+ content.basename.to_path
51
+ in [nil, IO]
52
+ content.to_path
49
53
  else
50
- filename.nil? ? nil : ::File.basename(filename)
54
+ filename
51
55
  end
52
- @content_type = content_type
53
56
  end
54
57
  end
55
58
  end
@@ -134,9 +134,9 @@ module OnebusawaySDK
134
134
 
135
135
  # rubocop:disable Metrics/BlockLength
136
136
  enum = Enumerator.new do |y|
137
- with_pool(url, deadline: deadline) do |conn|
138
- next if finished
137
+ next if finished
139
138
 
139
+ with_pool(url, deadline: deadline) do |conn|
140
140
  req, closing = self.class.build_request(request) do
141
141
  self.class.calibrate_socket_timeout(conn, deadline)
142
142
  end
@@ -149,7 +149,7 @@ module OnebusawaySDK
149
149
 
150
150
  self.class.calibrate_socket_timeout(conn, deadline)
151
151
  conn.request(req) do |rsp|
152
- y << [conn, req, rsp]
152
+ y << [req, rsp]
153
153
  break if finished
154
154
 
155
155
  rsp.read_body do |bytes|
@@ -160,6 +160,8 @@ module OnebusawaySDK
160
160
  end
161
161
  eof = true
162
162
  end
163
+ ensure
164
+ conn.finish if !eof && conn&.started?
163
165
  end
164
166
  rescue Timeout::Error
165
167
  raise OnebusawaySDK::Errors::APITimeoutError.new(url: url, request: req)
@@ -168,16 +170,11 @@ module OnebusawaySDK
168
170
  end
169
171
  # rubocop:enable Metrics/BlockLength
170
172
 
171
- conn, _, response = enum.next
173
+ _, response = enum.next
172
174
  body = OnebusawaySDK::Internal::Util.fused_enum(enum, external: true) do
173
175
  finished = true
174
- tap do
175
- enum.next
176
- rescue StopIteration
177
- nil
178
- end
176
+ loop { enum.next }
179
177
  ensure
180
- conn.finish if !eof && conn&.started?
181
178
  closing&.call
182
179
  end
183
180
  [Integer(response.code), response, body]
@@ -82,17 +82,20 @@ module OnebusawaySDK
82
82
  #
83
83
  # @return [Pathname, StringIO, IO, String, Object]
84
84
  def dump(value, state:)
85
- # rubocop:disable Lint/DuplicateBranch
86
85
  case value
86
+ in StringIO | String
87
+ # https://datatracker.ietf.org/doc/html/rfc7578#section-4.2
88
+ # while not required, a filename is recommended, and in practice many servers do expect this
89
+ OnebusawaySDK::FilePart.new(value, filename: "upload")
87
90
  in IO
88
91
  state[:can_retry] = false
92
+ value.to_path.nil? ? OnebusawaySDK::FilePart.new(value, filename: "upload") : value
89
93
  in OnebusawaySDK::FilePart if value.content.is_a?(IO)
90
94
  state[:can_retry] = false
95
+ value
91
96
  else
97
+ value
92
98
  end
93
- # rubocop:enable Lint/DuplicateBranch
94
-
95
- value
96
99
  end
97
100
 
98
101
  # @api private
@@ -346,8 +346,9 @@ module OnebusawaySDK
346
346
  base_path, base_query = lhs.fetch_values(:path, :query)
347
347
  slashed = base_path.end_with?("/") ? base_path : "#{base_path}/"
348
348
 
349
- parsed_path, parsed_query = parse_uri(rhs.fetch(:path)).fetch_values(:path, :query)
350
- override = URI::Generic.build(**rhs.slice(:scheme, :host, :port), path: parsed_path)
349
+ merged = {**parse_uri(rhs.fetch(:path)), **rhs.except(:path, :query)}
350
+ parsed_path, parsed_query = merged.fetch_values(:path, :query)
351
+ override = URI::Generic.build(**merged.slice(:scheme, :host, :port), path: parsed_path)
351
352
 
352
353
  joined = URI.join(URI::Generic.build(lhs.except(:path, :query)), slashed, override)
353
354
  query = deep_merge(
@@ -473,10 +474,9 @@ module OnebusawaySDK
473
474
  # @return [Enumerable<String>]
474
475
  def writable_enum(&blk)
475
476
  Enumerator.new do |y|
476
- buf = String.new
477
477
  y.define_singleton_method(:write) do
478
- self << buf.replace(_1)
479
- buf.bytesize
478
+ self << _1.dup
479
+ _1.bytesize
480
480
  end
481
481
 
482
482
  blk.call(y)
@@ -566,7 +566,8 @@ module OnebusawaySDK
566
566
  #
567
567
  # @return [Array(String, Enumerable<String>)]
568
568
  private def encode_multipart_streaming(body)
569
- boundary = SecureRandom.urlsafe_base64(60)
569
+ # RFC 1521 Section 7.2.1 says we should have 70 char maximum for boundary length
570
+ boundary = SecureRandom.urlsafe_base64(46)
570
571
 
571
572
  closing = []
572
573
  strio = writable_enum do |y|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OnebusawaySDK
4
- VERSION = "1.1.1"
4
+ VERSION = "1.1.3"
5
5
  end
@@ -27,7 +27,7 @@ module OnebusawaySDK
27
27
  sig do
28
28
  params(
29
29
  content: T.any(Pathname, StringIO, IO, String),
30
- filename: T.nilable(String),
30
+ filename: T.nilable(T.any(Pathname, String)),
31
31
  content_type: T.nilable(String)
32
32
  ).returns(T.attached_class)
33
33
  end
@@ -14,7 +14,7 @@ module OnebusawaySDK
14
14
 
15
15
  def initialize: (
16
16
  Pathname | StringIO | IO | String content,
17
- ?filename: String?,
17
+ ?filename: (Pathname | String)?,
18
18
  ?content_type: String?
19
19
  ) -> void
20
20
  end
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.1
4
+ version: 1.1.3
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-09-22 00:00:00.000000000 Z
11
+ date: 2025-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool