tilda-ruby 0.1.0 → 0.1.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: d49a419e74d08866bf0143341d119f6f970aeb479b426af5a74807490d95b956
4
- data.tar.gz: 6d15013ccdedffa4e2de38bd36653cff897553c5fa45106937ab0d698b39dc0a
3
+ metadata.gz: '068a7fcbbff23673a68889832eb699786ad1f1af35dca661c801d275e805174c'
4
+ data.tar.gz: 13ccc52749fc560530a3892b967343acc7d2e97ebff976d1f922777819d7672c
5
5
  SHA512:
6
- metadata.gz: 27e85e0270b5b4a91735dcf13ccd9ef64bec40ca3365f181d5d5ac5c7d6285d77eb95fe1981c32f3a9102344773508e03b17ee8f18f9fc275658a4a13f66a791
7
- data.tar.gz: 6e126c67dbf72928db8e7a1bf215d2fe09fe7101e8b4d8354d8117db9b5ac3d16c71cf55685ecbd14292071c4806f32371286fdb4f2d02816b131cedbce986f7
6
+ metadata.gz: 8c35f6e1aca14c2b52534592fb9cfe226d2425b8821716f32e8381b16a7c5c54de3aa653195e8cbbd353c8b5da636c3409fb53126461d7870668c2d16d93ace1
7
+ data.tar.gz: 2187e141e260f9ac047b7531a3c0a72e42ab15b7f072bffb192f1cbeac27b3d150e4d3563db81775e4e44c139d0a12371f8287753e8f2e5c06bbadcc1e5d9954
data/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.1 (2026-04-23)
4
+
5
+ Full Changelog: [v0.1.0...v0.1.1](https://github.com/Hexlet/tilda-ruby/compare/v0.1.0...v0.1.1)
6
+
7
+ ### Bug Fixes
8
+
9
+ * align path encoding with RFC 3986 section 3.3 ([d7f226e](https://github.com/Hexlet/tilda-ruby/commit/d7f226ee1e911022731bb549332d7101c2cd2478))
10
+ * **internal:** correct multipart form field name encoding ([9884a9f](https://github.com/Hexlet/tilda-ruby/commit/9884a9fcd0986e44bd3b4ec94b05a47767003d6b))
11
+ * multipart encoding for file arrays ([6291536](https://github.com/Hexlet/tilda-ruby/commit/62915360378c7ad798e184239e7bc1aedc055e04))
12
+ * properly mock time in ruby ci tests ([137828d](https://github.com/Hexlet/tilda-ruby/commit/137828d8011b68ed9b2a5214d425d19b57188146))
13
+ * variable name typo ([fbf382c](https://github.com/Hexlet/tilda-ruby/commit/fbf382c5911c5d6a09bd76e96e3766191af8ff44))
14
+
15
+
16
+ ### Chores
17
+
18
+ * **ci:** add build step ([99b5132](https://github.com/Hexlet/tilda-ruby/commit/99b51329fea77ff1180ca43f5bb8a68c4967c1a0))
19
+ * **ci:** skip lint on metadata-only changes ([9b7dea9](https://github.com/Hexlet/tilda-ruby/commit/9b7dea9127acaafe181625ec03c8fdd3b9be46cf))
20
+ * **ci:** skip uploading artifacts on stainless-internal branches ([d7ed60f](https://github.com/Hexlet/tilda-ruby/commit/d7ed60f8006ff93351974768ed7c6674456d6974))
21
+ * **ci:** support opting out of skipping builds on metadata-only commits ([504d8af](https://github.com/Hexlet/tilda-ruby/commit/504d8af0f1f2998d35b814545fd1b221b30b85f8))
22
+ * **internal:** codegen related update ([84f2624](https://github.com/Hexlet/tilda-ruby/commit/84f262489527dbb97b1298cb9a8ede204dc39e0d))
23
+ * **internal:** more robust bootstrap script ([68ddffb](https://github.com/Hexlet/tilda-ruby/commit/68ddffbb2456783c4d7736dae3cf5585fdbedd68))
24
+ * **internal:** tweak CI branches ([575d673](https://github.com/Hexlet/tilda-ruby/commit/575d673eeb2ee1877a89b02331d1e7796c9e84af))
25
+ * **internal:** update gitignore ([6a4ef71](https://github.com/Hexlet/tilda-ruby/commit/6a4ef717e732c3ee684071550f0404b4975d8de7))
26
+
3
27
  ## 0.1.0 (2026-02-25)
4
28
 
5
29
  Full Changelog: [v0.0.2...v0.1.0](https://github.com/Hexlet/tilda-ruby/compare/v0.0.2...v0.1.0)
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 "tilda-ruby", "~> 0.1.0"
20
+ gem "tilda-ruby", "~> 0.1.1"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -157,7 +157,7 @@ module TildaRuby
157
157
  in Hash | nil => coerced
158
158
  coerced
159
159
  else
160
- message = "Expected a #{Hash} or #{TildaRuby::Internal::Type::BaseModel}, got #{data.inspect}"
160
+ message = "Expected a #{Hash} or #{TildaRuby::Internal::Type::BaseModel}, got #{input.inspect}"
161
161
  raise ArgumentError.new(message)
162
162
  end
163
163
  end
@@ -237,6 +237,11 @@ module TildaRuby
237
237
  end
238
238
  end
239
239
 
240
+ # @type [Regexp]
241
+ #
242
+ # https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
243
+ RFC_3986_NOT_PCHARS = /[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/
244
+
240
245
  class << self
241
246
  # @api private
242
247
  #
@@ -247,6 +252,15 @@ module TildaRuby
247
252
  "#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}"
248
253
  end
249
254
 
255
+ # @api private
256
+ #
257
+ # @param path [String, Integer]
258
+ #
259
+ # @return [String]
260
+ def encode_path(path)
261
+ path.to_s.gsub(TildaRuby::Internal::Util::RFC_3986_NOT_PCHARS) { ERB::Util.url_encode(_1) }
262
+ end
263
+
250
264
  # @api private
251
265
  #
252
266
  # @param path [String, Array<String>]
@@ -259,7 +273,7 @@ module TildaRuby
259
273
  in []
260
274
  ""
261
275
  in [String => p, *interpolations]
262
- encoded = interpolations.map { ERB::Util.url_encode(_1) }
276
+ encoded = interpolations.map { encode_path(_1) }
263
277
  format(p, *encoded)
264
278
  end
265
279
  end
@@ -490,6 +504,37 @@ module TildaRuby
490
504
  JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}
491
505
 
492
506
  class << self
507
+ # @api private
508
+ #
509
+ # @param query [Hash{Symbol=>Object}]
510
+ #
511
+ # @return [Hash{Symbol=>Object}]
512
+ def encode_query_params(query)
513
+ out = {}
514
+ query.each { write_query_param_element!(out, _1, _2) }
515
+ out
516
+ end
517
+
518
+ # @api private
519
+ #
520
+ # @param collection [Hash{Symbol=>Object}]
521
+ # @param key [String]
522
+ # @param element [Object]
523
+ #
524
+ # @return [nil]
525
+ private def write_query_param_element!(collection, key, element)
526
+ case element
527
+ in Hash
528
+ element.each do |name, value|
529
+ write_query_param_element!(collection, "#{key}[#{name}]", value)
530
+ end
531
+ in Array
532
+ collection[key] = element.map(&:to_s).join(",")
533
+ else
534
+ collection[key] = element.to_s
535
+ end
536
+ end
537
+
493
538
  # @api private
494
539
  #
495
540
  # @param y [Enumerator::Yielder]
@@ -540,16 +585,15 @@ module TildaRuby
540
585
  y << "Content-Disposition: form-data"
541
586
 
542
587
  unless key.nil?
543
- name = ERB::Util.url_encode(key.to_s)
544
- y << "; name=\"#{name}\""
588
+ y << "; name=\"#{key}\""
545
589
  end
546
590
 
547
591
  case val
548
592
  in TildaRuby::FilePart unless val.filename.nil?
549
- filename = ERB::Util.url_encode(val.filename)
593
+ filename = encode_path(val.filename)
550
594
  y << "; filename=\"#{filename}\""
551
595
  in Pathname | IO
552
- filename = ERB::Util.url_encode(::File.basename(val.to_path))
596
+ filename = encode_path(::File.basename(val.to_path))
553
597
  y << "; filename=\"#{filename}\""
554
598
  else
555
599
  end
@@ -566,6 +610,7 @@ module TildaRuby
566
610
  #
567
611
  # @return [Array(String, Enumerable<String>)]
568
612
  private def encode_multipart_streaming(body)
613
+ # rubocop:disable Style/CaseEquality
569
614
  # RFC 1521 Section 7.2.1 says we should have 70 char maximum for boundary length
570
615
  boundary = SecureRandom.urlsafe_base64(46)
571
616
 
@@ -575,7 +620,7 @@ module TildaRuby
575
620
  in Hash
576
621
  body.each do |key, val|
577
622
  case val
578
- in Array if val.all? { primitive?(_1) }
623
+ in Array if val.all? { primitive?(_1) || TildaRuby::Internal::Type::FileInput === _1 }
579
624
  val.each do |v|
580
625
  write_multipart_chunk(y, boundary: boundary, key: key, val: v, closing: closing)
581
626
  end
@@ -591,6 +636,7 @@ module TildaRuby
591
636
 
592
637
  fused_io = fused_enum(strio) { closing.each(&:call) }
593
638
  [boundary, fused_io]
639
+ # rubocop:enable Style/CaseEquality
594
640
  end
595
641
 
596
642
  # @api private
@@ -13,10 +13,11 @@ module TildaRuby
13
13
  # @see TildaRuby::Models::ExportRetrieveParams
14
14
  def retrieve(params)
15
15
  parsed, options = TildaRuby::ExportRetrieveParams.dump_request(params)
16
+ query = TildaRuby::Internal::Util.encode_query_params(parsed)
16
17
  @client.request(
17
18
  method: :get,
18
19
  path: "v1/getpageexport",
19
- query: parsed,
20
+ query: query,
20
21
  model: TildaRuby::Models::ExportRetrieveResponse,
21
22
  options: options
22
23
  )
@@ -32,10 +33,11 @@ module TildaRuby
32
33
  # @see TildaRuby::Models::ExportRetrieveFullParams
33
34
  def retrieve_full(params)
34
35
  parsed, options = TildaRuby::ExportRetrieveFullParams.dump_request(params)
36
+ query = TildaRuby::Internal::Util.encode_query_params(parsed)
35
37
  @client.request(
36
38
  method: :get,
37
39
  path: "v1/getpagefullexport",
38
- query: parsed,
40
+ query: query,
39
41
  model: TildaRuby::Models::ExportRetrieveFullResponse,
40
42
  options: options
41
43
  )
@@ -13,10 +13,11 @@ module TildaRuby
13
13
  # @see TildaRuby::Models::PageRetrieveParams
14
14
  def retrieve(params)
15
15
  parsed, options = TildaRuby::PageRetrieveParams.dump_request(params)
16
+ query = TildaRuby::Internal::Util.encode_query_params(parsed)
16
17
  @client.request(
17
18
  method: :get,
18
19
  path: "v1/getpage",
19
- query: parsed,
20
+ query: query,
20
21
  model: TildaRuby::Models::PageRetrieveResponse,
21
22
  options: options
22
23
  )
@@ -32,10 +33,11 @@ module TildaRuby
32
33
  # @see TildaRuby::Models::PageListParams
33
34
  def list(params)
34
35
  parsed, options = TildaRuby::PageListParams.dump_request(params)
36
+ query = TildaRuby::Internal::Util.encode_query_params(parsed)
35
37
  @client.request(
36
38
  method: :get,
37
39
  path: "v1/getpageslist",
38
- query: parsed,
40
+ query: query,
39
41
  model: TildaRuby::Models::PageListResponse,
40
42
  options: options
41
43
  )
@@ -51,10 +53,11 @@ module TildaRuby
51
53
  # @see TildaRuby::Models::PageRetrieveFullParams
52
54
  def retrieve_full(params)
53
55
  parsed, options = TildaRuby::PageRetrieveFullParams.dump_request(params)
56
+ query = TildaRuby::Internal::Util.encode_query_params(parsed)
54
57
  @client.request(
55
58
  method: :get,
56
59
  path: "v1/getpagefull",
57
- query: parsed,
60
+ query: query,
58
61
  model: TildaRuby::Models::PageRetrieveFullResponse,
59
62
  options: options
60
63
  )
@@ -13,10 +13,11 @@ module TildaRuby
13
13
  # @see TildaRuby::Models::ProjectRetrieveParams
14
14
  def retrieve(params)
15
15
  parsed, options = TildaRuby::ProjectRetrieveParams.dump_request(params)
16
+ query = TildaRuby::Internal::Util.encode_query_params(parsed)
16
17
  @client.request(
17
18
  method: :get,
18
19
  path: "v1/getprojectinfo",
19
- query: parsed,
20
+ query: query,
20
21
  model: TildaRuby::Models::ProjectRetrieveResponse,
21
22
  options: options
22
23
  )
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TildaRuby
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
@@ -148,12 +148,20 @@ module TildaRuby
148
148
  end
149
149
  end
150
150
 
151
+ # https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
152
+ RFC_3986_NOT_PCHARS = T.let(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/, Regexp)
153
+
151
154
  class << self
152
155
  # @api private
153
156
  sig { params(uri: URI::Generic).returns(String) }
154
157
  def uri_origin(uri)
155
158
  end
156
159
 
160
+ # @api private
161
+ sig { params(path: T.any(String, Integer)).returns(String) }
162
+ def encode_path(path)
163
+ end
164
+
157
165
  # @api private
158
166
  sig { params(path: T.any(String, T::Array[String])).returns(String) }
159
167
  def interpolate_path(path)
@@ -301,6 +309,26 @@ module TildaRuby
301
309
  T.let(%r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}, Regexp)
302
310
 
303
311
  class << self
312
+ # @api private
313
+ sig do
314
+ params(query: TildaRuby::Internal::AnyHash).returns(
315
+ TildaRuby::Internal::AnyHash
316
+ )
317
+ end
318
+ def encode_query_params(query)
319
+ end
320
+
321
+ # @api private
322
+ sig do
323
+ params(
324
+ collection: TildaRuby::Internal::AnyHash,
325
+ key: String,
326
+ element: T.anything
327
+ ).void
328
+ end
329
+ private def write_query_param_element!(collection, key, element)
330
+ end
331
+
304
332
  # @api private
305
333
  sig do
306
334
  params(
@@ -45,8 +45,12 @@ module TildaRuby
45
45
  -> top?
46
46
  } -> top?
47
47
 
48
+ RFC_3986_NOT_PCHARS: Regexp
49
+
48
50
  def self?.uri_origin: (URI::Generic uri) -> String
49
51
 
52
+ def self?.encode_path: (String | Integer path) -> String
53
+
50
54
  def self?.interpolate_path: (String | ::Array[String] path) -> String
51
55
 
52
56
  def self?.decode_query: (String? query) -> ::Hash[String, ::Array[String]]
@@ -106,6 +110,16 @@ module TildaRuby
106
110
  JSON_CONTENT: Regexp
107
111
  JSONL_CONTENT: Regexp
108
112
 
113
+ def encode_query_params: (
114
+ ::Hash[Symbol, top] query
115
+ ) -> ::Hash[Symbol, top]
116
+
117
+ private def write_query_param_element!: (
118
+ ::Hash[Symbol, top] collection,
119
+ String key,
120
+ top element
121
+ ) -> nil
122
+
109
123
  def self?.write_multipart_content: (
110
124
  Enumerator::Yielder y,
111
125
  val: top,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tilda-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tilda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-25 00:00:00.000000000 Z
11
+ date: 2026-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cgi