Class: ApiReference::PlanMinifiedWithVersion

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/plan_minified_with_version.rb

Overview

PlanMinifiedWithVersion Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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:, plan_version:, additional_properties: nil) ⇒ PlanMinifiedWithVersion

Returns a new instance of PlanMinifiedWithVersion.



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/api_reference/models/plan_minified_with_version.rb', line 58

def initialize(id:, external_plan_id:, name:, plan_version:,
               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
  @plan_version = plan_version
  @additional_properties = additional_properties
end

Instance Attribute Details

#external_plan_idString

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.

Returns:

  • (String)


20
21
22
# File 'lib/api_reference/models/plan_minified_with_version.rb', line 20

def external_plan_id
  @external_plan_id
end

#idString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/api_reference/models/plan_minified_with_version.rb', line 14

def id
  @id
end

#nameString

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.

Returns:

  • (String)


26
27
28
# File 'lib/api_reference/models/plan_minified_with_version.rb', line 26

def name
  @name
end

#plan_versionString

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.

Returns:

  • (String)


32
33
34
# File 'lib/api_reference/models/plan_minified_with_version.rb', line 32

def plan_version
  @plan_version
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/api_reference/models/plan_minified_with_version.rb', line 71

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
  plan_version = hash.key?('plan_version') ? hash['plan_version'] : 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.
  PlanMinifiedWithVersion.new(id: id,
                              external_plan_id: external_plan_id,
                              name: name,
                              plan_version: plan_version,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
# File 'lib/api_reference/models/plan_minified_with_version.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['external_plan_id'] = 'external_plan_id'
  @_hash['name'] = 'name'
  @_hash['plan_version'] = 'plan_version'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
53
54
55
56
# File 'lib/api_reference/models/plan_minified_with_version.rb', line 50

def self.nullables
  %w[
    id
    external_plan_id
    name
  ]
end

.optionalsObject

An array for optional fields



45
46
47
# File 'lib/api_reference/models/plan_minified_with_version.rb', line 45

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



98
99
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
# File 'lib/api_reference/models/plan_minified_with_version.rb', line 98

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 }) and
        APIHelper.valid_type?(value.plan_version,
                              ->(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 }) and
      APIHelper.valid_type?(value['plan_version'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



134
135
136
137
138
139
# File 'lib/api_reference/models/plan_minified_with_version.rb', line 134

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, external_plan_id: #{@external_plan_id.inspect}, name:"\
  " #{@name.inspect}, plan_version: #{@plan_version.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



127
128
129
130
131
# File 'lib/api_reference/models/plan_minified_with_version.rb', line 127

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, external_plan_id: #{@external_plan_id}, name: #{@name},"\
  " plan_version: #{@plan_version}, additional_properties: #{@additional_properties}>"
end