modern_treasury 0.1.0.pre.alpha.20 → 0.1.0.pre.alpha.21

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: bd1003cb64621e98061d4ea560dfbbae6f3a45716922765fcca9e3041ac78f90
4
- data.tar.gz: a1991e3bf60a3ac44bcd607c4777dafbdef7d6ecb3368f1808abd420bbf547c6
3
+ metadata.gz: d6545344e52ee8011782e1a9a5f3cec4a92310c31816c73f155d6f3ff7cc207a
4
+ data.tar.gz: d5d6a14ca7c9820c7dc53475f228581cd7369a3d74f0e892e51f676e13018d14
5
5
  SHA512:
6
- metadata.gz: 9864551a559538d8ea3e34bea4057e64f4d68d775458b822cfdaa5a696c08b1747a3e03e78be226b8d4019568a03356286aa569e432ae39808c3b7b05c06a2c9
7
- data.tar.gz: 82eb2cbb206557691cf3aafc61e0fd69ade2801145f8e9d0300292c7abbe92ec44f70421d0f244a75df8350381254f80e0f46be8943474b5f1438adbe2d3ca6f
6
+ metadata.gz: 835ae7e37e8b518b6262bf89029df5df1b13f42b58b531c8fc01efb8ba89b96df092b8e1b05f6a9e752e8e65bab135676359aae6b16c5aa3f0adb82fe46b6ec3
7
+ data.tar.gz: cb3e668b989d2f719d23ee95833f4d4cb604b51257e6e5daf9715e81f06de08cce77f789ff1d73a73edf13efdde7685d451d9b0dab9c25baf67ca6b02e8987d4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.0-alpha.21 (2025-06-04)
4
+
5
+ Full Changelog: [v0.1.0-alpha.20...v0.1.0-alpha.21](https://github.com/Modern-Treasury/modern-treasury-ruby/compare/v0.1.0-alpha.20...v0.1.0-alpha.21)
6
+
7
+ ### Bug Fixes
8
+
9
+ * `to_sorbet_type` should not return branded types ([64e22b2](https://github.com/Modern-Treasury/modern-treasury-ruby/commit/64e22b2126f3da851a7b9dbe66b35ddf75f8720e))
10
+ * default content-type for text in multi-part formdata uploads should be text/plain ([1ccbced](https://github.com/Modern-Treasury/modern-treasury-ruby/commit/1ccbcedbc67024e305f42562b0e450dfa3c96580))
11
+ * sorbet types for enums, and make tapioca detection ignore `tapioca dsl` ([8db30b1](https://github.com/Modern-Treasury/modern-treasury-ruby/commit/8db30b16ce159a33ad0580b613f7c4d4f7064394))
12
+
13
+
14
+ ### Chores
15
+
16
+ * **docs:** reorder client arguments ([f7efa80](https://github.com/Modern-Treasury/modern-treasury-ruby/commit/f7efa807c5978616f167451d4968285bcb502555))
17
+
3
18
  ## 0.1.0-alpha.20 (2025-05-23)
4
19
 
5
20
  Full Changelog: [v0.1.0-alpha.19...v0.1.0-alpha.20](https://github.com/Modern-Treasury/modern-treasury-ruby/compare/v0.1.0-alpha.19...v0.1.0-alpha.20)
data/README.md CHANGED
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
15
15
  <!-- x-release-please-start-version -->
16
16
 
17
17
  ```ruby
18
- gem "modern_treasury", "~> 0.1.0.pre.alpha.20"
18
+ gem "modern_treasury", "~> 0.1.0.pre.alpha.21"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -27,8 +27,8 @@ require "bundler/setup"
27
27
  require "modern_treasury"
28
28
 
29
29
  modern_treasury = ModernTreasury::Client.new(
30
- organization_id: ENV["MODERN_TREASURY_ORGANIZATION_ID"], # This is the default and can be omitted
31
- api_key: ENV["MODERN_TREASURY_API_KEY"] # This is the default and can be omitted
30
+ api_key: ENV["MODERN_TREASURY_API_KEY"], # This is the default and can be omitted
31
+ organization_id: ENV["MODERN_TREASURY_ORGANIZATION_ID"] # This is the default and can be omitted
32
32
  )
33
33
 
34
34
  counterparty = modern_treasury.counterparties.create(name: "my first counterparty")
@@ -112,11 +112,14 @@ module ModernTreasury
112
112
  #
113
113
  # @return [Object]
114
114
  def to_sorbet_type
115
- case values
115
+ types = values.map { ModernTreasury::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(_1) }.uniq
116
+ case types
116
117
  in []
117
118
  T.noreturn
118
- in [value, *_]
119
- T.all(ModernTreasury::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(value), self)
119
+ in [type]
120
+ type
121
+ else
122
+ T.any(*types)
120
123
  end
121
124
  end
122
125
 
@@ -212,11 +212,16 @@ module ModernTreasury
212
212
  #
213
213
  # @return [Object]
214
214
  def to_sorbet_type
215
- case (v = variants)
215
+ types = variants.map do
216
+ ModernTreasury::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(_1)
217
+ end.uniq
218
+ case types
216
219
  in []
217
220
  T.noreturn
221
+ in [type]
222
+ type
218
223
  else
219
- T.any(*v.map { ModernTreasury::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(_1) })
224
+ T.any(*types)
220
225
  end
221
226
  end
222
227
 
@@ -497,7 +497,7 @@ module ModernTreasury
497
497
  # @param closing [Array<Proc>]
498
498
  # @param content_type [String, nil]
499
499
  private def write_multipart_content(y, val:, closing:, content_type: nil)
500
- content_type ||= "application/octet-stream"
500
+ content_line = "Content-Type: %s\r\n\r\n"
501
501
 
502
502
  case val
503
503
  in ModernTreasury::FilePart
@@ -508,24 +508,21 @@ module ModernTreasury
508
508
  content_type: val.content_type
509
509
  )
510
510
  in Pathname
511
- y << "Content-Type: #{content_type}\r\n\r\n"
511
+ y << format(content_line, content_type || "application/octet-stream")
512
512
  io = val.open(binmode: true)
513
513
  closing << io.method(:close)
514
514
  IO.copy_stream(io, y)
515
515
  in IO
516
- y << "Content-Type: #{content_type}\r\n\r\n"
516
+ y << format(content_line, content_type || "application/octet-stream")
517
517
  IO.copy_stream(val, y)
518
518
  in StringIO
519
- y << "Content-Type: #{content_type}\r\n\r\n"
519
+ y << format(content_line, content_type || "application/octet-stream")
520
520
  y << val.string
521
- in String
522
- y << "Content-Type: #{content_type}\r\n\r\n"
523
- y << val.to_s
524
521
  in -> { primitive?(_1) }
525
- y << "Content-Type: text/plain\r\n\r\n"
522
+ y << format(content_line, content_type || "text/plain")
526
523
  y << val.to_s
527
524
  else
528
- y << "Content-Type: application/json\r\n\r\n"
525
+ y << format(content_line, content_type || "application/json")
529
526
  y << JSON.generate(val)
530
527
  end
531
528
  y << "\r\n"
@@ -563,6 +560,8 @@ module ModernTreasury
563
560
 
564
561
  # @api private
565
562
  #
563
+ # https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#special-considerations-for-multipart-content
564
+ #
566
565
  # @param body [Object]
567
566
  #
568
567
  # @return [Array(String, Enumerable<String>)]
@@ -875,8 +874,12 @@ module ModernTreasury
875
874
  case type
876
875
  in ModernTreasury::Internal::Util::SorbetRuntimeSupport
877
876
  type.to_sorbet_type
878
- else
877
+ in Class | Module
879
878
  type
879
+ in true | false
880
+ T::Boolean
881
+ else
882
+ type.class
880
883
  end
881
884
  end
882
885
  end
@@ -14,16 +14,16 @@ module ModernTreasury
14
14
  mod.constants.each do |name|
15
15
  case mod.const_get(name)
16
16
  in true | false
17
- mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T.all(T::Boolean, mod) } }
17
+ mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T::Boolean } }
18
18
  mod.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } }
19
19
  in Integer
20
- mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { T.all(Integer, mod) } }
20
+ mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { Integer } }
21
21
  mod.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } }
22
22
  in Float
23
- mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { T.all(Float, mod) } }
23
+ mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { Float } }
24
24
  mod.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } }
25
25
  in Symbol
26
- mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { T.all(Symbol, mod) } }
26
+ mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { Symbol } }
27
27
  mod.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } }
28
28
  else
29
29
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ModernTreasury
4
- VERSION = "0.1.0.pre.alpha.20"
4
+ VERSION = "0.1.0.pre.alpha.21"
5
5
  end
@@ -20,7 +20,9 @@ require "uri"
20
20
 
21
21
  # We already ship the preferred sorbet manifests in the package itself.
22
22
  # `tapioca` currently does not offer us a way to opt out of unnecessary compilation.
23
- if Object.const_defined?(:Tapioca) && caller.chain([$PROGRAM_NAME]).chain(ARGV).grep(/tapioca/)
23
+ if Object.const_defined?(:Tapioca) &&
24
+ caller.chain([$PROGRAM_NAME]).chain(ARGV).any?(/tapioca/) &&
25
+ ARGV.none?(/dsl/)
24
26
  return
25
27
  end
26
28
 
@@ -332,6 +332,8 @@ module ModernTreasury
332
332
  end
333
333
 
334
334
  # @api private
335
+ #
336
+ # https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#special-considerations-for-multipart-content
335
337
  sig do
336
338
  params(body: T.anything).returns([String, T::Enumerable[String]])
337
339
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modern_treasury
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre.alpha.20
4
+ version: 0.1.0.pre.alpha.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Modern Treasury
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-23 00:00:00.000000000 Z
11
+ date: 2025-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool