Class: ApiReference::PlanPhase
- Defined in:
- lib/api_reference/models/plan_phase.rb
Overview
PlanPhase Model.
Instance Attribute Summary collapse
-
#description ⇒ String
TODO: Write general description for this method.
-
#discount ⇒ Object
Determines the ordering of the phase in a plan's lifecycle.
-
#duration ⇒ Integer
How many terms of length
duration_unitthis phase is active for. -
#duration_unit ⇒ DurationUnit3
How many terms of length
duration_unitthis phase is active for. -
#id ⇒ String
TODO: Write general description for this method.
-
#maximum ⇒ Maximum
Determines the ordering of the phase in a plan's lifecycle.
-
#maximum_amount ⇒ String
Determines the ordering of the phase in a plan's lifecycle.
-
#minimum ⇒ Minimum
Determines the ordering of the phase in a plan's lifecycle.
-
#minimum_amount ⇒ String
Determines the ordering of the phase in a plan's lifecycle.
-
#name ⇒ String
How many terms of length
duration_unitthis phase is active for. -
#order ⇒ Integer
Determines the ordering of the phase in a plan's lifecycle.
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(id:, description:, duration:, duration_unit:, name:, order:, minimum:, maximum:, maximum_amount:, minimum_amount:, discount:, additional_properties: nil) ⇒ PlanPhase
constructor
A new instance of PlanPhase.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(id:, description:, duration:, duration_unit:, name:, order:, minimum:, maximum:, maximum_amount:, minimum_amount:, discount:, additional_properties: nil) ⇒ PlanPhase
Returns a new instance of PlanPhase.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/api_reference/models/plan_phase.rb', line 101 def initialize(id:, description:, duration:, duration_unit:, name:, order:, minimum:, maximum:, maximum_amount:, minimum_amount:, discount:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @id = id @description = description @duration = duration @duration_unit = duration_unit @name = name @order = order @minimum = minimum @maximum = maximum @maximum_amount = maximum_amount @minimum_amount = minimum_amount @discount = discount @additional_properties = additional_properties end |
Instance Attribute Details
#description ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/api_reference/models/plan_phase.rb', line 18 def description @description end |
#discount ⇒ Object
Determines the ordering of the phase in a plan's lifecycle. 1 = first phase.
63 64 65 |
# File 'lib/api_reference/models/plan_phase.rb', line 63 def discount @discount end |
#duration ⇒ Integer
How many terms of length duration_unit this phase is active for. If
null, this phase is evergreen and active indefinitely
23 24 25 |
# File 'lib/api_reference/models/plan_phase.rb', line 23 def duration @duration end |
#duration_unit ⇒ DurationUnit3
How many terms of length duration_unit this phase is active for. If
null, this phase is evergreen and active indefinitely
28 29 30 |
# File 'lib/api_reference/models/plan_phase.rb', line 28 def duration_unit @duration_unit end |
#id ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/api_reference/models/plan_phase.rb', line 14 def id @id end |
#maximum ⇒ Maximum
Determines the ordering of the phase in a plan's lifecycle. 1 = first phase.
48 49 50 |
# File 'lib/api_reference/models/plan_phase.rb', line 48 def maximum @maximum end |
#maximum_amount ⇒ String
Determines the ordering of the phase in a plan's lifecycle. 1 = first phase.
53 54 55 |
# File 'lib/api_reference/models/plan_phase.rb', line 53 def maximum_amount @maximum_amount end |
#minimum ⇒ Minimum
Determines the ordering of the phase in a plan's lifecycle. 1 = first phase.
43 44 45 |
# File 'lib/api_reference/models/plan_phase.rb', line 43 def minimum @minimum end |
#minimum_amount ⇒ String
Determines the ordering of the phase in a plan's lifecycle. 1 = first phase.
58 59 60 |
# File 'lib/api_reference/models/plan_phase.rb', line 58 def minimum_amount @minimum_amount end |
#name ⇒ String
How many terms of length duration_unit this phase is active for. If
null, this phase is evergreen and active indefinitely
33 34 35 |
# File 'lib/api_reference/models/plan_phase.rb', line 33 def name @name end |
#order ⇒ Integer
Determines the ordering of the phase in a plan's lifecycle. 1 = first phase.
38 39 40 |
# File 'lib/api_reference/models/plan_phase.rb', line 38 def order @order end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/api_reference/models/plan_phase.rb', line 122 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil description = hash.key?('description') ? hash['description'] : nil duration = hash.key?('duration') ? hash['duration'] : nil duration_unit = hash.key?('duration_unit') ? hash['duration_unit'] : nil name = hash.key?('name') ? hash['name'] : nil order = hash.key?('order') ? hash['order'] : nil minimum = Minimum.from_hash(hash['minimum']) if hash['minimum'] maximum = Maximum.from_hash(hash['maximum']) if hash['maximum'] maximum_amount = hash.key?('maximum_amount') ? hash['maximum_amount'] : nil minimum_amount = hash.key?('minimum_amount') ? hash['minimum_amount'] : nil discount = hash.key?('discount') ? hash['discount'] : nil # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. PlanPhase.new(id: id, description: description, duration: duration, duration_unit: duration_unit, name: name, order: order, minimum: minimum, maximum: maximum, maximum_amount: maximum_amount, minimum_amount: minimum_amount, discount: discount, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/api_reference/models/plan_phase.rb', line 66 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['description'] = 'description' @_hash['duration'] = 'duration' @_hash['duration_unit'] = 'duration_unit' @_hash['name'] = 'name' @_hash['order'] = 'order' @_hash['minimum'] = 'minimum' @_hash['maximum'] = 'maximum' @_hash['maximum_amount'] = 'maximum_amount' @_hash['minimum_amount'] = 'minimum_amount' @_hash['discount'] = 'discount' @_hash end |
.nullables ⇒ Object
An array for nullable fields
88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/api_reference/models/plan_phase.rb', line 88 def self.nullables %w[ description duration duration_unit minimum maximum maximum_amount minimum_amount discount ] end |
.optionals ⇒ Object
An array for optional fields
83 84 85 |
# File 'lib/api_reference/models/plan_phase.rb', line 83 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
164 165 166 167 168 169 170 171 172 173 174 175 176 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 |
# File 'lib/api_reference/models/plan_phase.rb', line 164 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.description, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.duration, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.duration_unit, ->(val) { DurationUnit3.validate(val) }) and APIHelper.valid_type?(value.name, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.order, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.minimum, ->(val) { Minimum.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value.maximum, ->(val) { Maximum.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value.maximum_amount, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.minimum_amount, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.discount, ->(val) { val.instance_of? Object }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['description'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['duration'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['duration_unit'], ->(val) { DurationUnit3.validate(val) }) and APIHelper.valid_type?(value['name'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['order'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['minimum'], ->(val) { Minimum.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value['maximum'], ->(val) { Maximum.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value['maximum_amount'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['minimum_amount'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['discount'], ->(val) { val.instance_of? Object }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
235 236 237 238 239 240 241 242 |
# File 'lib/api_reference/models/plan_phase.rb', line 235 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, description: #{@description.inspect}, duration:"\ " #{@duration.inspect}, duration_unit: #{@duration_unit.inspect}, name: #{@name.inspect},"\ " order: #{@order.inspect}, minimum: #{@minimum.inspect}, maximum: #{@maximum.inspect},"\ " maximum_amount: #{@maximum_amount.inspect}, minimum_amount: #{@minimum_amount.inspect},"\ " discount: #{@discount.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
225 226 227 228 229 230 231 232 |
# File 'lib/api_reference/models/plan_phase.rb', line 225 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, description: #{@description}, duration: #{@duration},"\ " duration_unit: #{@duration_unit}, name: #{@name}, order: #{@order}, minimum: #{@minimum},"\ " maximum: #{@maximum}, maximum_amount: #{@maximum_amount}, minimum_amount:"\ " #{@minimum_amount}, discount: #{@discount}, additional_properties:"\ " #{@additional_properties}>" end |