Class: MistApi::Org

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

Overview

Org 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(name = nil, alarmtemplate_id = SKIP, allow_mist = true, created_time = SKIP, id = SKIP, modified_time = SKIP, msp_id = SKIP, msp_logo_url = SKIP, msp_name = SKIP, orggroup_ids = SKIP, session_expiry = 1440, additional_properties = nil) ⇒ Org

Returns a new instance of Org.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/mist_api/models/org.rb', line 96

def initialize(name = nil, alarmtemplate_id = SKIP, allow_mist = true,
               created_time = SKIP, id = SKIP, modified_time = SKIP,
               msp_id = SKIP, msp_logo_url = SKIP, msp_name = SKIP,
               orggroup_ids = SKIP, session_expiry = 1440,
               additional_properties = nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @alarmtemplate_id = alarmtemplate_id unless alarmtemplate_id == SKIP
  @allow_mist = allow_mist unless allow_mist == SKIP
  @created_time = created_time unless created_time == SKIP
  @id = id unless id == SKIP
  @modified_time = modified_time unless modified_time == SKIP
  @msp_id = msp_id unless msp_id == SKIP
  @msp_logo_url = msp_logo_url unless msp_logo_url == SKIP
  @msp_name = msp_name unless msp_name == SKIP
  @name = name
  @orggroup_ids = orggroup_ids unless orggroup_ids == SKIP
  @session_expiry = session_expiry unless session_expiry == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#alarmtemplate_idUUID | String

TODO: Write general description for this method

Returns:

  • (UUID | String)


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

def alarmtemplate_id
  @alarmtemplate_id
end

#allow_mistTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def allow_mist
  @allow_mist
end

#created_timeFloat

When the object has been created, in epoch

Returns:

  • (Float)


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

def created_time
  @created_time
end

#idUUID | String

Unique ID of the object instance in the Mist Organization

Returns:

  • (UUID | String)


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

def id
  @id
end

#modified_timeFloat

When the object has been modified for the last time, in epoch

Returns:

  • (Float)


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

def modified_time
  @modified_time
end

#msp_idUUID | String

When the object has been modified for the last time, in epoch

Returns:

  • (UUID | String)


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

def msp_id
  @msp_id
end

#msp_logo_urlString

logo uploaded by the MSP with advanced tier, only present if provided

Returns:

  • (String)


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

def msp_logo_url
  @msp_logo_url
end

#msp_nameString

Name of the msp the org belongs to

Returns:

  • (String)


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

def msp_name
  @msp_name
end

#nameString

Name of the msp the org belongs to

Returns:

  • (String)


46
47
48
# File 'lib/mist_api/models/org.rb', line 46

def name
  @name
end

#orggroup_idsArray[UUID | String]

Name of the msp the org belongs to

Returns:

  • (Array[UUID | String])


50
51
52
# File 'lib/mist_api/models/org.rb', line 50

def orggroup_ids
  @orggroup_ids
end

#session_expiryInteger

Name of the msp the org belongs to

Returns:

  • (Integer)


54
55
56
# File 'lib/mist_api/models/org.rb', line 54

def session_expiry
  @session_expiry
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/mist_api/models/org.rb', line 119

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : nil
  alarmtemplate_id =
    hash.key?('alarmtemplate_id') ? hash['alarmtemplate_id'] : SKIP
  allow_mist = hash['allow_mist'] ||= true
  created_time = hash.key?('created_time') ? hash['created_time'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  modified_time = hash.key?('modified_time') ? hash['modified_time'] : SKIP
  msp_id = hash.key?('msp_id') ? hash['msp_id'] : SKIP
  msp_logo_url = hash.key?('msp_logo_url') ? hash['msp_logo_url'] : SKIP
  msp_name = hash.key?('msp_name') ? hash['msp_name'] : SKIP
  orggroup_ids = hash.key?('orggroup_ids') ? hash['orggroup_ids'] : SKIP
  session_expiry = hash['session_expiry'] ||= 1440

  # 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.
  Org.new(name,
          alarmtemplate_id,
          allow_mist,
          created_time,
          id,
          modified_time,
          msp_id,
          msp_logo_url,
          msp_name,
          orggroup_ids,
          session_expiry,
          additional_properties)
end

.namesObject

A mapping from model property names to API property names.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/mist_api/models/org.rb', line 57

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['alarmtemplate_id'] = 'alarmtemplate_id'
  @_hash['allow_mist'] = 'allow_mist'
  @_hash['created_time'] = 'created_time'
  @_hash['id'] = 'id'
  @_hash['modified_time'] = 'modified_time'
  @_hash['msp_id'] = 'msp_id'
  @_hash['msp_logo_url'] = 'msp_logo_url'
  @_hash['msp_name'] = 'msp_name'
  @_hash['name'] = 'name'
  @_hash['orggroup_ids'] = 'orggroup_ids'
  @_hash['session_expiry'] = 'session_expiry'
  @_hash
end

.nullablesObject

An array for nullable fields



90
91
92
93
94
# File 'lib/mist_api/models/org.rb', line 90

def self.nullables
  %w[
    alarmtemplate_id
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    alarmtemplate_id
    allow_mist
    created_time
    id
    modified_time
    msp_id
    msp_logo_url
    msp_name
    orggroup_ids
    session_expiry
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



169
170
171
172
173
174
175
176
177
# File 'lib/mist_api/models/org.rb', line 169

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} alarmtemplate_id: #{@alarmtemplate_id.inspect}, allow_mist:"\
  " #{@allow_mist.inspect}, created_time: #{@created_time.inspect}, id: #{@id.inspect},"\
  " modified_time: #{@modified_time.inspect}, msp_id: #{@msp_id.inspect}, msp_logo_url:"\
  " #{@msp_logo_url.inspect}, msp_name: #{@msp_name.inspect}, name: #{@name.inspect},"\
  " orggroup_ids: #{@orggroup_ids.inspect}, session_expiry: #{@session_expiry.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



159
160
161
162
163
164
165
166
# File 'lib/mist_api/models/org.rb', line 159

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} alarmtemplate_id: #{@alarmtemplate_id}, allow_mist: #{@allow_mist},"\
  " created_time: #{@created_time}, id: #{@id}, modified_time: #{@modified_time}, msp_id:"\
  " #{@msp_id}, msp_logo_url: #{@msp_logo_url}, msp_name: #{@msp_name}, name: #{@name},"\
  " orggroup_ids: #{@orggroup_ids}, session_expiry: #{@session_expiry}, additional_properties:"\
  " #{@additional_properties}>"
end