Class: ConnectWise::SecurityRoleSetting

Inherits:
Object
  • Object
show all
Defined in:
lib/connectwise-ruby-sdk/models/security_role_setting.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SecurityRoleSetting

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 112

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

  if attributes.has_key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.has_key?(:'addLevel')
    self.add_level = attributes[:'addLevel']
  end

  if attributes.has_key?(:'editLevel')
    self.edit_level = attributes[:'editLevel']
  end

  if attributes.has_key?(:'deleteLevel')
    self.delete_level = attributes[:'deleteLevel']
  end

  if attributes.has_key?(:'inquireLevel')
    self.inquire_level = attributes[:'inquireLevel']
  end

  if attributes.has_key?(:'moduleFunctionName')
    self.module_function_name = attributes[:'moduleFunctionName']
  end

  if attributes.has_key?(:'moduleFunctionDescription')
    self.module_function_description = attributes[:'moduleFunctionDescription']
  end

  if attributes.has_key?(:'myAllFlag')
    self.my_all_flag = attributes[:'myAllFlag']
  end

  if attributes.has_key?(:'moduleFunctionIdentifier')
    self.module_function_identifier = attributes[:'moduleFunctionIdentifier']
  end

  if attributes.has_key?(:'reportFlag')
    self.report_flag = attributes[:'reportFlag']
  end

  if attributes.has_key?(:'restrictFlag')
    self.restrict_flag = attributes[:'restrictFlag']
  end

  if attributes.has_key?(:'customFlag')
    self.custom_flag = attributes[:'customFlag']
  end

  if attributes.has_key?(:'moduleDescription')
    self.module_description = attributes[:'moduleDescription']
  end

  if attributes.has_key?(:'moduleIdentifier')
    self.module_identifier = attributes[:'moduleIdentifier']
  end

  if attributes.has_key?(:'moduleName')
    self.module_name = attributes[:'moduleName']
  end

  if attributes.has_key?(:'sortOrder')
    self.sort_order = attributes[:'sortOrder']
  end

  if attributes.has_key?(:'_info')
    self._info = attributes[:'_info']
  end

end

Instance Attribute Details

#_infoObject

Metadata of the entity



40
41
42
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 40

def _info
  @_info
end

#add_levelObject

Returns the value of attribute add_level.



9
10
11
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 9

def add_level
  @add_level
end

#custom_flagObject

Returns the value of attribute custom_flag.



29
30
31
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 29

def custom_flag
  @custom_flag
end

#delete_levelObject

Returns the value of attribute delete_level.



13
14
15
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 13

def delete_level
  @delete_level
end

#edit_levelObject

Returns the value of attribute edit_level.



11
12
13
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 11

def edit_level
  @edit_level
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 7

def id
  @id
end

#inquire_levelObject

Returns the value of attribute inquire_level.



15
16
17
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 15

def inquire_level
  @inquire_level
end

#module_descriptionObject

Returns the value of attribute module_description.



31
32
33
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 31

def module_description
  @module_description
end

#module_function_descriptionObject

Returns the value of attribute module_function_description.



19
20
21
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 19

def module_function_description
  @module_function_description
end

#module_function_identifierObject

Returns the value of attribute module_function_identifier.



23
24
25
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 23

def module_function_identifier
  @module_function_identifier
end

#module_function_nameObject

Returns the value of attribute module_function_name.



17
18
19
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 17

def module_function_name
  @module_function_name
end

#module_identifierObject

Returns the value of attribute module_identifier.



33
34
35
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 33

def module_identifier
  @module_identifier
end

#module_nameObject

Returns the value of attribute module_name.



35
36
37
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 35

def module_name
  @module_name
end

#my_all_flagObject

Returns the value of attribute my_all_flag.



21
22
23
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 21

def my_all_flag
  @my_all_flag
end

#report_flagObject

Returns the value of attribute report_flag.



25
26
27
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 25

def report_flag
  @report_flag
end

#restrict_flagObject

Returns the value of attribute restrict_flag.



27
28
29
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 27

def restrict_flag
  @restrict_flag
end

#sort_orderObject

Returns the value of attribute sort_order.



37
38
39
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 37

def sort_order
  @sort_order
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 65

def self.attribute_map
  {
    :'id' => :'id',
    :'add_level' => :'addLevel',
    :'edit_level' => :'editLevel',
    :'delete_level' => :'deleteLevel',
    :'inquire_level' => :'inquireLevel',
    :'module_function_name' => :'moduleFunctionName',
    :'module_function_description' => :'moduleFunctionDescription',
    :'my_all_flag' => :'myAllFlag',
    :'module_function_identifier' => :'moduleFunctionIdentifier',
    :'report_flag' => :'reportFlag',
    :'restrict_flag' => :'restrictFlag',
    :'custom_flag' => :'customFlag',
    :'module_description' => :'moduleDescription',
    :'module_identifier' => :'moduleIdentifier',
    :'module_name' => :'moduleName',
    :'sort_order' => :'sortOrder',
    :'_info' => :'_info'
  }
end

.swagger_typesObject

Attribute type mapping.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 88

def self.swagger_types
  {
    :'id' => :'Integer',
    :'add_level' => :'String',
    :'edit_level' => :'String',
    :'delete_level' => :'String',
    :'inquire_level' => :'String',
    :'module_function_name' => :'String',
    :'module_function_description' => :'String',
    :'my_all_flag' => :'BOOLEAN',
    :'module_function_identifier' => :'String',
    :'report_flag' => :'BOOLEAN',
    :'restrict_flag' => :'BOOLEAN',
    :'custom_flag' => :'BOOLEAN',
    :'module_description' => :'String',
    :'module_identifier' => :'String',
    :'module_name' => :'String',
    :'sort_order' => :'Integer',
    :'_info' => :'Metadata'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 347

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      add_level == o.add_level &&
      edit_level == o.edit_level &&
      delete_level == o.delete_level &&
      inquire_level == o.inquire_level &&
      module_function_name == o.module_function_name &&
      module_function_description == o.module_function_description &&
      my_all_flag == o.my_all_flag &&
      module_function_identifier == o.module_function_identifier &&
      report_flag == o.report_flag &&
      restrict_flag == o.restrict_flag &&
      custom_flag == o.custom_flag &&
      module_description == o.module_description &&
      module_identifier == o.module_identifier &&
      module_name == o.module_name &&
      sort_order == o.sort_order &&
      _info == o._info
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 405

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = ConnectWise.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



471
472
473
474
475
476
477
478
479
480
481
482
483
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 471

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map{ |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 384

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


371
372
373
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 371

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



377
378
379
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 377

def hash
  [id, add_level, edit_level, delete_level, inquire_level, module_function_name, module_function_description, my_all_flag, module_function_identifier, report_flag, restrict_flag, custom_flag, module_description, module_identifier, module_name, sort_order, _info].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properies with the reasons



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 190

def list_invalid_properties
  invalid_properties = Array.new
  if !@module_function_name.nil? && @module_function_name.to_s.length > 10
    invalid_properties.push("invalid value for 'module_function_name', the character length must be smaller than or equal to 10.")
  end

  if !@module_function_description.nil? && @module_function_description.to_s.length > 50
    invalid_properties.push("invalid value for 'module_function_description', the character length must be smaller than or equal to 50.")
  end

  if !@module_function_identifier.nil? && @module_function_identifier.to_s.length > 5
    invalid_properties.push("invalid value for 'module_function_identifier', the character length must be smaller than or equal to 5.")
  end

  if !@module_description.nil? && @module_description.to_s.length > 50
    invalid_properties.push("invalid value for 'module_description', the character length must be smaller than or equal to 50.")
  end

  if !@module_identifier.nil? && @module_identifier.to_s.length > 20
    invalid_properties.push("invalid value for 'module_identifier', the character length must be smaller than or equal to 20.")
  end

  if !@module_name.nil? && @module_name.to_s.length > 50
    invalid_properties.push("invalid value for 'module_name', the character length must be smaller than or equal to 50.")
  end

  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



451
452
453
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 451

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



457
458
459
460
461
462
463
464
465
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 457

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



445
446
447
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 445

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/connectwise-ruby-sdk/models/security_role_setting.rb', line 221

def valid?
  add_level_validator = EnumAttributeValidator.new('String', ["All", "My", "None"])
  return false unless add_level_validator.valid?(@add_level)
  edit_level_validator = EnumAttributeValidator.new('String', ["All", "My", "None"])
  return false unless edit_level_validator.valid?(@edit_level)
  delete_level_validator = EnumAttributeValidator.new('String', ["All", "My", "None"])
  return false unless delete_level_validator.valid?(@delete_level)
  inquire_level_validator = EnumAttributeValidator.new('String', ["All", "My", "None"])
  return false unless inquire_level_validator.valid?(@inquire_level)
  return false if !@module_function_name.nil? && @module_function_name.to_s.length > 10
  return false if !@module_function_description.nil? && @module_function_description.to_s.length > 50
  return false if !@module_function_identifier.nil? && @module_function_identifier.to_s.length > 5
  return false if !@module_description.nil? && @module_description.to_s.length > 50
  return false if !@module_identifier.nil? && @module_identifier.to_s.length > 20
  return false if !@module_name.nil? && @module_name.to_s.length > 50
  return true
end