Class: WhopSDK::Models::PromoCode

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/whop_sdk/models/promo_code.rb

Overview

Defined Under Namespace

Classes: Company, Product

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: , title: ) ⇒ Object

The company for the promo code.

Parameters:

  • id (String) (defaults to: )

    The ID of the company

  • title (String) (defaults to: )

    The written name of the company.



# File 'lib/whop_sdk/models/promo_code.rb', line 122

Instance Attribute Details

#amount_offFloat

The amount off (% or flat amount) for the promo.

Returns:

  • (Float)


17
# File 'lib/whop_sdk/models/promo_code.rb', line 17

required :amount_off, Float

#churned_users_onlyBoolean

Restricts promo use to only users who have churned from the company before.

Returns:

  • (Boolean)


23
# File 'lib/whop_sdk/models/promo_code.rb', line 23

required :churned_users_only, WhopSDK::Internal::Type::Boolean

#codeString?

The specific code used to apply the promo at checkout.

Returns:

  • (String, nil)


29
# File 'lib/whop_sdk/models/promo_code.rb', line 29

required :code, String, nil?: true

#companyWhopSDK::Models::PromoCode::Company

The company for the promo code.



35
# File 'lib/whop_sdk/models/promo_code.rb', line 35

required :company, -> { WhopSDK::PromoCode::Company }

#created_atTime

The timestamp of when the promo was created.

Returns:

  • (Time)


41
# File 'lib/whop_sdk/models/promo_code.rb', line 41

required :created_at, Time

#currencySymbol, WhopSDK::Models::Currency

The monetary currency of the promo code.

Returns:



47
# File 'lib/whop_sdk/models/promo_code.rb', line 47

required :currency, enum: -> { WhopSDK::Currency }

#durationSymbol, ...

The duration setting for the promo code

Returns:



53
# File 'lib/whop_sdk/models/promo_code.rb', line 53

required :duration, enum: -> { WhopSDK::PromoDuration }, nil?: true

#existing_memberships_onlyBoolean

Restricts promo use to only be applied to already purchased memberships.

Returns:

  • (Boolean)


59
# File 'lib/whop_sdk/models/promo_code.rb', line 59

required :existing_memberships_only, WhopSDK::Internal::Type::Boolean

#expires_atTime?

The date/time of when the promo expires.

Returns:

  • (Time, nil)


65
# File 'lib/whop_sdk/models/promo_code.rb', line 65

required :expires_at, Time, nil?: true

#idString

The ID of the promo.

Returns:

  • (String)


11
# File 'lib/whop_sdk/models/promo_code.rb', line 11

required :id, String

#new_users_onlyBoolean

Restricts promo use to only users who have never purchased from the company before.

Returns:

  • (Boolean)


72
# File 'lib/whop_sdk/models/promo_code.rb', line 72

required :new_users_only, WhopSDK::Internal::Type::Boolean

#one_per_customerBoolean

Restricts promo use to only be applied once per customer.

Returns:

  • (Boolean)


78
# File 'lib/whop_sdk/models/promo_code.rb', line 78

required :one_per_customer, WhopSDK::Internal::Type::Boolean

#productWhopSDK::Models::PromoCode::Product?

The access pass associated with the promo code.



84
# File 'lib/whop_sdk/models/promo_code.rb', line 84

required :product, -> { WhopSDK::PromoCode::Product }, nil?: true

#promo_duration_monthsInteger?

The number of months the promo is applied for.

Returns:

  • (Integer, nil)


90
# File 'lib/whop_sdk/models/promo_code.rb', line 90

required :promo_duration_months, Integer, nil?: true

#promo_typeSymbol, WhopSDK::Models::PromoType

The type (% or flat amount) of the promo.

Returns:



96
# File 'lib/whop_sdk/models/promo_code.rb', line 96

required :promo_type, enum: -> { WhopSDK::PromoType }

#statusSymbol, WhopSDK::Models::PromoCodeStatus

Indicates if the promo code is live or disabled.



102
# File 'lib/whop_sdk/models/promo_code.rb', line 102

required :status, enum: -> { WhopSDK::PromoCodeStatus }

#stockInteger

The quantity limit on the number of uses.

Returns:

  • (Integer)


108
# File 'lib/whop_sdk/models/promo_code.rb', line 108

required :stock, Integer

#unlimited_stockBoolean

Whether or not the promo code has unlimited stock.

Returns:

  • (Boolean)


114
# File 'lib/whop_sdk/models/promo_code.rb', line 114

required :unlimited_stock, WhopSDK::Internal::Type::Boolean

#usesInteger

The amount of times the promo codes has been used.

Returns:

  • (Integer)


120
# File 'lib/whop_sdk/models/promo_code.rb', line 120

required :uses, Integer