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)

    The unique identifier for the company.

  • title (String)

    The written name of the company.



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

Instance Attribute Details

#amount_offFloat

The discount amount. Interpretation depends on promo_type: if ‘percentage’, this is the percentage (e.g., 20 means 20% off); if ‘flat_amount’, this is dollars off (e.g., 10.00 means $10.00 off).

Returns:

  • (Float)


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

required :amount_off, Float

#churned_users_onlyBoolean

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

Returns:

  • (Boolean)


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

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

#codeString?

The specific code used to apply the promo at checkout.

Returns:

  • (String, nil)


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

required :code, String, nil?: true

#companyWhopSDK::Models::PromoCode::Company

The company for the promo code.



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

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

#created_atTime

The datetime the promo code was created.

Returns:

  • (Time)


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

required :created_at, Time

#currencySymbol, WhopSDK::Models::Currency

The monetary currency of the promo code.

Returns:



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

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

#durationSymbol, ...

The duration setting for the promo code

Returns:



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

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

#existing_memberships_onlyBoolean

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

Returns:

  • (Boolean)


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

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

#expires_atTime?

The date/time of when the promo expires.

Returns:

  • (Time, nil)


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

required :expires_at, Time, nil?: true

#idString

The unique identifier for the promo code.

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)


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

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

#one_per_customerBoolean

Restricts promo use to only be applied once per customer.

Returns:

  • (Boolean)


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

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

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

The product this promo code applies to



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

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

#promo_duration_monthsInteger?

The number of months the promo is applied for.

Returns:

  • (Integer, nil)


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

required :promo_duration_months, Integer, nil?: true

#promo_typeSymbol, WhopSDK::Models::PromoType

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

Returns:



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

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

#statusSymbol, WhopSDK::Models::PromoCodeStatus

Indicates if the promo code is live or disabled.



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

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

#stockInteger

The quantity limit on the number of uses.

Returns:

  • (Integer)


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

required :stock, Integer

#unlimited_stockBoolean

Whether or not the promo code has unlimited stock.

Returns:

  • (Boolean)


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

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

#usesInteger

The amount of times the promo codes has been used.

Returns:

  • (Integer)


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

required :uses, Integer