Class: AdvancedBilling::CreateInvoiceCoupon
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::CreateInvoiceCoupon
- Defined in:
- lib/advanced_billing/models/create_invoice_coupon.rb
Overview
CreateInvoiceCoupon Model.
Instance Attribute Summary collapse
-
#amount ⇒ Object
TODO: Write general description for this method.
-
#code ⇒ String
TODO: Write general description for this method.
-
#compounding_strategy ⇒ CompoundingStrategy
TODO: Write general description for this method.
-
#description ⇒ String
TODO: Write general description for this method.
-
#percentage ⇒ Object
TODO: Write general description for this method.
-
#product_family_id ⇒ Object
TODO: Write general description for this method.
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(code: SKIP, percentage: SKIP, amount: SKIP, description: SKIP, product_family_id: SKIP, compounding_strategy: SKIP, additional_properties: {}) ⇒ CreateInvoiceCoupon
constructor
A new instance of CreateInvoiceCoupon.
Methods inherited from BaseModel
Constructor Details
#initialize(code: SKIP, percentage: SKIP, amount: SKIP, description: SKIP, product_family_id: SKIP, compounding_strategy: SKIP, additional_properties: {}) ⇒ CreateInvoiceCoupon
Returns a new instance of CreateInvoiceCoupon.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/advanced_billing/models/create_invoice_coupon.rb', line 65 def initialize(code: SKIP, percentage: SKIP, amount: SKIP, description: SKIP, product_family_id: SKIP, compounding_strategy: SKIP, additional_properties: {}) @code = code unless code == SKIP @percentage = percentage unless percentage == SKIP @amount = amount unless amount == SKIP @description = description unless description == SKIP @product_family_id = product_family_id unless product_family_id == SKIP @compounding_strategy = compounding_strategy unless compounding_strategy == SKIP # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#amount ⇒ Object
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/create_invoice_coupon.rb', line 22 def amount @amount end |
#code ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/create_invoice_coupon.rb', line 14 def code @code end |
#compounding_strategy ⇒ CompoundingStrategy
TODO: Write general description for this method
34 35 36 |
# File 'lib/advanced_billing/models/create_invoice_coupon.rb', line 34 def compounding_strategy @compounding_strategy end |
#description ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/create_invoice_coupon.rb', line 26 def description @description end |
#percentage ⇒ Object
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/create_invoice_coupon.rb', line 18 def percentage @percentage end |
#product_family_id ⇒ Object
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/create_invoice_coupon.rb', line 30 def product_family_id @product_family_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/advanced_billing/models/create_invoice_coupon.rb', line 82 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. code = hash.key?('code') ? hash['code'] : SKIP percentage = hash.key?('percentage') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CreateInvoiceCouponPercentage), hash['percentage'] ) : SKIP amount = hash.key?('amount') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CreateInvoiceCouponAmount), hash['amount'] ) : SKIP description = hash.key?('description') ? hash['description'] : SKIP product_family_id = hash.key?('product_family_id') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CreateInvoiceCouponProductFamilyId), hash['product_family_id'] ) : SKIP compounding_strategy = hash.key?('compounding_strategy') ? hash['compounding_strategy'] : SKIP # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. CreateInvoiceCoupon.new(code: code, percentage: percentage, amount: amount, description: description, product_family_id: product_family_id, compounding_strategy: compounding_strategy, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/advanced_billing/models/create_invoice_coupon.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['code'] = 'code' @_hash['percentage'] = 'percentage' @_hash['amount'] = 'amount' @_hash['description'] = 'description' @_hash['product_family_id'] = 'product_family_id' @_hash['compounding_strategy'] = 'compounding_strategy' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 |
# File 'lib/advanced_billing/models/create_invoice_coupon.rb', line 61 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/advanced_billing/models/create_invoice_coupon.rb', line 49 def self.optionals %w[ code percentage amount description product_family_id compounding_strategy ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
115 116 117 118 119 120 121 |
# File 'lib/advanced_billing/models/create_invoice_coupon.rb', line 115 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |