Class: ApiReference::PlanMinified
- Defined in:
- lib/api_reference/models/plan_minified.rb
Overview
PlanMinified Model.
Instance Attribute Summary collapse
-
#external_plan_id ⇒ String
An optional user-defined ID for this plan resource, used throughout the system as an alias for this Plan.
-
#id ⇒ String
TODO: Write general description for this method.
-
#name ⇒ String
An optional user-defined ID for this plan resource, used throughout the system as an alias for this Plan.
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:, external_plan_id:, name:, additional_properties: nil) ⇒ PlanMinified
constructor
A new instance of PlanMinified.
-
#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:, external_plan_id:, name:, additional_properties: nil) ⇒ PlanMinified
Returns a new instance of PlanMinified.
51 52 53 54 55 56 57 58 59 |
# File 'lib/api_reference/models/plan_minified.rb', line 51 def initialize(id:, external_plan_id:, name:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @id = id @external_plan_id = external_plan_id @name = name @additional_properties = additional_properties end |
Instance Attribute Details
#external_plan_id ⇒ String
An optional user-defined ID for this plan resource, used throughout the system as an alias for this Plan. Use this field to identify a plan by an existing identifier in your system.
20 21 22 |
# File 'lib/api_reference/models/plan_minified.rb', line 20 def external_plan_id @external_plan_id end |
#id ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/api_reference/models/plan_minified.rb', line 14 def id @id end |
#name ⇒ String
An optional user-defined ID for this plan resource, used throughout the system as an alias for this Plan. Use this field to identify a plan by an existing identifier in your system.
26 27 28 |
# File 'lib/api_reference/models/plan_minified.rb', line 26 def name @name end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/api_reference/models/plan_minified.rb', line 62 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil external_plan_id = hash.key?('external_plan_id') ? hash['external_plan_id'] : nil name = hash.key?('name') ? hash['name'] : 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. PlanMinified.new(id: id, external_plan_id: external_plan_id, name: name, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 |
# File 'lib/api_reference/models/plan_minified.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['external_plan_id'] = 'external_plan_id' @_hash['name'] = 'name' @_hash end |
.nullables ⇒ Object
An array for nullable fields
43 44 45 46 47 48 49 |
# File 'lib/api_reference/models/plan_minified.rb', line 43 def self.nullables %w[ id external_plan_id name ] end |
.optionals ⇒ Object
An array for optional fields
38 39 40 |
# File 'lib/api_reference/models/plan_minified.rb', line 38 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/api_reference/models/plan_minified.rb', line 87 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.external_plan_id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.name, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['external_plan_id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['name'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
119 120 121 122 123 |
# File 'lib/api_reference/models/plan_minified.rb', line 119 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, external_plan_id: #{@external_plan_id.inspect}, name:"\ " #{@name.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
112 113 114 115 116 |
# File 'lib/api_reference/models/plan_minified.rb', line 112 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, external_plan_id: #{@external_plan_id}, name: #{@name},"\ " additional_properties: #{@additional_properties}>" end |