orb-billing 0.10.0 → 0.12.0

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +32 -0
  3. data/README.md +1 -1
  4. data/lib/orb/internal/type/union.rb +3 -8
  5. data/lib/orb/internal/util.rb +8 -9
  6. data/lib/orb/models/amount_discount.rb +65 -1
  7. data/lib/orb/models/beta/external_plan_id_create_plan_version_params.rb +1437 -15
  8. data/lib/orb/models/beta_create_plan_version_params.rb +1435 -15
  9. data/lib/orb/models/percentage_discount.rb +65 -1
  10. data/lib/orb/models/subscription_create_params.rb +1435 -15
  11. data/lib/orb/models/subscription_price_intervals_params.rb +715 -5
  12. data/lib/orb/models/subscription_redeem_coupon_params.rb +17 -9
  13. data/lib/orb/models/subscription_schedule_plan_change_params.rb +1435 -15
  14. data/lib/orb/models/trial_discount.rb +65 -1
  15. data/lib/orb/models/usage_discount.rb +65 -1
  16. data/lib/orb/resources/subscriptions.rb +6 -4
  17. data/lib/orb/version.rb +1 -1
  18. data/rbi/orb/internal/util.rbi +2 -0
  19. data/rbi/orb/models/amount_discount.rbi +117 -0
  20. data/rbi/orb/models/beta/external_plan_id_create_plan_version_params.rbi +6145 -3045
  21. data/rbi/orb/models/beta_create_plan_version_params.rbi +6096 -2996
  22. data/rbi/orb/models/percentage_discount.rbi +131 -0
  23. data/rbi/orb/models/subscription_create_params.rbi +6037 -2937
  24. data/rbi/orb/models/subscription_price_intervals_params.rbi +1633 -83
  25. data/rbi/orb/models/subscription_redeem_coupon_params.rbi +16 -8
  26. data/rbi/orb/models/subscription_schedule_plan_change_params.rbi +6948 -3848
  27. data/rbi/orb/models/trial_discount.rbi +109 -0
  28. data/rbi/orb/models/usage_discount.rbi +109 -0
  29. data/rbi/orb/resources/subscriptions.rbi +7 -4
  30. data/sig/orb/models/amount_discount.rbs +58 -0
  31. data/sig/orb/models/beta/external_plan_id_create_plan_version_params.rbs +1130 -20
  32. data/sig/orb/models/beta_create_plan_version_params.rbs +1130 -20
  33. data/sig/orb/models/percentage_discount.rbs +58 -0
  34. data/sig/orb/models/subscription_create_params.rbs +1130 -20
  35. data/sig/orb/models/subscription_price_intervals_params.rbs +565 -10
  36. data/sig/orb/models/subscription_redeem_coupon_params.rbs +11 -6
  37. data/sig/orb/models/subscription_schedule_plan_change_params.rbs +1130 -20
  38. data/sig/orb/models/trial_discount.rbs +58 -0
  39. data/sig/orb/models/usage_discount.rbs +58 -0
  40. data/sig/orb/resources/subscriptions.rbs +2 -1
  41. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fc3d6747d0949471ff108070f8106061056ca686739bf9f382de763dec391de
4
- data.tar.gz: ba5cf7901eede9bef59e785299c3327a33c947620fe0ee797dff8d3ca6dcca01
3
+ metadata.gz: 7141a773b4b921917720b072f2380cf9f72c9e9de30497b6cbd74b5b511fb295
4
+ data.tar.gz: 9c2ce5c3a421d2c09b4025b4b9883a8f082e630a7b2174308957d04ebef89322
5
5
  SHA512:
6
- metadata.gz: 2b96875aef0246227c5ee01518dcf0221941f3993622ed30ee508359a7a1b6e4b61160817c26ed8c594362d2b83a2fcb4696e1f481164a74ff7cd16cbb4f0c64
7
- data.tar.gz: fa5c5b729a07b91f6eea0f1f3aa20447f79797a0d3ee8ec92b501d5588a6c3e9630a20586fe5c6d76c31c62d5c9315877f46733be02aab9f7485ca1e57721cf1
6
+ metadata.gz: 68d584671e377dc03545e0ebdde30302bfdd4d337058b2e1219ba70247b54300ba2a1a4ba9642fcfedc7a2a0823189b2ed96ba5d5e946cc521a67a657309e8b6
7
+ data.tar.gz: 61a96ed2e99e24e126da47fbab10a076c410000b2ebebafda00c94776fbe199d053518b74ee7c616ee48375431f9f231469284291f9f0731f8a8f63141bf5b27
data/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.12.0 (2025-06-04)
4
+
5
+ Full Changelog: [v0.11.0...v0.12.0](https://github.com/orbcorp/orb-ruby/compare/v0.11.0...v0.12.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([b968df3](https://github.com/orbcorp/orb-ruby/commit/b968df3383cda68a45c14406a4c1194e9d9d6ceb))
10
+ * **api:** api update ([5120730](https://github.com/orbcorp/orb-ruby/commit/5120730c192916f56c2d4cf867143ea58add104d))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * default content-type for text in multi-part formdata uploads should be text/plain ([0095004](https://github.com/orbcorp/orb-ruby/commit/0095004d4fd8f0c26dff9e5a783110590ff510a9))
16
+
17
+
18
+ ### Chores
19
+
20
+ * **internal:** version bump ([a6f9ef1](https://github.com/orbcorp/orb-ruby/commit/a6f9ef14e92c16e31e42246dca9edcb6eef741fd))
21
+
22
+ ## 0.11.0 (2025-06-03)
23
+
24
+ Full Changelog: [v0.10.0...v0.11.0](https://github.com/orbcorp/orb-ruby/compare/v0.10.0...v0.11.0)
25
+
26
+ ### Features
27
+
28
+ * **api:** api update ([7eff3fa](https://github.com/orbcorp/orb-ruby/commit/7eff3fa81e770e512c70c5659e73147e0ce80b1b))
29
+
30
+
31
+ ### Chores
32
+
33
+ * **internal:** version bump ([79e25f6](https://github.com/orbcorp/orb-ruby/commit/79e25f64012492bbcdd5bb6dbe178c5156d014cb))
34
+
3
35
  ## 0.10.0 (2025-06-02)
4
36
 
5
37
  Full Changelog: [v0.9.1...v0.10.0](https://github.com/orbcorp/orb-ruby/compare/v0.9.1...v0.10.0)
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 "orb-billing", "~> 0.10.0"
18
+ gem "orb-billing", "~> 0.12.0"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -24,21 +24,16 @@ module Orb
24
24
  # discount_type: :percentage,
25
25
  # percentage_discount: percentage_discount,
26
26
  # applies_to_price_ids: applies_to_price_ids,
27
- # reason: reason
27
+ # filters: filters
28
28
  # }
29
29
  # puts(percentage_discount)
30
- # in {
31
- # discount_type: :trial,
32
- # applies_to_price_ids: applies_to_price_ids,
33
- # reason: reason,
34
- # trial_amount_discount: trial_amount_discount
35
- # }
30
+ # in {discount_type: :trial, applies_to_price_ids: applies_to_price_ids, filters: filters, reason: reason}
36
31
  # puts(applies_to_price_ids)
37
32
  # in {
38
33
  # discount_type: :usage,
39
34
  # usage_discount: usage_discount,
40
35
  # applies_to_price_ids: applies_to_price_ids,
41
- # reason: reason
36
+ # filters: filters
42
37
  # }
43
38
  # puts(usage_discount)
44
39
  # else
@@ -497,7 +497,7 @@ module Orb
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 Orb::FilePart
@@ -508,24 +508,21 @@ module Orb
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 Orb
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>)]
@@ -21,12 +21,18 @@ module Orb
21
21
  # @return [Array<String>, nil]
22
22
  optional :applies_to_price_ids, Orb::Internal::Type::ArrayOf[String], nil?: true
23
23
 
24
+ # @!attribute filters
25
+ # The filters that determine which prices to apply this discount to.
26
+ #
27
+ # @return [Array<Orb::Models::AmountDiscount::Filter>, nil]
28
+ optional :filters, -> { Orb::Internal::Type::ArrayOf[Orb::AmountDiscount::Filter] }, nil?: true
29
+
24
30
  # @!attribute reason
25
31
  #
26
32
  # @return [String, nil]
27
33
  optional :reason, String, nil?: true
28
34
 
29
- # @!method initialize(amount_discount:, discount_type:, applies_to_price_ids: nil, reason: nil)
35
+ # @!method initialize(amount_discount:, discount_type:, applies_to_price_ids: nil, filters: nil, reason: nil)
30
36
  # Some parameter documentations has been truncated, see
31
37
  # {Orb::Models::AmountDiscount} for more details.
32
38
  #
@@ -36,6 +42,8 @@ module Orb
36
42
  #
37
43
  # @param applies_to_price_ids [Array<String>, nil] List of price_ids that this discount applies to. For plan/plan phase discounts,
38
44
  #
45
+ # @param filters [Array<Orb::Models::AmountDiscount::Filter>, nil] The filters that determine which prices to apply this discount to.
46
+ #
39
47
  # @param reason [String, nil]
40
48
 
41
49
  # @see Orb::Models::AmountDiscount#discount_type
@@ -47,6 +55,62 @@ module Orb
47
55
  # @!method self.values
48
56
  # @return [Array<Symbol>]
49
57
  end
58
+
59
+ class Filter < Orb::Internal::Type::BaseModel
60
+ # @!attribute field
61
+ # The property of the price to filter on.
62
+ #
63
+ # @return [Symbol, Orb::Models::AmountDiscount::Filter::Field]
64
+ required :field, enum: -> { Orb::AmountDiscount::Filter::Field }
65
+
66
+ # @!attribute operator
67
+ # Should prices that match the filter be included or excluded.
68
+ #
69
+ # @return [Symbol, Orb::Models::AmountDiscount::Filter::Operator]
70
+ required :operator, enum: -> { Orb::AmountDiscount::Filter::Operator }
71
+
72
+ # @!attribute values
73
+ # The IDs or values that match this filter.
74
+ #
75
+ # @return [Array<String>]
76
+ required :values, Orb::Internal::Type::ArrayOf[String]
77
+
78
+ # @!method initialize(field:, operator:, values:)
79
+ # @param field [Symbol, Orb::Models::AmountDiscount::Filter::Field] The property of the price to filter on.
80
+ #
81
+ # @param operator [Symbol, Orb::Models::AmountDiscount::Filter::Operator] Should prices that match the filter be included or excluded.
82
+ #
83
+ # @param values [Array<String>] The IDs or values that match this filter.
84
+
85
+ # The property of the price to filter on.
86
+ #
87
+ # @see Orb::Models::AmountDiscount::Filter#field
88
+ module Field
89
+ extend Orb::Internal::Type::Enum
90
+
91
+ PRICE_ID = :price_id
92
+ ITEM_ID = :item_id
93
+ PRICE_TYPE = :price_type
94
+ CURRENCY = :currency
95
+ PRICING_UNIT_ID = :pricing_unit_id
96
+
97
+ # @!method self.values
98
+ # @return [Array<Symbol>]
99
+ end
100
+
101
+ # Should prices that match the filter be included or excluded.
102
+ #
103
+ # @see Orb::Models::AmountDiscount::Filter#operator
104
+ module Operator
105
+ extend Orb::Internal::Type::Enum
106
+
107
+ INCLUDES = :includes
108
+ EXCLUDES = :excludes
109
+
110
+ # @!method self.values
111
+ # @return [Array<Symbol>]
112
+ end
113
+ end
50
114
  end
51
115
  end
52
116
  end