Class: ApiReference::PlanVersionChange
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::PlanVersionChange
- Defined in:
- lib/api_reference/models/plan_version_change.rb
Overview
PlanVersionChange Model.
Instance Attribute Summary collapse
-
#effective_time ⇒ Object
When the migration takes effect.
-
#id ⇒ String
Unique identifier for this plan version change.
-
#plan_id ⇒ String
The ID of the plan being migrated.
-
#status ⇒ Status18
Current status of the migration: 'not_started', 'in_progress', 'completed', 'action_needed', or 'canceled'.
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:, plan_id:, effective_time:, status:, additional_properties: nil) ⇒ PlanVersionChange
constructor
A new instance of PlanVersionChange.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
- #to_union_type_effective_time ⇒ 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:, plan_id:, effective_time:, status:, additional_properties: nil) ⇒ PlanVersionChange
Returns a new instance of PlanVersionChange.
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/api_reference/models/plan_version_change.rb', line 53 def initialize(id:, plan_id:, effective_time:, status:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @id = id @plan_id = plan_id @effective_time = effective_time @status = status @additional_properties = additional_properties end |
Instance Attribute Details
#effective_time ⇒ Object
When the migration takes effect. Can be a specific date/time, or 'end_of_term' when scheduled to be at the end of the current billing period.
24 25 26 |
# File 'lib/api_reference/models/plan_version_change.rb', line 24 def effective_time @effective_time end |
#id ⇒ String
Unique identifier for this plan version change.
14 15 16 |
# File 'lib/api_reference/models/plan_version_change.rb', line 14 def id @id end |
#plan_id ⇒ String
The ID of the plan being migrated.
18 19 20 |
# File 'lib/api_reference/models/plan_version_change.rb', line 18 def plan_id @plan_id end |
#status ⇒ Status18
Current status of the migration: 'not_started', 'in_progress', 'completed', 'action_needed', or 'canceled'.
29 30 31 |
# File 'lib/api_reference/models/plan_version_change.rb', line 29 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/api_reference/models/plan_version_change.rb', line 66 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil plan_id = hash.key?('plan_id') ? hash['plan_id'] : nil effective_time = hash.key?('effective_time') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:PlanVersionChangeEffectiveTime), hash['effective_time'] ) : nil status = hash.key?('status') ? hash['status'] : 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. PlanVersionChange.new(id: id, plan_id: plan_id, effective_time: effective_time, status: status, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
32 33 34 35 36 37 38 39 |
# File 'lib/api_reference/models/plan_version_change.rb', line 32 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['plan_id'] = 'plan_id' @_hash['effective_time'] = 'effective_time' @_hash['status'] = 'status' @_hash end |
.nullables ⇒ Object
An array for nullable fields
47 48 49 50 51 |
# File 'lib/api_reference/models/plan_version_change.rb', line 47 def self.nullables %w[ effective_time ] end |
.optionals ⇒ Object
An array for optional fields
42 43 44 |
# File 'lib/api_reference/models/plan_version_change.rb', line 42 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/api_reference/models/plan_version_change.rb', line 100 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.plan_id, ->(val) { val.instance_of? String }) and UnionTypeLookUp.get(:PlanVersionChangeEffectiveTime) .validate(value.effective_time) and APIHelper.valid_type?(value.status, ->(val) { Status18.validate(val) }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['plan_id'], ->(val) { val.instance_of? String }) and UnionTypeLookUp.get(:PlanVersionChangeEffectiveTime) .validate(value['effective_time']) and APIHelper.valid_type?(value['status'], ->(val) { Status18.validate(val) }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
136 137 138 139 140 141 |
# File 'lib/api_reference/models/plan_version_change.rb', line 136 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, plan_id: #{@plan_id.inspect}, effective_time:"\ " #{@effective_time.inspect}, status: #{@status.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
129 130 131 132 133 |
# File 'lib/api_reference/models/plan_version_change.rb', line 129 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, plan_id: #{@plan_id}, effective_time: #{@effective_time},"\ " status: #{@status}, additional_properties: #{@additional_properties}>" end |
#to_union_type_effective_time ⇒ Object
92 93 94 95 96 |
# File 'lib/api_reference/models/plan_version_change.rb', line 92 def to_union_type_effective_time UnionTypeLookUp.get(:PlanVersionChangeEffectiveTime) .validate(effective_time) .serialize(effective_time) end |