Class: Anthropic::Models::Organization::SpendLimit

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/anthropic/models/organization/spend_limit.rb,
sig/anthropic/models/organization/spend_limit.rbs

Defined Under Namespace

Modules: Scope

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(id:, amount:, created_at:, currency:, is_enabled:, period:, scope:, updated_at:, type: :spend_limit) ⇒ SpendLimit

A configured spend limit: a cap on metered spend for one scope and period.

Some parameter documentations has been truncated, see Anthropic::Models::Organization::SpendLimit for more details.

Parameters:



# File 'lib/anthropic/models/organization/spend_limit.rb', line 67

Instance Attribute Details

#amount ⇒ String?

Limit amount as a non-negative integer decimal string in the minor unit of currency (cents for USD): "50000" is $500.00. null means no numeric cap is configured at this scope — see the effective report for whether a limit applies.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


19
# File 'lib/anthropic/models/organization/spend_limit.rb', line 19

required :amount, String, nil?: true

#created_at ⇒ Time

RFC 3339 datetime at which the spend limit was created.

Parameters:

  • value (Time)

Returns:

  • (Time)


25
# File 'lib/anthropic/models/organization/spend_limit.rb', line 25

required :created_at, Time

#currency ⇒ String

ISO 4217 code of the organization's billing currency; the unit for amount.

Parameters:

  • value (String)

Returns:

  • (String)


31
# File 'lib/anthropic/models/organization/spend_limit.rb', line 31

required :currency, String

#id ⇒ String

Unique tagged ID of the spend limit (spl_...).

Parameters:

  • value (String)

Returns:

  • (String)


11
# File 'lib/anthropic/models/organization/spend_limit.rb', line 11

required :id, String

#is_enabled ⇒ Boolean

Read-only. false when extra usage is switched off for this organization (organization limit); amount is kept and applies again when it's switched back on. Always true for other limits.

Parameters:

Returns:



39
# File 'lib/anthropic/models/organization/spend_limit.rb', line 39

required :is_enabled, Anthropic::Internal::Type::Boolean

#period ⇒ Symbol, Anthropic::Models::Organization::SpendLimitPeriod

Length of the window the limit resets over. amount caps spend within each period.

Parameters:

  • value (Anthropic::Models::Organization::spend_limit_period)

Returns:



46
# File 'lib/anthropic/models/organization/spend_limit.rb', line 46

required :period, enum: -> { Anthropic::Organization::SpendLimitPeriod }

#scope ⇒ Anthropic::Models::Organization::SpendLimitUserScope, ...

What the limit applies to. A tagged union on type; each variant carries the identifier for its scope.



53
# File 'lib/anthropic/models/organization/spend_limit.rb', line 53

required :scope, union: -> { Anthropic::Organization::SpendLimit::Scope }

#type ⇒ Symbol, :spend_limit

Object type. Always spend_limit.

Parameters:

  • value (:spend_limit)

Returns:

  • (Symbol, :spend_limit)


59
# File 'lib/anthropic/models/organization/spend_limit.rb', line 59

required :type, const: :spend_limit

#updated_at ⇒ Time

RFC 3339 datetime at which the spend limit was last modified.

Parameters:

  • value (Time)

Returns:

  • (Time)


65
# File 'lib/anthropic/models/organization/spend_limit.rb', line 65

required :updated_at, Time

Instance Method Details

#to_hash ⇒ { id: String, amount: String?, created_at: Time, currency: String, is_enabled: bool, period: Anthropic::Models::Organization::spend_limit_period, scope: Anthropic::Models::Organization::SpendLimit::scope, type: :spend_limit, updated_at: Time }

Returns:

  • ({ id: String, amount: String?, created_at: Time, currency: String, is_enabled: bool, period: Anthropic::Models::Organization::spend_limit_period, scope: Anthropic::Models::Organization::SpendLimit::scope, type: :spend_limit, updated_at: Time })


48
49
50
51
52
53
54
55
56
57
58
# File 'sig/anthropic/models/organization/spend_limit.rbs', line 48

def to_hash: -> {
  id: String,
  amount: String?,
  created_at: Time,
  currency: String,
  is_enabled: bool,
  period: Anthropic::Models::Organization::spend_limit_period,
  scope: Anthropic::Models::Organization::SpendLimit::scope,
  type: :spend_limit,
  updated_at: Time
}