Skip to content

Commit b6bddef

Browse files
feat(api): introduce dedicated model for SpendLimitDuration
1 parent 690b362 commit b6bddef

5 files changed

Lines changed: 51 additions & 82 deletions

File tree

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 165
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-a0d3bcd9c54616729a7e43847e3134205e0695d78f357cc7a25c2775b588dbbd.yml
3-
openapi_spec_hash: 36c423c286ca426f7510b27fadbdd66f
4-
config_hash: 56632a1c934324aa46c1e5c610c2de85
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-cf48017e61eb3ac8aeaaa9d933186532f476b2f3c7e12fa9c962d52e5a9a272b.yml
3+
openapi_spec_hash: b58989fdc04768fc1eb758e180c5f128
4+
config_hash: e4d87bd83b304f6ab3f032db994e0093

lib/lithic/models/non_pci_card.rb

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,21 @@ class NonPCICard < Lithic::Internal::Type::BaseModel
5555
required :spend_limit, Integer
5656

5757
# @!attribute spend_limit_duration
58-
# Spend limit duration
59-
#
60-
# @return [Symbol, Lithic::Models::NonPCICard::SpendLimitDuration]
61-
required :spend_limit_duration, enum: -> { Lithic::NonPCICard::SpendLimitDuration }
58+
# Spend limit duration values:
59+
#
60+
# - `ANNUALLY` - Card will authorize transactions up to spend limit for the
61+
# trailing year.
62+
# - `FOREVER` - Card will authorize only up to spend limit for the entire lifetime
63+
# of the card.
64+
# - `MONTHLY` - Card will authorize transactions up to spend limit for the
65+
# trailing month. To support recurring monthly payments, which can occur on
66+
# different day every month, the time window we consider for monthly velocity
67+
# starts 6 days after the current calendar date one month prior.
68+
# - `TRANSACTION` - Card will authorize multiple transactions if each individual
69+
# transaction is under the spend limit.
70+
#
71+
# @return [Symbol, Lithic::Models::SpendLimitDuration]
72+
required :spend_limit_duration, enum: -> { Lithic::SpendLimitDuration }
6273

6374
# @!attribute state
6475
# Card state values: _ `CLOSED` - Card will no longer approve authorizations.
@@ -189,7 +200,7 @@ class NonPCICard < Lithic::Internal::Type::BaseModel
189200
#
190201
# @param spend_limit [Integer] Amount (in cents) to limit approved authorizations (e.g. 100000 would be a $1,00
191202
#
192-
# @param spend_limit_duration [Symbol, Lithic::Models::NonPCICard::SpendLimitDuration] Spend limit duration
203+
# @param spend_limit_duration [Symbol, Lithic::Models::SpendLimitDuration] Spend limit duration values:
193204
#
194205
# @param state [Symbol, Lithic::Models::NonPCICard::State] Card state values: \* `CLOSED` - Card will no longer approve authorizations.
195206
# Clos
@@ -335,22 +346,6 @@ module PinStatus
335346
# @return [Array<Symbol>]
336347
end
337348

338-
# Spend limit duration
339-
#
340-
# @see Lithic::Models::NonPCICard#spend_limit_duration
341-
module SpendLimitDuration
342-
extend Lithic::Internal::Type::Enum
343-
344-
ANNUALLY = :ANNUALLY
345-
FOREVER = :FOREVER
346-
MONTHLY = :MONTHLY
347-
TRANSACTION = :TRANSACTION
348-
DAILY = :DAILY
349-
350-
# @!method self.values
351-
# @return [Array<Symbol>]
352-
end
353-
354349
# Card state values: _ `CLOSED` - Card will no longer approve authorizations.
355350
# Closing a card cannot be undone. _ `OPEN` - Card will approve authorizations (if
356351
# they match card and account parameters). _ `PAUSED` - Card will decline

rbi/lithic/models/non_pci_card.rbi

Lines changed: 27 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,19 @@ module Lithic
4343
sig { returns(Integer) }
4444
attr_accessor :spend_limit
4545

46-
# Spend limit duration
47-
sig { returns(Lithic::NonPCICard::SpendLimitDuration::TaggedSymbol) }
46+
# Spend limit duration values:
47+
#
48+
# - `ANNUALLY` - Card will authorize transactions up to spend limit for the
49+
# trailing year.
50+
# - `FOREVER` - Card will authorize only up to spend limit for the entire lifetime
51+
# of the card.
52+
# - `MONTHLY` - Card will authorize transactions up to spend limit for the
53+
# trailing month. To support recurring monthly payments, which can occur on
54+
# different day every month, the time window we consider for monthly velocity
55+
# starts 6 days after the current calendar date one month prior.
56+
# - `TRANSACTION` - Card will authorize multiple transactions if each individual
57+
# transaction is under the spend limit.
58+
sig { returns(Lithic::SpendLimitDuration::TaggedSymbol) }
4859
attr_accessor :spend_limit_duration
4960

5061
# Card state values: _ `CLOSED` - Card will no longer approve authorizations.
@@ -166,8 +177,7 @@ module Lithic
166177
last_four: String,
167178
pin_status: Lithic::NonPCICard::PinStatus::OrSymbol,
168179
spend_limit: Integer,
169-
spend_limit_duration:
170-
Lithic::NonPCICard::SpendLimitDuration::OrSymbol,
180+
spend_limit_duration: Lithic::SpendLimitDuration::OrSymbol,
171181
state: Lithic::NonPCICard::State::OrSymbol,
172182
type: Lithic::NonPCICard::Type::OrSymbol,
173183
auth_rule_tokens: T::Array[String],
@@ -201,7 +211,18 @@ module Lithic
201211
# Amount (in cents) to limit approved authorizations (e.g. 100000 would be a
202212
# $1,000 limit). Transaction requests above the spend limit will be declined.
203213
spend_limit:,
204-
# Spend limit duration
214+
# Spend limit duration values:
215+
#
216+
# - `ANNUALLY` - Card will authorize transactions up to spend limit for the
217+
# trailing year.
218+
# - `FOREVER` - Card will authorize only up to spend limit for the entire lifetime
219+
# of the card.
220+
# - `MONTHLY` - Card will authorize transactions up to spend limit for the
221+
# trailing month. To support recurring monthly payments, which can occur on
222+
# different day every month, the time window we consider for monthly velocity
223+
# starts 6 days after the current calendar date one month prior.
224+
# - `TRANSACTION` - Card will authorize multiple transactions if each individual
225+
# transaction is under the spend limit.
205226
spend_limit_duration:,
206227
# Card state values: _ `CLOSED` - Card will no longer approve authorizations.
207228
# Closing a card cannot be undone. _ `OPEN` - Card will approve authorizations (if
@@ -274,8 +295,7 @@ module Lithic
274295
last_four: String,
275296
pin_status: Lithic::NonPCICard::PinStatus::TaggedSymbol,
276297
spend_limit: Integer,
277-
spend_limit_duration:
278-
Lithic::NonPCICard::SpendLimitDuration::TaggedSymbol,
298+
spend_limit_duration: Lithic::SpendLimitDuration::TaggedSymbol,
279299
state: Lithic::NonPCICard::State::TaggedSymbol,
280300
type: Lithic::NonPCICard::Type::TaggedSymbol,
281301
auth_rule_tokens: T::Array[String],
@@ -471,37 +491,6 @@ module Lithic
471491
end
472492
end
473493

474-
# Spend limit duration
475-
module SpendLimitDuration
476-
extend Lithic::Internal::Type::Enum
477-
478-
TaggedSymbol =
479-
T.type_alias { T.all(Symbol, Lithic::NonPCICard::SpendLimitDuration) }
480-
OrSymbol = T.type_alias { T.any(Symbol, String) }
481-
482-
ANNUALLY =
483-
T.let(:ANNUALLY, Lithic::NonPCICard::SpendLimitDuration::TaggedSymbol)
484-
FOREVER =
485-
T.let(:FOREVER, Lithic::NonPCICard::SpendLimitDuration::TaggedSymbol)
486-
MONTHLY =
487-
T.let(:MONTHLY, Lithic::NonPCICard::SpendLimitDuration::TaggedSymbol)
488-
TRANSACTION =
489-
T.let(
490-
:TRANSACTION,
491-
Lithic::NonPCICard::SpendLimitDuration::TaggedSymbol
492-
)
493-
DAILY =
494-
T.let(:DAILY, Lithic::NonPCICard::SpendLimitDuration::TaggedSymbol)
495-
496-
sig do
497-
override.returns(
498-
T::Array[Lithic::NonPCICard::SpendLimitDuration::TaggedSymbol]
499-
)
500-
end
501-
def self.values
502-
end
503-
end
504-
505494
# Card state values: _ `CLOSED` - Card will no longer approve authorizations.
506495
# Closing a card cannot be undone. _ `OPEN` - Card will approve authorizations (if
507496
# they match card and account parameters). _ `PAUSED` - Card will decline

sig/lithic/models/non_pci_card.rbs

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module Lithic
1010
last_four: String,
1111
pin_status: Lithic::Models::NonPCICard::pin_status,
1212
spend_limit: Integer,
13-
spend_limit_duration: Lithic::Models::NonPCICard::spend_limit_duration,
13+
spend_limit_duration: Lithic::Models::spend_limit_duration,
1414
state: Lithic::Models::NonPCICard::state,
1515
type: Lithic::Models::NonPCICard::type_,
1616
auth_rule_tokens: ::Array[String],
@@ -42,7 +42,7 @@ module Lithic
4242

4343
attr_accessor spend_limit: Integer
4444

45-
attr_accessor spend_limit_duration: Lithic::Models::NonPCICard::spend_limit_duration
45+
attr_accessor spend_limit_duration: Lithic::Models::spend_limit_duration
4646

4747
attr_accessor state: Lithic::Models::NonPCICard::state
4848

@@ -95,7 +95,7 @@ module Lithic
9595
last_four: String,
9696
pin_status: Lithic::Models::NonPCICard::pin_status,
9797
spend_limit: Integer,
98-
spend_limit_duration: Lithic::Models::NonPCICard::spend_limit_duration,
98+
spend_limit_duration: Lithic::Models::spend_limit_duration,
9999
state: Lithic::Models::NonPCICard::state,
100100
type: Lithic::Models::NonPCICard::type_,
101101
?auth_rule_tokens: ::Array[String],
@@ -119,7 +119,7 @@ module Lithic
119119
last_four: String,
120120
pin_status: Lithic::Models::NonPCICard::pin_status,
121121
spend_limit: Integer,
122-
spend_limit_duration: Lithic::Models::NonPCICard::spend_limit_duration,
122+
spend_limit_duration: Lithic::Models::spend_limit_duration,
123123
state: Lithic::Models::NonPCICard::state,
124124
type: Lithic::Models::NonPCICard::type_,
125125
auth_rule_tokens: ::Array[String],
@@ -220,21 +220,6 @@ module Lithic
220220
def self?.values: -> ::Array[Lithic::Models::NonPCICard::pin_status]
221221
end
222222

223-
type spend_limit_duration =
224-
:ANNUALLY | :FOREVER | :MONTHLY | :TRANSACTION | :DAILY
225-
226-
module SpendLimitDuration
227-
extend Lithic::Internal::Type::Enum
228-
229-
ANNUALLY: :ANNUALLY
230-
FOREVER: :FOREVER
231-
MONTHLY: :MONTHLY
232-
TRANSACTION: :TRANSACTION
233-
DAILY: :DAILY
234-
235-
def self?.values: -> ::Array[Lithic::Models::NonPCICard::spend_limit_duration]
236-
end
237-
238223
type state =
239224
:CLOSED | :OPEN | :PAUSED | :PENDING_ACTIVATION | :PENDING_FULFILLMENT
240225

test/lithic/resources/cards_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_list
5151
last_four: String,
5252
pin_status: Lithic::NonPCICard::PinStatus,
5353
spend_limit: Integer,
54-
spend_limit_duration: Lithic::NonPCICard::SpendLimitDuration,
54+
spend_limit_duration: Lithic::SpendLimitDuration,
5555
state: Lithic::NonPCICard::State,
5656
type: Lithic::NonPCICard::Type,
5757
auth_rule_tokens: ^(Lithic::Internal::Type::ArrayOf[String]) | nil,

0 commit comments

Comments
 (0)