Class: ConnectWise::PortalConfiguration

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ PortalConfiguration

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/connectwise-ruby-sdk/models/portal_configuration.rb', line 116

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?(:'name')
    self.name = attributes[:'name']
  end

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

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

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

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

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

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

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

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

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

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

  if attributes.has_key?(:'boardIds')
    if (value = attributes[:'boardIds']).is_a?(Array)
      self.board_ids = value
    end
  end

  if attributes.has_key?(:'agreementTypeIds')
    if (value = attributes[:'agreementTypeIds']).is_a?(Array)
      self.agreement_type_ids = value
    end
  end

  if attributes.has_key?(:'configTypeIds')
    if (value = attributes[:'configTypeIds']).is_a?(Array)
      self.config_type_ids = value
    end
  end

  if attributes.has_key?(:'locationIds')
    if (value = attributes[:'locationIds']).is_a?(Array)
      self.location_ids = value
    end
  end

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

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

end

Instance Attribute Details

#_infoObject

Metadata of the entity



42
43
44
# File 'lib/connectwise-ruby-sdk/models/portal_configuration.rb', line 42

def _info
  @_info
end

#agreement_type_idsObject

Returns the value of attribute agreement_type_ids.



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

def agreement_type_ids
  @agreement_type_ids
end

#board_idsObject

Returns the value of attribute board_ids.



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

def board_ids
  @board_ids
end

#button_colorObject

Returns the value of attribute button_color.



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

def button_color
  @button_color
end

#companyObject

Returns the value of attribute company.



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

def company
  @company
end

#config_type_idsObject

Returns the value of attribute config_type_ids.



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

def config_type_ids
  @config_type_ids
end

#default_flagObject

Returns the value of attribute default_flag.



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

def default_flag
  @default_flag
end

#display_vendor_flagObject

Returns the value of attribute display_vendor_flag.



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

def display_vendor_flag
  @display_vendor_flag
end

#header_colorObject

Returns the value of attribute header_color.



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

def header_color
  @header_color
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#languageObject

Returns the value of attribute language.



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

def language
  @language
end

#location_idsObject

Returns the value of attribute location_ids.



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

def location_ids
  @location_ids
end

#login_background_colorObject

Returns the value of attribute login_background_color.



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

def 
  @login_background_color
end

Returns the value of attribute menu_color.



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

def menu_color
  @menu_color
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#portal_background_colorObject

Returns the value of attribute portal_background_color.



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

def portal_background_color
  @portal_background_color
end

#urlObject

Returns the value of attribute url.



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

def url
  @url
end

#welcome_textObject

Returns the value of attribute welcome_text.



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

def welcome_text
  @welcome_text
end

Class Method Details

.attribute_mapObject

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



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

def self.attribute_map
  {
    :'id' => :'id',
    :'name' => :'name',
    :'default_flag' => :'defaultFlag',
    :'company' => :'company',
    :'login_background_color' => :'loginBackgroundColor',
    :'portal_background_color' => :'portalBackgroundColor',
    :'menu_color' => :'menuColor',
    :'button_color' => :'buttonColor',
    :'header_color' => :'headerColor',
    :'url' => :'url',
    :'language' => :'language',
    :'welcome_text' => :'welcomeText',
    :'board_ids' => :'boardIds',
    :'agreement_type_ids' => :'agreementTypeIds',
    :'config_type_ids' => :'configTypeIds',
    :'location_ids' => :'locationIds',
    :'display_vendor_flag' => :'displayVendorFlag',
    :'_info' => :'_info'
  }
end

.swagger_typesObject

Attribute type mapping.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/connectwise-ruby-sdk/models/portal_configuration.rb', line 91

def self.swagger_types
  {
    :'id' => :'Integer',
    :'name' => :'String',
    :'default_flag' => :'BOOLEAN',
    :'company' => :'CompanyReference',
    :'login_background_color' => :'String',
    :'portal_background_color' => :'String',
    :'menu_color' => :'String',
    :'button_color' => :'String',
    :'header_color' => :'String',
    :'url' => :'String',
    :'language' => :'String',
    :'welcome_text' => :'String',
    :'board_ids' => :'Array<Integer>',
    :'agreement_type_ids' => :'Array<Integer>',
    :'config_type_ids' => :'Array<Integer>',
    :'location_ids' => :'Array<Integer>',
    :'display_vendor_flag' => :'BOOLEAN',
    :'_info' => :'Metadata'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/connectwise-ruby-sdk/models/portal_configuration.rb', line 367

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      name == o.name &&
      default_flag == o.default_flag &&
      company == o.company &&
       == o. &&
      portal_background_color == o.portal_background_color &&
      menu_color == o.menu_color &&
      button_color == o.button_color &&
      header_color == o.header_color &&
      url == o.url &&
      language == o.language &&
      welcome_text == o.welcome_text &&
      board_ids == o.board_ids &&
      agreement_type_ids == o.agreement_type_ids &&
      config_type_ids == o.config_type_ids &&
      location_ids == o.location_ids &&
      display_vendor_flag == o.display_vendor_flag &&
      _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



426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
# File 'lib/connectwise-ruby-sdk/models/portal_configuration.rb', line 426

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



492
493
494
495
496
497
498
499
500
501
502
503
504
# File 'lib/connectwise-ruby-sdk/models/portal_configuration.rb', line 492

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



405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
# File 'lib/connectwise-ruby-sdk/models/portal_configuration.rb', line 405

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


392
393
394
# File 'lib/connectwise-ruby-sdk/models/portal_configuration.rb', line 392

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



398
399
400
# File 'lib/connectwise-ruby-sdk/models/portal_configuration.rb', line 398

def hash
  [id, name, default_flag, company, , portal_background_color, menu_color, button_color, header_color, url, language, welcome_text, board_ids, agreement_type_ids, config_type_ids, location_ids, display_vendor_flag, _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



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/connectwise-ruby-sdk/models/portal_configuration.rb', line 206

def list_invalid_properties
  invalid_properties = Array.new
  if @name.nil?
    invalid_properties.push("invalid value for 'name', name cannot be nil.")
  end

  if @name.to_s.length > 150
    invalid_properties.push("invalid value for 'name', the character length must be smaller than or equal to 150.")
  end

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

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

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

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

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

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

  if !@welcome_text.nil? && @welcome_text.to_s.length > 4000
    invalid_properties.push("invalid value for 'welcome_text', the character length must be smaller than or equal to 4000.")
  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



472
473
474
# File 'lib/connectwise-ruby-sdk/models/portal_configuration.rb', line 472

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



478
479
480
481
482
483
484
485
486
# File 'lib/connectwise-ruby-sdk/models/portal_configuration.rb', line 478

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



466
467
468
# File 'lib/connectwise-ruby-sdk/models/portal_configuration.rb', line 466

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



249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/connectwise-ruby-sdk/models/portal_configuration.rb', line 249

def valid?
  return false if @name.nil?
  return false if @name.to_s.length > 150
  return false if !@login_background_color.nil? && @login_background_color.to_s.length > 7
  return false if !@portal_background_color.nil? && @portal_background_color.to_s.length > 7
  return false if !@menu_color.nil? && @menu_color.to_s.length > 7
  return false if !@button_color.nil? && @button_color.to_s.length > 7
  return false if !@header_color.nil? && @header_color.to_s.length > 7
  return false if !@url.nil? && @url.to_s.length > 1000
  language_validator = EnumAttributeValidator.new('String', ["English", "Spanish", "French", "British", "Australian", "BrazilianPortuguese", "CanadianFrench", "German", "NewZealand"])
  return false unless language_validator.valid?(@language)
  return false if !@welcome_text.nil? && @welcome_text.to_s.length > 4000
  return true
end