Class: MistApi::Zone
- Defined in:
- lib/mist_api/models/zone.rb
Overview
Zone
Instance Attribute Summary collapse
-
#created_time ⇒ Float
When the object has been created, in epoch.
-
#for_site ⇒ TrueClass | FalseClass
When the object has been created, in epoch.
-
#id ⇒ UUID | String
Unique ID of the object instance in the Mist Organization.
-
#map_id ⇒ UUID | String
Map where this zone is defined.
-
#modified_time ⇒ Float
When the object has been modified for the last time, in epoch.
-
#name ⇒ String
The name of the zone.
-
#org_id ⇒ UUID | String
The name of the zone.
-
#site_id ⇒ UUID | String
The name of the zone.
-
#vertices ⇒ Array[ZoneVertex]
Vertices used to define an area.
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.
Instance Method Summary collapse
-
#initialize(created_time = SKIP, for_site = SKIP, id = SKIP, map_id = SKIP, modified_time = SKIP, name = SKIP, org_id = SKIP, site_id = SKIP, vertices = SKIP, additional_properties = nil) ⇒ Zone
constructor
A new instance of Zone.
-
#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(created_time = SKIP, for_site = SKIP, id = SKIP, map_id = SKIP, modified_time = SKIP, name = SKIP, org_id = SKIP, site_id = SKIP, vertices = SKIP, additional_properties = nil) ⇒ Zone
Returns a new instance of Zone.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/mist_api/models/zone.rb', line 84 def initialize(created_time = SKIP, for_site = SKIP, id = SKIP, map_id = SKIP, modified_time = SKIP, name = SKIP, org_id = SKIP, site_id = SKIP, vertices = SKIP, additional_properties = nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @created_time = created_time unless created_time == SKIP @for_site = for_site unless for_site == SKIP @id = id unless id == SKIP @map_id = map_id unless map_id == SKIP @modified_time = modified_time unless modified_time == SKIP @name = name unless name == SKIP @org_id = org_id unless org_id == SKIP @site_id = site_id unless site_id == SKIP @vertices = vertices unless vertices == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#created_time ⇒ Float
When the object has been created, in epoch
14 15 16 |
# File 'lib/mist_api/models/zone.rb', line 14 def created_time @created_time end |
#for_site ⇒ TrueClass | FalseClass
When the object has been created, in epoch
18 19 20 |
# File 'lib/mist_api/models/zone.rb', line 18 def for_site @for_site end |
#id ⇒ UUID | String
Unique ID of the object instance in the Mist Organization
22 23 24 |
# File 'lib/mist_api/models/zone.rb', line 22 def id @id end |
#map_id ⇒ UUID | String
Map where this zone is defined
26 27 28 |
# File 'lib/mist_api/models/zone.rb', line 26 def map_id @map_id end |
#modified_time ⇒ Float
When the object has been modified for the last time, in epoch
30 31 32 |
# File 'lib/mist_api/models/zone.rb', line 30 def modified_time @modified_time end |
#name ⇒ String
The name of the zone
34 35 36 |
# File 'lib/mist_api/models/zone.rb', line 34 def name @name end |
#org_id ⇒ UUID | String
The name of the zone
38 39 40 |
# File 'lib/mist_api/models/zone.rb', line 38 def org_id @org_id end |
#site_id ⇒ UUID | String
The name of the zone
42 43 44 |
# File 'lib/mist_api/models/zone.rb', line 42 def site_id @site_id end |
#vertices ⇒ Array[ZoneVertex]
Vertices used to define an area. It’s assumed that the last point connects to the first point and forms an closed area
47 48 49 |
# File 'lib/mist_api/models/zone.rb', line 47 def vertices @vertices end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/mist_api/models/zone.rb', line 104 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. created_time = hash.key?('created_time') ? hash['created_time'] : SKIP for_site = hash.key?('for_site') ? hash['for_site'] : SKIP id = hash.key?('id') ? hash['id'] : SKIP map_id = hash.key?('map_id') ? hash['map_id'] : SKIP modified_time = hash.key?('modified_time') ? hash['modified_time'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP org_id = hash.key?('org_id') ? hash['org_id'] : SKIP site_id = hash.key?('site_id') ? hash['site_id'] : SKIP # Parameter is an array, so we need to iterate through it vertices = nil unless hash['vertices'].nil? vertices = [] hash['vertices'].each do |structure| vertices << (ZoneVertex.from_hash(structure) if structure) end end vertices = SKIP unless hash.key?('vertices') # 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. Zone.new(created_time, for_site, id, map_id, modified_time, name, org_id, site_id, vertices, additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/mist_api/models/zone.rb', line 50 def self.names @_hash = {} if @_hash.nil? @_hash['created_time'] = 'created_time' @_hash['for_site'] = 'for_site' @_hash['id'] = 'id' @_hash['map_id'] = 'map_id' @_hash['modified_time'] = 'modified_time' @_hash['name'] = 'name' @_hash['org_id'] = 'org_id' @_hash['site_id'] = 'site_id' @_hash['vertices'] = 'vertices' @_hash end |
.nullables ⇒ Object
An array for nullable fields
80 81 82 |
# File 'lib/mist_api/models/zone.rb', line 80 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/mist_api/models/zone.rb', line 65 def self.optionals %w[ created_time for_site id map_id modified_time name org_id site_id vertices ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
156 157 158 159 160 161 162 |
# File 'lib/mist_api/models/zone.rb', line 156 def inspect class_name = self.class.name.split('::').last "<#{class_name} created_time: #{@created_time.inspect}, for_site: #{@for_site.inspect}, id:"\ " #{@id.inspect}, map_id: #{@map_id.inspect}, modified_time: #{@modified_time.inspect},"\ " name: #{@name.inspect}, org_id: #{@org_id.inspect}, site_id: #{@site_id.inspect},"\ " vertices: #{@vertices.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
148 149 150 151 152 153 |
# File 'lib/mist_api/models/zone.rb', line 148 def to_s class_name = self.class.name.split('::').last "<#{class_name} created_time: #{@created_time}, for_site: #{@for_site}, id: #{@id}, map_id:"\ " #{@map_id}, modified_time: #{@modified_time}, name: #{@name}, org_id: #{@org_id}, site_id:"\ " #{@site_id}, vertices: #{@vertices}, additional_properties: #{@additional_properties}>" end |