Class: Stripe::PromotionCodeService::CreateParams

Inherits:
RequestParams
  • Object
show all
Defined in:
lib/stripe/services/promotion_code_service.rb

Defined Under Namespace

Classes: Restrictions

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RequestParams

#to_h

Constructor Details

#initialize(active: nil, code: nil, coupon: nil, customer: nil, expand: nil, expires_at: nil, max_redemptions: nil, metadata: nil, restrictions: nil) ⇒ CreateParams

Returns a new instance of CreateParams.



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/stripe/services/promotion_code_service.rb', line 118

def initialize(
  active: nil,
  code: nil,
  coupon: nil,
  customer: nil,
  expand: nil,
  expires_at: nil,
  max_redemptions: nil,
  metadata: nil,
  restrictions: nil
)
  @active = active
  @code = code
  @coupon = coupon
  @customer = customer
  @expand = expand
  @expires_at = expires_at
  @max_redemptions = max_redemptions
  @metadata = 
  @restrictions = restrictions
end

Instance Attribute Details

#activeObject

Whether the promotion code is currently active.



98
99
100
# File 'lib/stripe/services/promotion_code_service.rb', line 98

def active
  @active
end

#codeObject

The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for a specific customer. Valid characters are lower case letters (a-z), upper case letters (A-Z), and digits (0-9).

If left blank, we will generate one automatically.



102
103
104
# File 'lib/stripe/services/promotion_code_service.rb', line 102

def code
  @code
end

#couponObject

The coupon for this promotion code.



104
105
106
# File 'lib/stripe/services/promotion_code_service.rb', line 104

def coupon
  @coupon
end

#customerObject

The customer that this promotion code can be used by. If not set, the promotion code can be used by all customers.



106
107
108
# File 'lib/stripe/services/promotion_code_service.rb', line 106

def customer
  @customer
end

#expandObject

Specifies which fields in the response should be expanded.



108
109
110
# File 'lib/stripe/services/promotion_code_service.rb', line 108

def expand
  @expand
end

#expires_atObject

The timestamp at which this promotion code will expire. If the coupon has specified a ‘redeems_by`, then this value cannot be after the coupon’s ‘redeems_by`.



110
111
112
# File 'lib/stripe/services/promotion_code_service.rb', line 110

def expires_at
  @expires_at
end

#max_redemptionsObject

A positive integer specifying the number of times the promotion code can be redeemed. If the coupon has specified a ‘max_redemptions`, then this value cannot be greater than the coupon’s ‘max_redemptions`.



112
113
114
# File 'lib/stripe/services/promotion_code_service.rb', line 112

def max_redemptions
  @max_redemptions
end

#metadataObject

Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to ‘metadata`.



114
115
116
# File 'lib/stripe/services/promotion_code_service.rb', line 114

def 
  @metadata
end

#restrictionsObject

Settings that restrict the redemption of the promotion code.



116
117
118
# File 'lib/stripe/services/promotion_code_service.rb', line 116

def restrictions
  @restrictions
end