Module: Anthropic::Models::Organization::SpendSummary::Scope

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

Overview

See Also:

  • Anthropic::Models::Organization::SpendSummary#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::Organization::SpendLimitUserScope .new(type:, seat_tier:) ⇒ Anthropic::Organization::SpendLimitSeatTierScope .new(type:, rbac_group_id:) ⇒ Anthropic::Organization::SpendLimitRBACGroupScope .new(type:, service:) ⇒ Anthropic::Organization::SpendLimitOrganizationServiceScope .new(type:) ⇒ Anthropic::Organization::SpendLimitOrganizationScope .new(type:, workspace_id:) ⇒ Anthropic::Organization::SpendLimitWorkspaceScope .new(type:) ⇒ Anthropic::Organization::SpendLimitUsageTierScope .new(type:, user_id:, seat_tier:, rbac_group_id:, service:, workspace_id:) ⇒ Anthropic::Models::Organization::SpendSummary::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::Organization::SpendLimitUserScope

    Parameters:

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

    Returns:

    • (Anthropic::Organization::SpendLimitUserScope)
  • .new(type:, seat_tier:) ⇒ Anthropic::Organization::SpendLimitSeatTierScope

    Parameters:

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

    Returns:

    • (Anthropic::Organization::SpendLimitSeatTierScope)
  • .new(type:, rbac_group_id:) ⇒ Anthropic::Organization::SpendLimitRBACGroupScope

    Parameters:

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

    Returns:

    • (Anthropic::Organization::SpendLimitRBACGroupScope)
  • .new(type:, service:) ⇒ Anthropic::Organization::SpendLimitOrganizationServiceScope

    Parameters:

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

    Returns:

    • (Anthropic::Organization::SpendLimitOrganizationServiceScope)
  • .new(type:) ⇒ Anthropic::Organization::SpendLimitOrganizationScope

    Parameters:

    • type: (:organization, "organization")

    Returns:

    • (Anthropic::Organization::SpendLimitOrganizationScope)
  • .new(type:, workspace_id:) ⇒ Anthropic::Organization::SpendLimitWorkspaceScope

    Parameters:

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

    Returns:

    • (Anthropic::Organization::SpendLimitWorkspaceScope)
  • .new(type:) ⇒ Anthropic::Organization::SpendLimitUsageTierScope

    Parameters:

    • type: (:usage_tier, "usage_tier")

    Returns:

    • (Anthropic::Organization::SpendLimitUsageTierScope)
  • .new(type:, user_id:, seat_tier:, rbac_group_id:, service:, workspace_id:) ⇒ Anthropic::Models::Organization::SpendSummary::scope

    Parameters:

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

    Returns:

    • (Anthropic::Models::Organization::SpendSummary::scope)

Parameters:

  • type (Symbol, Anthropic::Models::Organization::SpendSummary::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)


206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/anthropic/models/organization/spend_summary.rb', line 206

def self.new(type:, **args)
  case type.to_sym
  when :user
    Anthropic::Organization::SpendLimitUserScope.new(**args)
  when :seat_tier
    Anthropic::Organization::SpendLimitSeatTierScope.new(**args)
  when :rbac_group
    Anthropic::Organization::SpendLimitRBACGroupScope.new(**args)
  when :organization_service
    Anthropic::Organization::SpendLimitOrganizationServiceScope.new(**args)
  when :organization
    Anthropic::Organization::SpendLimitOrganizationScope.new(**args)
  when :workspace
    Anthropic::Organization::SpendLimitWorkspaceScope.new(**args)
  when :usage_tier
    Anthropic::Organization::SpendLimitUsageTierScope.new(**args)
  else
    raise ArgumentError, "unknown type: #{type}"
  end
end

.values ⇒ Array<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/anthropic/models/organization/spend_summary.rb', line 180