Module: Anthropic::Models::Beta::Organization::BetaSpendLimit::Scope

Extended by:
Internal::Type::Union
Defined in:
lib/anthropic/models/beta/organization/beta_spend_limit.rb,
sig/anthropic/models/beta/organization/beta_spend_limit.rbs

Overview

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

See Also:

  • Anthropic::Models::Beta::Organization::BetaSpendLimit#scope

Defined Under Namespace

Modules: Type

Class Method Summary collapse

Methods included from Internal::Type::Union

==, ===, coerce, derefed_variants, dump, hash, inspect, to_sorbet_type

Methods included from Internal::Util::SorbetRuntimeSupport

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

Methods included from Internal::Type::Converter

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

Class Method Details

.new(type:, user_id:) ⇒ Anthropic::Beta::Organization::BetaSpendLimitUserScope .new(type:, seat_tier:) ⇒ Anthropic::Beta::Organization::BetaSpendLimitSeatTierScope .new(type:, rbac_group_id:) ⇒ Anthropic::Beta::Organization::BetaSpendLimitRBACGroupScope .new(type:, service:) ⇒ Anthropic::Beta::Organization::BetaSpendLimitOrganizationServiceScope .new(type:) ⇒ Anthropic::Beta::Organization::BetaSpendLimitOrganizationScope .new(type:, workspace_id:) ⇒ Anthropic::Beta::Organization::BetaSpendLimitWorkspaceScope .new(type:) ⇒ Anthropic::Beta::Organization::BetaSpendLimitUsageTierScope .new(type:, user_id:, seat_tier:, rbac_group_id:, service:, workspace_id:) ⇒ Anthropic::Models::Beta::Organization::BetaSpendLimit::scope

Creates a new instance of the variant class whose type matches the given value, passing the remaining arguments to its constructor.

Overloads:

  • .new(type:, user_id:) ⇒ Anthropic::Beta::Organization::BetaSpendLimitUserScope

    Parameters:

    • type: (:user, "user")
    • user_id: (String)

    Returns:

    • (Anthropic::Beta::Organization::BetaSpendLimitUserScope)
  • .new(type:, seat_tier:) ⇒ Anthropic::Beta::Organization::BetaSpendLimitSeatTierScope

    Parameters:

    • type: (:seat_tier, "seat_tier")
    • seat_tier: (String)

    Returns:

    • (Anthropic::Beta::Organization::BetaSpendLimitSeatTierScope)
  • .new(type:, rbac_group_id:) ⇒ Anthropic::Beta::Organization::BetaSpendLimitRBACGroupScope

    Parameters:

    • type: (:rbac_group, "rbac_group")
    • rbac_group_id: (String)

    Returns:

    • (Anthropic::Beta::Organization::BetaSpendLimitRBACGroupScope)
  • .new(type:, service:) ⇒ Anthropic::Beta::Organization::BetaSpendLimitOrganizationServiceScope

    Parameters:

    • type: (:organization_service, "organization_service")
    • service: (String)

    Returns:

    • (Anthropic::Beta::Organization::BetaSpendLimitOrganizationServiceScope)
  • .new(type:) ⇒ Anthropic::Beta::Organization::BetaSpendLimitOrganizationScope

    Parameters:

    • type: (:organization, "organization")

    Returns:

    • (Anthropic::Beta::Organization::BetaSpendLimitOrganizationScope)
  • .new(type:, workspace_id:) ⇒ Anthropic::Beta::Organization::BetaSpendLimitWorkspaceScope

    Parameters:

    • type: (:workspace, "workspace")
    • workspace_id: (String)

    Returns:

    • (Anthropic::Beta::Organization::BetaSpendLimitWorkspaceScope)
  • .new(type:) ⇒ Anthropic::Beta::Organization::BetaSpendLimitUsageTierScope

    Parameters:

    • type: (:usage_tier, "usage_tier")

    Returns:

    • (Anthropic::Beta::Organization::BetaSpendLimitUsageTierScope)
  • .new(type:, user_id:, seat_tier:, rbac_group_id:, service:, workspace_id:) ⇒ Anthropic::Models::Beta::Organization::BetaSpendLimit::scope

    Parameters:

    • type: (Anthropic::Models::Beta::Organization::BetaSpendLimit::Scope::type_, String)
    • user_id: (String)
    • seat_tier: (String)
    • rbac_group_id: (String)
    • service: (String)
    • workspace_id: (String)

    Returns:

    • (Anthropic::Models::Beta::Organization::BetaSpendLimit::scope)

Parameters:

  • type (Symbol, Anthropic::Models::Beta::Organization::BetaSpendLimit::Scope::Type, String)
  • args (Hash{Symbol=>Object}) —

    Attributes for the chosen variant.

    @option args [String] :user_id Tagged ID of the member the spend limit applies to.

    @option args [String] :seat_tier

    @option args [String] :rbac_group_id

    @option args [String] :service

    @option args [String] :workspace_id Tagged ID of the workspace the spend limit applies to.

Returns:

Raises:

  • (ArgumentError)


161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/anthropic/models/beta/organization/beta_spend_limit.rb', line 161

def self.new(type:, **args)
  case type.to_sym
  when :user
    Anthropic::Beta::Organization::BetaSpendLimitUserScope.new(**args)
  when :seat_tier
    Anthropic::Beta::Organization::BetaSpendLimitSeatTierScope.new(**args)
  when :rbac_group
    Anthropic::Beta::Organization::BetaSpendLimitRBACGroupScope.new(**args)
  when :organization_service
    Anthropic::Beta::Organization::BetaSpendLimitOrganizationServiceScope.new(**args)
  when :organization
    Anthropic::Beta::Organization::BetaSpendLimitOrganizationScope.new(**args)
  when :workspace
    Anthropic::Beta::Organization::BetaSpendLimitWorkspaceScope.new(**args)
  when :usage_tier
    Anthropic::Beta::Organization::BetaSpendLimitUsageTierScope.new(**args)
  else
    raise ArgumentError, "unknown type: #{type}"
  end
end

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/anthropic/models/beta/organization/beta_spend_limit.rb', line 135