Class: AdvancedBilling::CreateOrUpdateFlatAmountCoupon
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::CreateOrUpdateFlatAmountCoupon
- Defined in:
- lib/advanced_billing/models/create_or_update_flat_amount_coupon.rb
Overview
CreateOrUpdateFlatAmountCoupon Model.
Instance Attribute Summary collapse
-
#allow_negative_balance ⇒ String
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”.
-
#amount_in_cents ⇒ Integer
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”.
-
#apply_on_cancel_at_end_of_period ⇒ TrueClass | FalseClass
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”.
-
#code ⇒ String
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”.
-
#compounding_strategy ⇒ CompoundingStrategy
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”.
-
#description ⇒ String
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”.
-
#end_date ⇒ String
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”.
-
#exclude_mid_period_allocations ⇒ TrueClass | FalseClass
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”.
-
#name ⇒ String
the name of the coupon.
-
#product_family_id ⇒ String
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”.
-
#recurring ⇒ String
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”.
-
#stackable ⇒ String
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(name = nil, code = nil, amount_in_cents = nil, description = SKIP, allow_negative_balance = SKIP, recurring = SKIP, end_date = SKIP, product_family_id = SKIP, stackable = SKIP, compounding_strategy = SKIP, exclude_mid_period_allocations = SKIP, apply_on_cancel_at_end_of_period = SKIP) ⇒ CreateOrUpdateFlatAmountCoupon
constructor
A new instance of CreateOrUpdateFlatAmountCoupon.
Methods inherited from BaseModel
Constructor Details
#initialize(name = nil, code = nil, amount_in_cents = nil, description = SKIP, allow_negative_balance = SKIP, recurring = SKIP, end_date = SKIP, product_family_id = SKIP, stackable = SKIP, compounding_strategy = SKIP, exclude_mid_period_allocations = SKIP, apply_on_cancel_at_end_of_period = SKIP) ⇒ CreateOrUpdateFlatAmountCoupon
Returns a new instance of CreateOrUpdateFlatAmountCoupon.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/advanced_billing/models/create_or_update_flat_amount_coupon.rb', line 122 def initialize(name = nil, code = nil, amount_in_cents = nil, description = SKIP, allow_negative_balance = SKIP, recurring = SKIP, end_date = SKIP, product_family_id = SKIP, stackable = SKIP, compounding_strategy = SKIP, exclude_mid_period_allocations = SKIP, apply_on_cancel_at_end_of_period = SKIP) @name = name @code = code @description = description unless description == SKIP @amount_in_cents = amount_in_cents @allow_negative_balance = allow_negative_balance unless allow_negative_balance == SKIP @recurring = recurring unless recurring == SKIP @end_date = end_date unless end_date == SKIP @product_family_id = product_family_id unless product_family_id == SKIP @stackable = stackable unless stackable == SKIP @compounding_strategy = compounding_strategy unless compounding_strategy == SKIP unless exclude_mid_period_allocations == SKIP @exclude_mid_period_allocations = exclude_mid_period_allocations end unless apply_on_cancel_at_end_of_period == SKIP @apply_on_cancel_at_end_of_period = apply_on_cancel_at_end_of_period end end |
Instance Attribute Details
#allow_negative_balance ⇒ String
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”
38 39 40 |
# File 'lib/advanced_billing/models/create_or_update_flat_amount_coupon.rb', line 38 def allow_negative_balance @allow_negative_balance end |
#amount_in_cents ⇒ Integer
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”
32 33 34 |
# File 'lib/advanced_billing/models/create_or_update_flat_amount_coupon.rb', line 32 def amount_in_cents @amount_in_cents end |
#apply_on_cancel_at_end_of_period ⇒ TrueClass | FalseClass
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”
80 81 82 |
# File 'lib/advanced_billing/models/create_or_update_flat_amount_coupon.rb', line 80 def apply_on_cancel_at_end_of_period @apply_on_cancel_at_end_of_period end |
#code ⇒ String
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”
20 21 22 |
# File 'lib/advanced_billing/models/create_or_update_flat_amount_coupon.rb', line 20 def code @code end |
#compounding_strategy ⇒ CompoundingStrategy
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”
68 69 70 |
# File 'lib/advanced_billing/models/create_or_update_flat_amount_coupon.rb', line 68 def compounding_strategy @compounding_strategy end |
#description ⇒ String
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”
26 27 28 |
# File 'lib/advanced_billing/models/create_or_update_flat_amount_coupon.rb', line 26 def description @description end |
#end_date ⇒ String
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”
50 51 52 |
# File 'lib/advanced_billing/models/create_or_update_flat_amount_coupon.rb', line 50 def end_date @end_date end |
#exclude_mid_period_allocations ⇒ TrueClass | FalseClass
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”
74 75 76 |
# File 'lib/advanced_billing/models/create_or_update_flat_amount_coupon.rb', line 74 def exclude_mid_period_allocations @exclude_mid_period_allocations end |
#name ⇒ String
the name of the coupon
14 15 16 |
# File 'lib/advanced_billing/models/create_or_update_flat_amount_coupon.rb', line 14 def name @name end |
#product_family_id ⇒ String
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”
56 57 58 |
# File 'lib/advanced_billing/models/create_or_update_flat_amount_coupon.rb', line 56 def product_family_id @product_family_id end |
#recurring ⇒ String
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”
44 45 46 |
# File 'lib/advanced_billing/models/create_or_update_flat_amount_coupon.rb', line 44 def recurring @recurring end |
#stackable ⇒ String
may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”
62 63 64 |
# File 'lib/advanced_billing/models/create_or_update_flat_amount_coupon.rb', line 62 def stackable @stackable end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/advanced_billing/models/create_or_update_flat_amount_coupon.rb', line 149 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : nil code = hash.key?('code') ? hash['code'] : nil amount_in_cents = hash.key?('amount_in_cents') ? hash['amount_in_cents'] : nil description = hash.key?('description') ? hash['description'] : SKIP allow_negative_balance = hash.key?('allow_negative_balance') ? hash['allow_negative_balance'] : SKIP recurring = hash.key?('recurring') ? hash['recurring'] : SKIP end_date = hash.key?('end_date') ? hash['end_date'] : SKIP product_family_id = hash.key?('product_family_id') ? hash['product_family_id'] : SKIP stackable = hash.key?('stackable') ? hash['stackable'] : SKIP compounding_strategy = hash.key?('compounding_strategy') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CreateOrUpdateFlatAmountCouponCompoundingStrategy), hash['compounding_strategy'] ) : SKIP exclude_mid_period_allocations = hash.key?('exclude_mid_period_allocations') ? hash['exclude_mid_period_allocations'] : SKIP apply_on_cancel_at_end_of_period = hash.key?('apply_on_cancel_at_end_of_period') ? hash['apply_on_cancel_at_end_of_period'] : SKIP # Create object from extracted values. CreateOrUpdateFlatAmountCoupon.new(name, code, amount_in_cents, description, allow_negative_balance, recurring, end_date, product_family_id, stackable, compounding_strategy, exclude_mid_period_allocations, apply_on_cancel_at_end_of_period) end |
.names ⇒ Object
A mapping from model property names to API property names.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/advanced_billing/models/create_or_update_flat_amount_coupon.rb', line 83 def self.names @_hash = {} if @_hash.nil? @_hash['name'] = 'name' @_hash['code'] = 'code' @_hash['description'] = 'description' @_hash['amount_in_cents'] = 'amount_in_cents' @_hash['allow_negative_balance'] = 'allow_negative_balance' @_hash['recurring'] = 'recurring' @_hash['end_date'] = 'end_date' @_hash['product_family_id'] = 'product_family_id' @_hash['stackable'] = 'stackable' @_hash['compounding_strategy'] = 'compounding_strategy' @_hash['exclude_mid_period_allocations'] = 'exclude_mid_period_allocations' @_hash['apply_on_cancel_at_end_of_period'] = 'apply_on_cancel_at_end_of_period' @_hash end |
.nullables ⇒ Object
An array for nullable fields
118 119 120 |
# File 'lib/advanced_billing/models/create_or_update_flat_amount_coupon.rb', line 118 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/advanced_billing/models/create_or_update_flat_amount_coupon.rb', line 103 def self.optionals %w[ description allow_negative_balance recurring end_date product_family_id stackable compounding_strategy exclude_mid_period_allocations apply_on_cancel_at_end_of_period ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/advanced_billing/models/create_or_update_flat_amount_coupon.rb', line 190 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.name, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.code, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.amount_in_cents, ->(val) { val.instance_of? Integer }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['name'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['code'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['amount_in_cents'], ->(val) { val.instance_of? Integer }) ) end |