Class: MistApi::InstallerSite

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/installer_site.rb

Overview

InstallerSite 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(address = nil, country_code = nil, latlng = nil, name = nil, id = SKIP, rftemplate_name = SKIP, sitegroup_names = SKIP, timezone = SKIP, additional_properties = nil) ⇒ InstallerSite

Returns a new instance of InstallerSite.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/mist_api/models/installer_site.rb', line 73

def initialize(address = nil, country_code = nil, latlng = nil, name = nil,
               id = SKIP, rftemplate_name = SKIP, sitegroup_names = SKIP,
               timezone = SKIP, additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @address = address
  @country_code = country_code
  @id = id unless id == SKIP
  @latlng = latlng
  @name = name
  @rftemplate_name = rftemplate_name unless rftemplate_name == SKIP
  @sitegroup_names = sitegroup_names unless sitegroup_names == SKIP
  @timezone = timezone unless timezone == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/mist_api/models/installer_site.rb', line 14

def address
  @address
end

#country_codeString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/mist_api/models/installer_site.rb', line 18

def country_code
  @country_code
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


22
23
24
# File 'lib/mist_api/models/installer_site.rb', line 22

def id
  @id
end

#latlngLatLng

Unique ID of the object instance in the Mist Organization

Returns:



26
27
28
# File 'lib/mist_api/models/installer_site.rb', line 26

def latlng
  @latlng
end

#nameString

Unique ID of the object instance in the Mist Organization

Returns:

  • (String)


30
31
32
# File 'lib/mist_api/models/installer_site.rb', line 30

def name
  @name
end

#rftemplate_nameString

Unique ID of the object instance in the Mist Organization

Returns:

  • (String)


34
35
36
# File 'lib/mist_api/models/installer_site.rb', line 34

def rftemplate_name
  @rftemplate_name
end

#sitegroup_namesArray[String]

Unique ID of the object instance in the Mist Organization

Returns:

  • (Array[String])


38
39
40
# File 'lib/mist_api/models/installer_site.rb', line 38

def sitegroup_names
  @sitegroup_names
end

#timezoneString

Unique ID of the object instance in the Mist Organization

Returns:

  • (String)


42
43
44
# File 'lib/mist_api/models/installer_site.rb', line 42

def timezone
  @timezone
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



91
92
93
94
95
96
97
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
# File 'lib/mist_api/models/installer_site.rb', line 91

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  address = hash.key?('address') ? hash['address'] : nil
  country_code = hash.key?('country_code') ? hash['country_code'] : nil
  latlng = LatLng.from_hash(hash['latlng']) if hash['latlng']
  name = hash.key?('name') ? hash['name'] : nil
  id = hash.key?('id') ? hash['id'] : SKIP
  rftemplate_name =
    hash.key?('rftemplate_name') ? hash['rftemplate_name'] : SKIP
  sitegroup_names =
    hash.key?('sitegroup_names') ? hash['sitegroup_names'] : SKIP
  timezone = hash.key?('timezone') ? hash['timezone'] : SKIP

  # 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.
  InstallerSite.new(address,
                    country_code,
                    latlng,
                    name,
                    id,
                    rftemplate_name,
                    sitegroup_names,
                    timezone,
                    additional_properties)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/mist_api/models/installer_site.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['address'] = 'address'
  @_hash['country_code'] = 'country_code'
  @_hash['id'] = 'id'
  @_hash['latlng'] = 'latlng'
  @_hash['name'] = 'name'
  @_hash['rftemplate_name'] = 'rftemplate_name'
  @_hash['sitegroup_names'] = 'sitegroup_names'
  @_hash['timezone'] = 'timezone'
  @_hash
end

.nullablesObject

An array for nullable fields



69
70
71
# File 'lib/mist_api/models/installer_site.rb', line 69

def self.nullables
  []
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
65
66
# File 'lib/mist_api/models/installer_site.rb', line 59

def self.optionals
  %w[
    id
    rftemplate_name
    sitegroup_names
    timezone
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



135
136
137
138
139
140
141
# File 'lib/mist_api/models/installer_site.rb', line 135

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} address: #{@address.inspect}, country_code: #{@country_code.inspect}, id:"\
  " #{@id.inspect}, latlng: #{@latlng.inspect}, name: #{@name.inspect}, rftemplate_name:"\
  " #{@rftemplate_name.inspect}, sitegroup_names: #{@sitegroup_names.inspect}, timezone:"\
  " #{@timezone.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



126
127
128
129
130
131
132
# File 'lib/mist_api/models/installer_site.rb', line 126

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} address: #{@address}, country_code: #{@country_code}, id: #{@id}, latlng:"\
  " #{@latlng}, name: #{@name}, rftemplate_name: #{@rftemplate_name}, sitegroup_names:"\
  " #{@sitegroup_names}, timezone: #{@timezone}, additional_properties:"\
  " #{@additional_properties}>"
end