Skip to content

Commit 7dc8888

Browse files
feat(api): api update
1 parent 66d3fab commit 7dc8888

8 files changed

Lines changed: 60 additions & 38 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 115
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-028b94908fa562ed9c31c1137078f958f859e79b33b8fddbd64934e1bb4ffd32.yml
3-
openapi_spec_hash: e9a8403fd1da4edf627451a88ba27a55
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-baf431485e9392b6fbff7c2f4d53d0dc3d1e49e2bec417501c924231c95dc09d.yml
3+
openapi_spec_hash: f80f4798ac7266ef21a9c069ccfef259
44
config_hash: 1e2186b09e57d7d27b6ab5c8e6410b31

lib/orb/models/subscription_redeem_coupon_params.rb

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ class SubscriptionRedeemCouponParams < Orb::Internal::Type::BaseModel
1212
# @return [Symbol, Orb::Models::SubscriptionRedeemCouponParams::ChangeOption]
1313
required :change_option, enum: -> { Orb::SubscriptionRedeemCouponParams::ChangeOption }
1414

15-
# @!attribute coupon_id
16-
# Coupon ID to be redeemed for this subscription.
17-
#
18-
# @return [String]
19-
required :coupon_id, String
20-
2115
# @!attribute allow_invoice_credit_or_void
2216
# If false, this request will fail if it would void an issued invoice or create a
2317
# credit note. Consider using this as a safety mechanism if you do not expect
@@ -33,18 +27,32 @@ class SubscriptionRedeemCouponParams < Orb::Internal::Type::BaseModel
3327
# @return [Time, nil]
3428
optional :change_date, Time, nil?: true
3529

36-
# @!method initialize(change_option:, coupon_id:, allow_invoice_credit_or_void: nil, change_date: nil, request_options: {})
30+
# @!attribute coupon_id
31+
# Coupon ID to be redeemed for this subscription.
32+
#
33+
# @return [String, nil]
34+
optional :coupon_id, String, nil?: true
35+
36+
# @!attribute coupon_redemption_code
37+
# Redemption code of the coupon to be redeemed for this subscription.
38+
#
39+
# @return [String, nil]
40+
optional :coupon_redemption_code, String, nil?: true
41+
42+
# @!method initialize(change_option:, allow_invoice_credit_or_void: nil, change_date: nil, coupon_id: nil, coupon_redemption_code: nil, request_options: {})
3743
# Some parameter documentations has been truncated, see
3844
# {Orb::Models::SubscriptionRedeemCouponParams} for more details.
3945
#
4046
# @param change_option [Symbol, Orb::Models::SubscriptionRedeemCouponParams::ChangeOption]
4147
#
42-
# @param coupon_id [String] Coupon ID to be redeemed for this subscription.
43-
#
4448
# @param allow_invoice_credit_or_void [Boolean, nil] If false, this request will fail if it would void an issued invoice or create a
4549
#
4650
# @param change_date [Time, nil] The date that the coupon discount should take effect. This parameter can only be
4751
#
52+
# @param coupon_id [String, nil] Coupon ID to be redeemed for this subscription.
53+
#
54+
# @param coupon_redemption_code [String, nil] Redemption code of the coupon to be redeemed for this subscription.
55+
#
4856
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}]
4957

5058
module ChangeOption

lib/orb/resources/subscriptions.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -987,18 +987,20 @@ def price_intervals(subscription_id, params = {})
987987
#
988988
# Redeem a coupon effective at a given time.
989989
#
990-
# @overload redeem_coupon(subscription_id, change_option:, coupon_id:, allow_invoice_credit_or_void: nil, change_date: nil, request_options: {})
990+
# @overload redeem_coupon(subscription_id, change_option:, allow_invoice_credit_or_void: nil, change_date: nil, coupon_id: nil, coupon_redemption_code: nil, request_options: {})
991991
#
992992
# @param subscription_id [String]
993993
#
994994
# @param change_option [Symbol, Orb::Models::SubscriptionRedeemCouponParams::ChangeOption]
995995
#
996-
# @param coupon_id [String] Coupon ID to be redeemed for this subscription.
997-
#
998996
# @param allow_invoice_credit_or_void [Boolean, nil] If false, this request will fail if it would void an issued invoice or create a
999997
#
1000998
# @param change_date [Time, nil] The date that the coupon discount should take effect. This parameter can only be
1001999
#
1000+
# @param coupon_id [String, nil] Coupon ID to be redeemed for this subscription.
1001+
#
1002+
# @param coupon_redemption_code [String, nil] Redemption code of the coupon to be redeemed for this subscription.
1003+
#
10021004
# @param request_options [Orb::RequestOptions, Hash{Symbol=>Object}, nil]
10031005
#
10041006
# @return [Orb::Models::SubscriptionRedeemCouponResponse]

rbi/orb/models/subscription_redeem_coupon_params.rbi

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ module Orb
1616
end
1717
attr_accessor :change_option
1818

19-
# Coupon ID to be redeemed for this subscription.
20-
sig { returns(String) }
21-
attr_accessor :coupon_id
22-
2319
# If false, this request will fail if it would void an issued invoice or create a
2420
# credit note. Consider using this as a safety mechanism if you do not expect
2521
# existing invoices to be changed.
@@ -31,27 +27,38 @@ module Orb
3127
sig { returns(T.nilable(Time)) }
3228
attr_accessor :change_date
3329

30+
# Coupon ID to be redeemed for this subscription.
31+
sig { returns(T.nilable(String)) }
32+
attr_accessor :coupon_id
33+
34+
# Redemption code of the coupon to be redeemed for this subscription.
35+
sig { returns(T.nilable(String)) }
36+
attr_accessor :coupon_redemption_code
37+
3438
sig do
3539
params(
3640
change_option:
3741
Orb::SubscriptionRedeemCouponParams::ChangeOption::OrSymbol,
38-
coupon_id: String,
3942
allow_invoice_credit_or_void: T.nilable(T::Boolean),
4043
change_date: T.nilable(Time),
44+
coupon_id: T.nilable(String),
45+
coupon_redemption_code: T.nilable(String),
4146
request_options: Orb::RequestOptions::OrHash
4247
).returns(T.attached_class)
4348
end
4449
def self.new(
4550
change_option:,
46-
# Coupon ID to be redeemed for this subscription.
47-
coupon_id:,
4851
# If false, this request will fail if it would void an issued invoice or create a
4952
# credit note. Consider using this as a safety mechanism if you do not expect
5053
# existing invoices to be changed.
5154
allow_invoice_credit_or_void: nil,
5255
# The date that the coupon discount should take effect. This parameter can only be
5356
# passed if the `change_option` is `requested_date`.
5457
change_date: nil,
58+
# Coupon ID to be redeemed for this subscription.
59+
coupon_id: nil,
60+
# Redemption code of the coupon to be redeemed for this subscription.
61+
coupon_redemption_code: nil,
5562
request_options: {}
5663
)
5764
end
@@ -61,9 +68,10 @@ module Orb
6168
{
6269
change_option:
6370
Orb::SubscriptionRedeemCouponParams::ChangeOption::OrSymbol,
64-
coupon_id: String,
6571
allow_invoice_credit_or_void: T.nilable(T::Boolean),
6672
change_date: T.nilable(Time),
73+
coupon_id: T.nilable(String),
74+
coupon_redemption_code: T.nilable(String),
6775
request_options: Orb::RequestOptions
6876
}
6977
)

rbi/orb/resources/subscriptions.rbi

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,24 +1013,27 @@ module Orb
10131013
subscription_id: String,
10141014
change_option:
10151015
Orb::SubscriptionRedeemCouponParams::ChangeOption::OrSymbol,
1016-
coupon_id: String,
10171016
allow_invoice_credit_or_void: T.nilable(T::Boolean),
10181017
change_date: T.nilable(Time),
1018+
coupon_id: T.nilable(String),
1019+
coupon_redemption_code: T.nilable(String),
10191020
request_options: Orb::RequestOptions::OrHash
10201021
).returns(Orb::Models::SubscriptionRedeemCouponResponse)
10211022
end
10221023
def redeem_coupon(
10231024
subscription_id,
10241025
change_option:,
1025-
# Coupon ID to be redeemed for this subscription.
1026-
coupon_id:,
10271026
# If false, this request will fail if it would void an issued invoice or create a
10281027
# credit note. Consider using this as a safety mechanism if you do not expect
10291028
# existing invoices to be changed.
10301029
allow_invoice_credit_or_void: nil,
10311030
# The date that the coupon discount should take effect. This parameter can only be
10321031
# passed if the `change_option` is `requested_date`.
10331032
change_date: nil,
1033+
# Coupon ID to be redeemed for this subscription.
1034+
coupon_id: nil,
1035+
# Redemption code of the coupon to be redeemed for this subscription.
1036+
coupon_redemption_code: nil,
10341037
request_options: {}
10351038
)
10361039
end

sig/orb/models/subscription_redeem_coupon_params.rbs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ module Orb
33
type subscription_redeem_coupon_params =
44
{
55
change_option: Orb::Models::SubscriptionRedeemCouponParams::change_option,
6-
coupon_id: String,
76
allow_invoice_credit_or_void: bool?,
8-
change_date: Time?
7+
change_date: Time?,
8+
coupon_id: String?,
9+
coupon_redemption_code: String?
910
}
1011
& Orb::Internal::Type::request_parameters
1112

@@ -15,25 +16,29 @@ module Orb
1516

1617
attr_accessor change_option: Orb::Models::SubscriptionRedeemCouponParams::change_option
1718

18-
attr_accessor coupon_id: String
19-
2019
attr_accessor allow_invoice_credit_or_void: bool?
2120

2221
attr_accessor change_date: Time?
2322

23+
attr_accessor coupon_id: String?
24+
25+
attr_accessor coupon_redemption_code: String?
26+
2427
def initialize: (
2528
change_option: Orb::Models::SubscriptionRedeemCouponParams::change_option,
26-
coupon_id: String,
2729
?allow_invoice_credit_or_void: bool?,
2830
?change_date: Time?,
31+
?coupon_id: String?,
32+
?coupon_redemption_code: String?,
2933
?request_options: Orb::request_opts
3034
) -> void
3135

3236
def to_hash: -> {
3337
change_option: Orb::Models::SubscriptionRedeemCouponParams::change_option,
34-
coupon_id: String,
3538
allow_invoice_credit_or_void: bool?,
3639
change_date: Time?,
40+
coupon_id: String?,
41+
coupon_redemption_code: String?,
3742
request_options: Orb::RequestOptions
3843
}
3944

sig/orb/resources/subscriptions.rbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,10 @@ module Orb
122122
def redeem_coupon: (
123123
String subscription_id,
124124
change_option: Orb::Models::SubscriptionRedeemCouponParams::change_option,
125-
coupon_id: String,
126125
?allow_invoice_credit_or_void: bool?,
127126
?change_date: Time?,
127+
?coupon_id: String?,
128+
?coupon_redemption_code: String?,
128129
?request_options: Orb::request_opts
129130
) -> Orb::Models::SubscriptionRedeemCouponResponse
130131

test/orb/resources/subscriptions_test.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,12 +311,7 @@ def test_price_intervals
311311
end
312312

313313
def test_redeem_coupon_required_params
314-
response =
315-
@orb.subscriptions.redeem_coupon(
316-
"subscription_id",
317-
change_option: :requested_date,
318-
coupon_id: "coupon_id"
319-
)
314+
response = @orb.subscriptions.redeem_coupon("subscription_id", change_option: :requested_date)
320315

321316
assert_pattern do
322317
response => Orb::Models::SubscriptionRedeemCouponResponse

0 commit comments

Comments
 (0)