Class: Bfwd::Coupon
- Inherits:
-
Object
- Object
- Bfwd::Coupon
- Defined in:
- lib/bf_ruby2/models/coupon.rb
Overview
<p>A coupon allows the customer to apply one or more discounts to a subscription.A coupon can be used to generate coupon codes which can then be added or removed from subscription.</p>
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#applies_to ⇒ Object
{ "description" : "For unique coupon codes this is what the coupon applies to, usually subscription.", "verbs“: }.
-
#applies_to_id ⇒ Object
{ "description" : "For a coupon added to a subscription this is the the ID of the subscription. This can be used to remove the coupon from the target.", "verbs“: }.
-
#changed_by ⇒ Object
{ "description" : "ID of the user who last updated the entity.", "verbs":[] }.
-
#coupon_code ⇒ Object
{ "description" : "Code used to identify this set of coupons. If unique codes are required this will be used as the prefix to generate individual coupon codes. When a unique code is returned the original couponCode is returned in the parentCouponCode property. For example a single coupon code SUMMER maybe be issued at an event to encourage sign-up, the same code can be redeemed by multiple accounts. In another example you may want to issue unique coupon codes per a customer, for example SUMMER-A4FC, SUMMER-BCQ4, each code can only be calimed once.", "verbs“: }.
-
#coupons ⇒ Object
{ "default" : "∞", "description" : "Number of times the coupon can be claimed. In the case of generating unique coupon codes this is the maximum quantity that can be genereated. For example set this value to 10 if you want to limit the total number of subscriptions that will use this code to 10.", "verbs“: }.
-
#created ⇒ Object
{ "description" : "The UTC DateTime when the object was created.", "verbs":[] }.
-
#currency ⇒ Object
{ "description" : "If the coupon is not for a specific rate-plan, and can apply to any subscription, the currency should be provivded. Currency is specified by a three character ISO 4217 currency code.", "verbs“: }.
-
#deleted ⇒ Object
{ "description" : "If a coupon has been deleted, any subsequent attempts to add it to a subscription will fail. Note: This will not affect existing subscription using the coupon. Please see deleting a coupon for more details", "verbs“: }.
-
#discount_value ⇒ Object
Returns the value of attribute discount_value.
-
#discounts ⇒ Object
{ "description" : "For each discount item on the coupon, only one discount type should be set between cashDiscount, percentageDiscount and unitsFree. cashDiscount gives a fixed monetary discount, for example $10.00. percentageDiscount gives a percentage discount on the overall invoice cost. unitsFree discounts the pricing by the number of units specified for that component. All discounts are applied against the base cost or units. Discounts are not compound. Discounts will never exceed the value of a pricing component of the overall invoice - thus at most the discount will reduce the cost to zero. If no pricing component is specified the discount will apply to the total invoice cost.", "verbs“: }.
-
#name ⇒ Object
{ "description" : "", "verbs“: }.
-
#organization_id ⇒ Object
Returns the value of attribute organization_id.
-
#parent_coupon_code ⇒ Object
{ "description" : "For unique coupon codes this is the original coupon code, for example SUMMER", "verbs“: }.
-
#parent_coupon_code_redeemable ⇒ Object
{ "default" : "true", "description" : "If true the coupon without postfix can be added to a subscription, for example if parentCouponCodeRedeemable is true and the coupon was created with code SUMMER customers could claim using SUMMER. If parentCouponCodeRedeemable is false then only unique coupon codes can be claimed, for example SUMMER-AB4C, SUMMER-YZB4.", "verbs“: }.
-
#product ⇒ Object
{ "description" : "Name or ID of the product this coupon applies to. Requires a specific rate-plan to be set.", "verbs“: }.
-
#product_id ⇒ Object
{ "description" : "", "verbs“: }.
-
#product_name ⇒ Object
{ "description" : "", "verbs“: }.
-
#product_rate_plan ⇒ Object
{ "description" : "Name or ID of the rate-plan this coupon applies to. ", "verbs“: }.
-
#product_rate_plan_id ⇒ Object
{ "description" : "", "verbs“: }.
-
#product_rate_plan_name ⇒ Object
{ "description" : "", "verbs“: }.
-
#remaining_uses ⇒ Object
{ "description" : "", "verbs“: }.
-
#updated ⇒ Object
{ "description" : "The UTC DateTime when the object was last updated.", "verbs":[] }.
-
#used ⇒ Object
{ "description" : "", "verbs“: }.
-
#uses ⇒ Object
{ "default" : "∞", "description" : "This specifies how many times a discount will be added to a subscription once the coupon is added. For example if the uses is set to 3 it will discount 3 times, set this to a large number, for example 9999999, to give infinite applications, .", "verbs“: }.
-
#valid_until ⇒ Object
{ "description" : "If the coupon was removed from the subscription this is the date and time from when it no ceased to be applied.", "verbs“: }.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Coupon
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Coupon
Initializes the object
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/bf_ruby2/models/coupon.rb', line 177 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} if attributes.has_key?(:'created') self.created = attributes[:'created'] end if attributes.has_key?(:'changedBy') self.changed_by = attributes[:'changedBy'] end if attributes.has_key?(:'updated') self.updated = attributes[:'updated'] end if attributes.has_key?(:'name') self.name = attributes[:'name'] end if attributes.has_key?(:'couponCode') self.coupon_code = attributes[:'couponCode'] end if attributes.has_key?(:'coupons') self.coupons = attributes[:'coupons'] end if attributes.has_key?(:'uses') self.uses = attributes[:'uses'] end if attributes.has_key?(:'product') self.product = attributes[:'product'] end if attributes.has_key?(:'productName') self.product_name = attributes[:'productName'] end if attributes.has_key?(:'productID') self.product_id = attributes[:'productID'] end if attributes.has_key?(:'productRatePlan') self.product_rate_plan = attributes[:'productRatePlan'] end if attributes.has_key?(:'productRatePlanName') self.product_rate_plan_name = attributes[:'productRatePlanName'] end if attributes.has_key?(:'productRatePlanID') self.product_rate_plan_id = attributes[:'productRatePlanID'] end if attributes.has_key?(:'currency') self.currency = attributes[:'currency'] end if attributes.has_key?(:'parentCouponCodeRedeemable') self.parent_coupon_code_redeemable = attributes[:'parentCouponCodeRedeemable'] else self.parent_coupon_code_redeemable = false end if attributes.has_key?(:'organizationID') self.organization_id = attributes[:'organizationID'] end if attributes.has_key?(:'discounts') if (value = attributes[:'discounts']).is_a?(Array) self.discounts = value end end if attributes.has_key?(:'deleted') self.deleted = attributes[:'deleted'] else self.deleted = false end if attributes.has_key?(:'parentCouponCode') self.parent_coupon_code = attributes[:'parentCouponCode'] end if attributes.has_key?(:'appliesTo') self.applies_to = attributes[:'appliesTo'] end if attributes.has_key?(:'appliesToID') self.applies_to_id = attributes[:'appliesToID'] end if attributes.has_key?(:'remainingUses') self.remaining_uses = attributes[:'remainingUses'] end if attributes.has_key?(:'used') self.used = attributes[:'used'] end if attributes.has_key?(:'discountValue') self.discount_value = attributes[:'discountValue'] end if attributes.has_key?(:'validUntil') self.valid_until = attributes[:'validUntil'] end end |
Instance Attribute Details
#applies_to ⇒ Object
{ "description" : "For unique coupon codes this is what the coupon applies to, usually subscription.", "verbs“: }
75 76 77 |
# File 'lib/bf_ruby2/models/coupon.rb', line 75 def applies_to @applies_to end |
#applies_to_id ⇒ Object
{ "description" : "For a coupon added to a subscription this is the the ID of the subscription. This can be used to remove the coupon from the target.", "verbs“: }
78 79 80 |
# File 'lib/bf_ruby2/models/coupon.rb', line 78 def applies_to_id @applies_to_id end |
#changed_by ⇒ Object
{ "description" : "ID of the user who last updated the entity.", "verbs":[] }
22 23 24 |
# File 'lib/bf_ruby2/models/coupon.rb', line 22 def changed_by @changed_by end |
#coupon_code ⇒ Object
{ "description" : "Code used to identify this set of coupons. If unique codes are required this will be used as the prefix to generate individual coupon codes. When a unique code is returned the original couponCode is returned in the parentCouponCode property. For example a single coupon code SUMMER maybe be issued at an event to encourage sign-up, the same code can be redeemed by multiple accounts. In another example you may want to issue unique coupon codes per a customer, for example SUMMER-A4FC, SUMMER-BCQ4, each code can only be calimed once.", "verbs“: }
31 32 33 |
# File 'lib/bf_ruby2/models/coupon.rb', line 31 def coupon_code @coupon_code end |
#coupons ⇒ Object
{ "default" : "∞", "description" : "Number of times the coupon can be claimed. In the case of generating unique coupon codes this is the maximum quantity that can be genereated. For example set this value to 10 if you want to limit the total number of subscriptions that will use this code to 10.", "verbs“: }
34 35 36 |
# File 'lib/bf_ruby2/models/coupon.rb', line 34 def coupons @coupons end |
#created ⇒ Object
{ "description" : "The UTC DateTime when the object was created.", "verbs":[] }
19 20 21 |
# File 'lib/bf_ruby2/models/coupon.rb', line 19 def created @created end |
#currency ⇒ Object
{ "description" : "If the coupon is not for a specific rate-plan, and can apply to any subscription, the currency should be provivded. Currency is specified by a three character ISO 4217 currency code.", "verbs“: }
58 59 60 |
# File 'lib/bf_ruby2/models/coupon.rb', line 58 def currency @currency end |
#deleted ⇒ Object
{ "description" : "If a coupon has been deleted, any subsequent attempts to add it to a subscription will fail. Note: This will not affect existing subscription using the coupon. Please see deleting a coupon for more details", "verbs“: }
69 70 71 |
# File 'lib/bf_ruby2/models/coupon.rb', line 69 def deleted @deleted end |
#discount_value ⇒ Object
Returns the value of attribute discount_value.
86 87 88 |
# File 'lib/bf_ruby2/models/coupon.rb', line 86 def discount_value @discount_value end |
#discounts ⇒ Object
{ "description" : "For each discount item on the coupon, only one discount type should be set between cashDiscount, percentageDiscount and unitsFree. cashDiscount gives a fixed monetary discount, for example $10.00. percentageDiscount gives a percentage discount on the overall invoice cost. unitsFree discounts the pricing by the number of units specified for that component. All discounts are applied against the base cost or units. Discounts are not compound. Discounts will never exceed the value of a pricing component of the overall invoice - thus at most the discount will reduce the cost to zero. If no pricing component is specified the discount will apply to the total invoice cost.", "verbs“: }
66 67 68 |
# File 'lib/bf_ruby2/models/coupon.rb', line 66 def discounts @discounts end |
#name ⇒ Object
{ "description" : "", "verbs“: }
28 29 30 |
# File 'lib/bf_ruby2/models/coupon.rb', line 28 def name @name end |
#organization_id ⇒ Object
Returns the value of attribute organization_id.
63 64 65 |
# File 'lib/bf_ruby2/models/coupon.rb', line 63 def organization_id @organization_id end |
#parent_coupon_code ⇒ Object
{ "description" : "For unique coupon codes this is the original coupon code, for example SUMMER", "verbs“: }
72 73 74 |
# File 'lib/bf_ruby2/models/coupon.rb', line 72 def parent_coupon_code @parent_coupon_code end |
#parent_coupon_code_redeemable ⇒ Object
{ "default" : "true", "description" : "If true the coupon without postfix can be added to a subscription, for example if parentCouponCodeRedeemable is true and the coupon was created with code SUMMER customers could claim using SUMMER. If parentCouponCodeRedeemable is false then only unique coupon codes can be claimed, for example SUMMER-AB4C, SUMMER-YZB4.", "verbs“: }
61 62 63 |
# File 'lib/bf_ruby2/models/coupon.rb', line 61 def parent_coupon_code_redeemable @parent_coupon_code_redeemable end |
#product ⇒ Object
{ "description" : "Name or ID of the product this coupon applies to. Requires a specific rate-plan to be set.", "verbs“: }
40 41 42 |
# File 'lib/bf_ruby2/models/coupon.rb', line 40 def product @product end |
#product_id ⇒ Object
{ "description" : "", "verbs“: }
46 47 48 |
# File 'lib/bf_ruby2/models/coupon.rb', line 46 def product_id @product_id end |
#product_name ⇒ Object
{ "description" : "", "verbs“: }
43 44 45 |
# File 'lib/bf_ruby2/models/coupon.rb', line 43 def product_name @product_name end |
#product_rate_plan ⇒ Object
{ "description" : "Name or ID of the rate-plan this coupon applies to. ", "verbs“: }
49 50 51 |
# File 'lib/bf_ruby2/models/coupon.rb', line 49 def product_rate_plan @product_rate_plan end |
#product_rate_plan_id ⇒ Object
{ "description" : "", "verbs“: }
55 56 57 |
# File 'lib/bf_ruby2/models/coupon.rb', line 55 def product_rate_plan_id @product_rate_plan_id end |
#product_rate_plan_name ⇒ Object
{ "description" : "", "verbs“: }
52 53 54 |
# File 'lib/bf_ruby2/models/coupon.rb', line 52 def product_rate_plan_name @product_rate_plan_name end |
#remaining_uses ⇒ Object
{ "description" : "", "verbs“: }
81 82 83 |
# File 'lib/bf_ruby2/models/coupon.rb', line 81 def remaining_uses @remaining_uses end |
#updated ⇒ Object
{ "description" : "The UTC DateTime when the object was last updated.", "verbs":[] }
25 26 27 |
# File 'lib/bf_ruby2/models/coupon.rb', line 25 def updated @updated end |
#used ⇒ Object
{ "description" : "", "verbs“: }
84 85 86 |
# File 'lib/bf_ruby2/models/coupon.rb', line 84 def used @used end |
#uses ⇒ Object
{ "default" : "∞", "description" : "This specifies how many times a discount will be added to a subscription once the coupon is added. For example if the uses is set to 3 it will discount 3 times, set this to a large number, for example 9999999, to give infinite applications, .", "verbs“: }
37 38 39 |
# File 'lib/bf_ruby2/models/coupon.rb', line 37 def uses @uses end |
#valid_until ⇒ Object
{ "description" : "If the coupon was removed from the subscription this is the date and time from when it no ceased to be applied.", "verbs“: }
89 90 91 |
# File 'lib/bf_ruby2/models/coupon.rb', line 89 def valid_until @valid_until end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/bf_ruby2/models/coupon.rb', line 114 def self.attribute_map { :'created' => :'created', :'changed_by' => :'changedBy', :'updated' => :'updated', :'name' => :'name', :'coupon_code' => :'couponCode', :'coupons' => :'coupons', :'uses' => :'uses', :'product' => :'product', :'product_name' => :'productName', :'product_id' => :'productID', :'product_rate_plan' => :'productRatePlan', :'product_rate_plan_name' => :'productRatePlanName', :'product_rate_plan_id' => :'productRatePlanID', :'currency' => :'currency', :'parent_coupon_code_redeemable' => :'parentCouponCodeRedeemable', :'organization_id' => :'organizationID', :'discounts' => :'discounts', :'deleted' => :'deleted', :'parent_coupon_code' => :'parentCouponCode', :'applies_to' => :'appliesTo', :'applies_to_id' => :'appliesToID', :'remaining_uses' => :'remainingUses', :'used' => :'used', :'discount_value' => :'discountValue', :'valid_until' => :'validUntil' } end |
.swagger_types ⇒ Object
Attribute type mapping.
145 146 147 148 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 |
# File 'lib/bf_ruby2/models/coupon.rb', line 145 def self.swagger_types { :'created' => :'DateTime', :'changed_by' => :'String', :'updated' => :'DateTime', :'name' => :'String', :'coupon_code' => :'String', :'coupons' => :'Integer', :'uses' => :'Integer', :'product' => :'String', :'product_name' => :'String', :'product_id' => :'String', :'product_rate_plan' => :'String', :'product_rate_plan_name' => :'String', :'product_rate_plan_id' => :'String', :'currency' => :'String', :'parent_coupon_code_redeemable' => :'BOOLEAN', :'organization_id' => :'String', :'discounts' => :'Array<CouponDiscount>', :'deleted' => :'BOOLEAN', :'parent_coupon_code' => :'String', :'applies_to' => :'String', :'applies_to_id' => :'String', :'remaining_uses' => :'Integer', :'used' => :'Integer', :'discount_value' => :'Float', :'valid_until' => :'DateTime' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 |
# File 'lib/bf_ruby2/models/coupon.rb', line 353 def ==(o) return true if self.equal?(o) self.class == o.class && created == o.created && changed_by == o.changed_by && updated == o.updated && name == o.name && coupon_code == o.coupon_code && coupons == o.coupons && uses == o.uses && product == o.product && product_name == o.product_name && product_id == o.product_id && product_rate_plan == o.product_rate_plan && product_rate_plan_name == o.product_rate_plan_name && product_rate_plan_id == o.product_rate_plan_id && currency == o.currency && parent_coupon_code_redeemable == o.parent_coupon_code_redeemable && organization_id == o.organization_id && discounts == o.discounts && deleted == o.deleted && parent_coupon_code == o.parent_coupon_code && applies_to == o.applies_to && applies_to_id == o.applies_to_id && remaining_uses == o.remaining_uses && used == o.used && discount_value == o.discount_value && valid_until == o.valid_until end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 |
# File 'lib/bf_ruby2/models/coupon.rb', line 419 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = Bfwd.const_get(type).new temp_model.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
485 486 487 488 489 490 491 492 493 494 495 496 497 |
# File 'lib/bf_ruby2/models/coupon.rb', line 485 def _to_hash(value) if value.is_a?(Array) value.compact.map{ |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
# File 'lib/bf_ruby2/models/coupon.rb', line 398 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
385 386 387 |
# File 'lib/bf_ruby2/models/coupon.rb', line 385 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
391 392 393 |
# File 'lib/bf_ruby2/models/coupon.rb', line 391 def hash [created, changed_by, updated, name, coupon_code, coupons, uses, product, product_name, product_id, product_rate_plan, product_rate_plan_name, product_rate_plan_id, currency, parent_coupon_code_redeemable, organization_id, discounts, deleted, parent_coupon_code, applies_to, applies_to_id, remaining_uses, used, discount_value, valid_until].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
# File 'lib/bf_ruby2/models/coupon.rb', line 293 def list_invalid_properties invalid_properties = Array.new if @name.nil? invalid_properties.push("invalid value for 'name', name cannot be nil.") end if @coupon_code.nil? invalid_properties.push("invalid value for 'coupon_code', coupon_code cannot be nil.") end if @coupons.nil? invalid_properties.push("invalid value for 'coupons', coupons cannot be nil.") end if @uses.nil? invalid_properties.push("invalid value for 'uses', uses cannot be nil.") end if @parent_coupon_code_redeemable.nil? invalid_properties.push("invalid value for 'parent_coupon_code_redeemable', parent_coupon_code_redeemable cannot be nil.") end if @organization_id.nil? invalid_properties.push("invalid value for 'organization_id', organization_id cannot be nil.") end if @discounts.nil? invalid_properties.push("invalid value for 'discounts', discounts cannot be nil.") end return invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
465 466 467 |
# File 'lib/bf_ruby2/models/coupon.rb', line 465 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
471 472 473 474 475 476 477 478 479 |
# File 'lib/bf_ruby2/models/coupon.rb', line 471 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
459 460 461 |
# File 'lib/bf_ruby2/models/coupon.rb', line 459 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
328 329 330 331 332 333 334 335 336 337 338 339 |
# File 'lib/bf_ruby2/models/coupon.rb', line 328 def valid? return false if @name.nil? return false if @coupon_code.nil? return false if @coupons.nil? return false if @uses.nil? return false if @parent_coupon_code_redeemable.nil? return false if @organization_id.nil? return false if @discounts.nil? applies_to_validator = EnumAttributeValidator.new('String', ["none", "subscription", "account"]) return false unless applies_to_validator.valid?(@applies_to) return true end |