knockapi 1.10.1 → 1.10.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: 3997e64ee79a3b3ff06c06551180be0f99cb577f87422c1b8da005838f1947b4
4
- data.tar.gz: 4ac513645857f58976d18c14b98bfaaf7f22fde24d3a00719d4217069e79ad01
3
+ metadata.gz: 247db1a9c4387aa27502f288b58a3db837203123f8986c2a39cd11c53da8b62d
4
+ data.tar.gz: 797f6bc3a516d4ad8be7dfdfc040a5805e61b251b85ed0fb7426e77593ce3859
5
5
  SHA512:
6
- metadata.gz: 39aadbd8ec5e906f9d8236c17077086d495b9b4daef9f98000bce63553e7b82e79ab45db9b53e281e249933c40c7d7bcb49770d14fb1b2923941ceb9f118bb10
7
- data.tar.gz: 3ecd874728d44e83f6c2b98830dfd82e90cf720ea988b0e569a96897f0b0117c4aee697f800240446ffd5281a9a3258856acb3b86f169098fc564784035712d3
6
+ metadata.gz: 514637c1db0be816f3e9913bc3a9cc138eebee03aedba7628ffdc290c5ab4b241a4cc1ebf0ac856c875a5382f313c0e3b2d1f6d5dd9352b957384d195d4749a4
7
+ data.tar.gz: 3e0acf187a631fa5a55f3e4401f54d204ac51f6d97a2f9ec7d6ed3d5e3082bf737f48724b5a3285437ecbf6cb829cf6f1a32cdbb746338976c9a6da8730b766b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.10.3 (2025-08-12)
4
+
5
+ Full Changelog: [v1.10.2...v1.10.3](https://github.com/knocklabs/knock-ruby/compare/v1.10.2...v1.10.3)
6
+
7
+ ### Bug Fixes
8
+
9
+ * **internal:** ensure sorbet test always runs serially ([66f6791](https://github.com/knocklabs/knock-ruby/commit/66f67914b8f2c811e98c1a7806fd361463614271))
10
+
11
+
12
+ ### Chores
13
+
14
+ * collect metadata from type DSL ([7221a47](https://github.com/knocklabs/knock-ruby/commit/7221a470e5604d56b1e1a91b3504f3400a8e62d2))
15
+ * **internal:** codegen related update ([83d9236](https://github.com/knocklabs/knock-ruby/commit/83d9236dedfc1d4dae46e0b1abed22206461df80))
16
+ * **internal:** increase visibility of internal helper method ([18a3bc1](https://github.com/knocklabs/knock-ruby/commit/18a3bc1e07170a0c0e2595ac17c8a0e74a4855ff))
17
+ * **internal:** update comment in script ([c0a5fc6](https://github.com/knocklabs/knock-ruby/commit/c0a5fc6a4760bb057e222e490700e702f54480fe))
18
+ * update @stainless-api/prism-cli to v5.15.0 ([f92c3e6](https://github.com/knocklabs/knock-ruby/commit/f92c3e6157c76770e840c6c8363bd57565e3e465))
19
+ * update contribute.md ([3ff1a87](https://github.com/knocklabs/knock-ruby/commit/3ff1a87c6bb8111da0f6127d38cc19c2fa5d54fa))
20
+
21
+ ## 1.10.2 (2025-07-21)
22
+
23
+ Full Changelog: [v1.10.1...v1.10.2](https://github.com/knocklabs/knock-ruby/compare/v1.10.1...v1.10.2)
24
+
25
+ ### Chores
26
+
27
+ * fix formatting ([e281fdc](https://github.com/knocklabs/knock-ruby/commit/e281fdce28d18ae794f3364f5046e7d65de39844))
28
+ * **internal:** version bump ([0aaa054](https://github.com/knocklabs/knock-ruby/commit/0aaa054c1d389b3679fc06cf0ffa95cfc7f6c774))
29
+
3
30
  ## 1.10.1 (2025-07-21)
4
31
 
5
32
  Full Changelog: [v1.10.0...v1.10.1](https://github.com/knocklabs/knock-ruby/compare/v1.10.0...v1.10.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 "knockapi", "~> 1.10.1"
20
+ gem "knockapi", "~> 1.10.3"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -365,7 +365,7 @@ module Knockapi
365
365
  #
366
366
  # @raise [Knockapi::Errors::APIError]
367
367
  # @return [Array(Integer, Net::HTTPResponse, Enumerable<String>)]
368
- private def send_request(request, redirect_count:, retry_count:, send_retry_header:)
368
+ def send_request(request, redirect_count:, retry_count:, send_retry_header:)
369
369
  url, headers, max_retries, timeout = request.fetch_values(:url, :headers, :max_retries, :timeout)
370
370
  input = {**request.except(:timeout), deadline: Knockapi::Internal::Util.monotonic_secs + timeout}
371
371
 
@@ -148,6 +148,7 @@ module Knockapi
148
148
  # @option spec [Boolean] :"nil?"
149
149
  def initialize(type_info, spec = {})
150
150
  @item_type_fn = Knockapi::Internal::Type::Converter.type_info(type_info || spec)
151
+ @meta = Knockapi::Internal::Type::Converter.meta_info(type_info, spec)
151
152
  @nilable = spec.fetch(:nil?, false)
152
153
  end
153
154
 
@@ -52,6 +52,7 @@ module Knockapi
52
52
  #
53
53
  # @option spec [Boolean] :"nil?"
54
54
  private def add_field(name_sym, required:, type_info:, spec:)
55
+ meta = Knockapi::Internal::Type::Converter.meta_info(type_info, spec)
55
56
  type_fn, info =
56
57
  case type_info
57
58
  in Proc | Knockapi::Internal::Type::Converter | Class
@@ -81,7 +82,8 @@ module Knockapi
81
82
  required: required,
82
83
  nilable: nilable,
83
84
  const: const,
84
- type_fn: type_fn
85
+ type_fn: type_fn,
86
+ meta: meta
85
87
  }
86
88
 
87
89
  define_method(setter) do |value|
@@ -98,6 +98,33 @@ module Knockapi
98
98
  end
99
99
  end
100
100
 
101
+ # @api private
102
+ #
103
+ # @param type_info [Hash{Symbol=>Object}, Proc, Knockapi::Internal::Type::Converter, Class] .
104
+ #
105
+ # @option type_info [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
106
+ #
107
+ # @option type_info [Proc] :enum
108
+ #
109
+ # @option type_info [Proc] :union
110
+ #
111
+ # @option type_info [Boolean] :"nil?"
112
+ #
113
+ # @param spec [Hash{Symbol=>Object}, Proc, Knockapi::Internal::Type::Converter, Class] .
114
+ #
115
+ # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
116
+ #
117
+ # @option spec [Proc] :enum
118
+ #
119
+ # @option spec [Proc] :union
120
+ #
121
+ # @option spec [Boolean] :"nil?"
122
+ #
123
+ # @return [Hash{Symbol=>Object}]
124
+ def meta_info(type_info, spec)
125
+ [spec, type_info].grep(Hash).first.to_h.except(:const, :enum, :union, :nil?)
126
+ end
127
+
101
128
  # @api private
102
129
  #
103
130
  # @param translate_names [Boolean]
@@ -168,6 +168,7 @@ module Knockapi
168
168
  # @option spec [Boolean] :"nil?"
169
169
  def initialize(type_info, spec = {})
170
170
  @item_type_fn = Knockapi::Internal::Type::Converter.type_info(type_info || spec)
171
+ @meta = Knockapi::Internal::Type::Converter.meta_info(type_info, spec)
171
172
  @nilable = spec.fetch(:nil?, false)
172
173
  end
173
174
 
@@ -23,20 +23,20 @@ module Knockapi
23
23
  #
24
24
  # All of the specified variant info for this union.
25
25
  #
26
- # @return [Array<Array(Symbol, Proc)>]
26
+ # @return [Array<Array(Symbol, Proc, Hash{Symbol=>Object})>]
27
27
  private def known_variants = (@known_variants ||= [])
28
28
 
29
29
  # @api private
30
30
  #
31
- # @return [Array<Array(Symbol, Object)>]
31
+ # @return [Array<Array(Symbol, Object, Hash{Symbol=>Object})>]
32
32
  protected def derefed_variants
33
- known_variants.map { |key, variant_fn| [key, variant_fn.call] }
33
+ known_variants.map { |key, variant_fn, meta| [key, variant_fn.call, meta] }
34
34
  end
35
35
 
36
36
  # All of the specified variants for this union.
37
37
  #
38
38
  # @return [Array<Object>]
39
- def variants = derefed_variants.map(&:last)
39
+ def variants = derefed_variants.map { _2 }
40
40
 
41
41
  # @api private
42
42
  #
@@ -62,12 +62,13 @@ module Knockapi
62
62
  #
63
63
  # @option spec [Boolean] :"nil?"
64
64
  private def variant(key, spec = nil)
65
+ meta = Knockapi::Internal::Type::Converter.meta_info(nil, spec)
65
66
  variant_info =
66
67
  case key
67
68
  in Symbol
68
- [key, Knockapi::Internal::Type::Converter.type_info(spec)]
69
+ [key, Knockapi::Internal::Type::Converter.type_info(spec), meta]
69
70
  in Proc | Knockapi::Internal::Type::Converter | Class | Hash
70
- [nil, Knockapi::Internal::Type::Converter.type_info(key)]
71
+ [nil, Knockapi::Internal::Type::Converter.type_info(key), meta]
71
72
  end
72
73
 
73
74
  known_variants << variant_info
@@ -90,7 +91,8 @@ module Knockapi
90
91
  return nil if key == Knockapi::Internal::OMIT
91
92
 
92
93
  key = key.to_sym if key.is_a?(String)
93
- known_variants.find { |k,| k == key }&.last&.call
94
+ _, found = known_variants.find { |k,| k == key }
95
+ found&.call
94
96
  else
95
97
  nil
96
98
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Knockapi
4
- VERSION = "1.10.1"
4
+ VERSION = "1.10.3"
5
5
  end
@@ -213,7 +213,7 @@ module Knockapi
213
213
  send_retry_header: T::Boolean
214
214
  ).returns([Integer, Net::HTTPResponse, T::Enumerable[String]])
215
215
  end
216
- private def send_request(
216
+ def send_request(
217
217
  request,
218
218
  redirect_count:,
219
219
  retry_count:,
@@ -90,6 +90,60 @@ module Knockapi
90
90
  def self.type_info(spec)
91
91
  end
92
92
 
93
+ # @api private
94
+ sig do
95
+ params(
96
+ type_info:
97
+ T.any(
98
+ {
99
+ const:
100
+ T.nilable(
101
+ T.any(NilClass, T::Boolean, Integer, Float, Symbol)
102
+ ),
103
+ enum:
104
+ T.nilable(
105
+ T.proc.returns(
106
+ Knockapi::Internal::Type::Converter::Input
107
+ )
108
+ ),
109
+ union:
110
+ T.nilable(
111
+ T.proc.returns(
112
+ Knockapi::Internal::Type::Converter::Input
113
+ )
114
+ )
115
+ },
116
+ T.proc.returns(Knockapi::Internal::Type::Converter::Input),
117
+ Knockapi::Internal::Type::Converter::Input
118
+ ),
119
+ spec:
120
+ T.any(
121
+ {
122
+ const:
123
+ T.nilable(
124
+ T.any(NilClass, T::Boolean, Integer, Float, Symbol)
125
+ ),
126
+ enum:
127
+ T.nilable(
128
+ T.proc.returns(
129
+ Knockapi::Internal::Type::Converter::Input
130
+ )
131
+ ),
132
+ union:
133
+ T.nilable(
134
+ T.proc.returns(
135
+ Knockapi::Internal::Type::Converter::Input
136
+ )
137
+ )
138
+ },
139
+ T.proc.returns(Knockapi::Internal::Type::Converter::Input),
140
+ Knockapi::Internal::Type::Converter::Input
141
+ )
142
+ ).returns(Knockapi::Internal::AnyHash)
143
+ end
144
+ def self.meta_info(type_info, spec)
145
+ end
146
+
93
147
  # @api private
94
148
  sig do
95
149
  params(translate_names: T::Boolean).returns(
@@ -16,7 +16,8 @@ module Knockapi
16
16
  T::Array[
17
17
  [
18
18
  T.nilable(Symbol),
19
- T.proc.returns(Knockapi::Internal::Type::Converter::Input)
19
+ T.proc.returns(Knockapi::Internal::Type::Converter::Input),
20
+ Knockapi::Internal::AnyHash
20
21
  ]
21
22
  ]
22
23
  )
@@ -25,7 +26,13 @@ module Knockapi
25
26
  end
26
27
 
27
28
  # @api private
28
- sig { returns(T::Array[[T.nilable(Symbol), T.anything]]) }
29
+ sig do
30
+ returns(
31
+ T::Array[
32
+ [T.nilable(Symbol), T.anything, Knockapi::Internal::AnyHash]
33
+ ]
34
+ )
35
+ end
29
36
  protected def derefed_variants
30
37
  end
31
38
 
@@ -99,7 +99,7 @@ module Knockapi
99
99
  retry_count: Integer
100
100
  ) -> Float
101
101
 
102
- private def send_request: (
102
+ def send_request: (
103
103
  Knockapi::Internal::Transport::BaseClient::request_input request,
104
104
  redirect_count: Integer,
105
105
  retry_count: Integer,
@@ -39,6 +39,23 @@ module Knockapi
39
39
  | Knockapi::Internal::Type::Converter::input spec
40
40
  ) -> (^-> top)
41
41
 
42
+ def self.meta_info: (
43
+ {
44
+ const: (nil | bool | Integer | Float | Symbol)?,
45
+ enum: ^-> Knockapi::Internal::Type::Converter::input?,
46
+ union: ^-> Knockapi::Internal::Type::Converter::input?
47
+ }
48
+ | ^-> Knockapi::Internal::Type::Converter::input
49
+ | Knockapi::Internal::Type::Converter::input type_info,
50
+ {
51
+ const: (nil | bool | Integer | Float | Symbol)?,
52
+ enum: ^-> Knockapi::Internal::Type::Converter::input?,
53
+ union: ^-> Knockapi::Internal::Type::Converter::input?
54
+ }
55
+ | ^-> Knockapi::Internal::Type::Converter::input
56
+ | Knockapi::Internal::Type::Converter::input spec
57
+ ) -> ::Hash[Symbol, top]
58
+
42
59
  def self.new_coerce_state: (
43
60
  ?translate_names: bool
44
61
  ) -> Knockapi::Internal::Type::Converter::coerce_state
@@ -5,9 +5,9 @@ module Knockapi
5
5
  include Knockapi::Internal::Type::Converter
6
6
  include Knockapi::Internal::Util::SorbetRuntimeSupport
7
7
 
8
- private def self.known_variants: -> ::Array[[Symbol?, (^-> Knockapi::Internal::Type::Converter::input)]]
8
+ private def self.known_variants: -> ::Array[[Symbol?, (^-> Knockapi::Internal::Type::Converter::input), ::Hash[Symbol, top]]]
9
9
 
10
- def self.derefed_variants: -> ::Array[[Symbol?, top]]
10
+ def self.derefed_variants: -> ::Array[[Symbol?, top, ::Hash[Symbol, top]]]
11
11
 
12
12
  def self.variants: -> ::Array[top]
13
13
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knockapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.1
4
+ version: 1.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Knock
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-21 00:00:00.000000000 Z
11
+ date: 2025-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool