Class: ConnectWise::Location

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Location

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
203
204
205
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
# File 'lib/connectwise-ruby-sdk/models/location.rb', line 123

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

end

Instance Attribute Details

#_infoObject

Metadata of the entity



56
57
58
# File 'lib/connectwise-ruby-sdk/models/location.rb', line 56

def _info
  @_info
end

#calendarObject

Returns the value of attribute calendar.



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

def calendar
  @calendar
end

#client_flagObject

Returns the value of attribute client_flag.



47
48
49
# File 'lib/connectwise-ruby-sdk/models/location.rb', line 47

def client_flag
  @client_flag
end

#department_idsObject

Returns the value of attribute department_ids.



51
52
53
# File 'lib/connectwise-ruby-sdk/models/location.rb', line 51

def department_ids
  @department_ids
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#location_flagObject

Returns the value of attribute location_flag.



45
46
47
# File 'lib/connectwise-ruby-sdk/models/location.rb', line 45

def location_flag
  @location_flag
end

#managerObject

Returns the value of attribute manager.



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

def manager
  @manager
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#override_address_line1Object

Returns the value of attribute override_address_line1.



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

def override_address_line1
  @override_address_line1
end

#override_address_line2Object

Returns the value of attribute override_address_line2.



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

def override_address_line2
  @override_address_line2
end

#override_cityObject

Returns the value of attribute override_city.



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

def override_city
  @override_city
end

#override_countryObject

Returns the value of attribute override_country.



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

def override_country
  @override_country
end

#override_fax_numberObject

Returns the value of attribute override_fax_number.



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

def override_fax_number
  @override_fax_number
end

#override_phone_numberObject

Returns the value of attribute override_phone_number.



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

def override_phone_number
  @override_phone_number
end

#override_stateObject

Returns the value of attribute override_state.



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

def override_state
  @override_state
end

#override_zipObject

Returns the value of attribute override_zip.



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

def override_zip
  @override_zip
end

#owa_urlObject

Returns the value of attribute owa_url.



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

def owa_url
  @owa_url
end

#owner_level_idObject

Returns the value of attribute owner_level_id.



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

def owner_level_id
  @owner_level_id
end

#payroll_xrefObject

Returns the value of attribute payroll_xref.



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

def payroll_xref
  @payroll_xref
end

#reports_toObject

Returns the value of attribute reports_to.



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

def reports_to
  @reports_to
end

#sales_repObject

Returns the value of attribute sales_rep.



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

def sales_rep
  @sales_rep
end

#structure_levelObject

Returns the value of attribute structure_level.



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

def structure_level
  @structure_level
end

#time_zone_setupObject

Returns the value of attribute time_zone_setup.



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

def time_zone_setup
  @time_zone_setup
end

#top_navigation_logoObject

Returns the value of attribute top_navigation_logo.



53
54
55
# File 'lib/connectwise-ruby-sdk/models/location.rb', line 53

def 
  @top_navigation_logo
end

#work_role_idsObject

Returns the value of attribute work_role_ids.



49
50
51
# File 'lib/connectwise-ruby-sdk/models/location.rb', line 49

def work_role_ids
  @work_role_ids
end

Class Method Details

.attribute_mapObject

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



60
61
62
63
64
65
66
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/location.rb', line 60

def self.attribute_map
  {
    :'id' => :'id',
    :'owner_level_id' => :'ownerLevelId',
    :'structure_level' => :'structureLevel',
    :'name' => :'name',
    :'manager' => :'manager',
    :'reports_to' => :'reportsTo',
    :'sales_rep' => :'salesRep',
    :'time_zone_setup' => :'timeZoneSetup',
    :'calendar' => :'calendar',
    :'override_address_line1' => :'overrideAddressLine1',
    :'override_address_line2' => :'overrideAddressLine2',
    :'override_city' => :'overrideCity',
    :'override_state' => :'overrideState',
    :'override_zip' => :'overrideZip',
    :'override_country' => :'overrideCountry',
    :'override_phone_number' => :'overridePhoneNumber',
    :'override_fax_number' => :'overrideFaxNumber',
    :'owa_url' => :'owaUrl',
    :'payroll_xref' => :'payrollXref',
    :'location_flag' => :'locationFlag',
    :'client_flag' => :'clientFlag',
    :'work_role_ids' => :'workRoleIds',
    :'department_ids' => :'departmentIds',
    :'top_navigation_logo' => :'topNavigationLogo',
    :'_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
113
114
115
116
117
118
119
# File 'lib/connectwise-ruby-sdk/models/location.rb', line 91

def self.swagger_types
  {
    :'id' => :'Integer',
    :'owner_level_id' => :'Integer',
    :'structure_level' => :'CorporateStructureLevelReference',
    :'name' => :'String',
    :'manager' => :'MemberReference',
    :'reports_to' => :'SystemLocationReference',
    :'sales_rep' => :'String',
    :'time_zone_setup' => :'TimeZoneSetupReference',
    :'calendar' => :'CalendarReference',
    :'override_address_line1' => :'String',
    :'override_address_line2' => :'String',
    :'override_city' => :'String',
    :'override_state' => :'String',
    :'override_zip' => :'String',
    :'override_country' => :'CountryReference',
    :'override_phone_number' => :'String',
    :'override_fax_number' => :'String',
    :'owa_url' => :'String',
    :'payroll_xref' => :'String',
    :'location_flag' => :'BOOLEAN',
    :'client_flag' => :'BOOLEAN',
    :'work_role_ids' => :'Array<Integer>',
    :'department_ids' => :'Array<Integer>',
    :'top_navigation_logo' => :'DocumentReference',
    :'_info' => :'Metadata'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
# File 'lib/connectwise-ruby-sdk/models/location.rb', line 439

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      owner_level_id == o.owner_level_id &&
      structure_level == o.structure_level &&
      name == o.name &&
      manager == o.manager &&
      reports_to == o.reports_to &&
      sales_rep == o.sales_rep &&
      time_zone_setup == o.time_zone_setup &&
      calendar == o.calendar &&
      override_address_line1 == o.override_address_line1 &&
      override_address_line2 == o.override_address_line2 &&
      override_city == o.override_city &&
      override_state == o.override_state &&
      override_zip == o.override_zip &&
      override_country == o.override_country &&
      override_phone_number == o.override_phone_number &&
      override_fax_number == o.override_fax_number &&
      owa_url == o.owa_url &&
      payroll_xref == o.payroll_xref &&
      location_flag == o.location_flag &&
      client_flag == o.client_flag &&
      work_role_ids == o.work_role_ids &&
      department_ids == o.department_ids &&
       == o. &&
      _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



505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
# File 'lib/connectwise-ruby-sdk/models/location.rb', line 505

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



571
572
573
574
575
576
577
578
579
580
581
582
583
# File 'lib/connectwise-ruby-sdk/models/location.rb', line 571

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



484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
# File 'lib/connectwise-ruby-sdk/models/location.rb', line 484

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


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

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



477
478
479
# File 'lib/connectwise-ruby-sdk/models/location.rb', line 477

def hash
  [id, owner_level_id, structure_level, name, manager, reports_to, sales_rep, time_zone_setup, calendar, override_address_line1, override_address_line2, override_city, override_state, override_zip, override_country, override_phone_number, override_fax_number, owa_url, payroll_xref, location_flag, client_flag, work_role_ids, department_ids, , _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



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/connectwise-ruby-sdk/models/location.rb', line 237

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

  if @name.nil?
    invalid_properties.push("invalid value for 'name', name cannot be nil.")
  end

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

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

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

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

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

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

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

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

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

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

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



551
552
553
# File 'lib/connectwise-ruby-sdk/models/location.rb', line 551

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



557
558
559
560
561
562
563
564
565
# File 'lib/connectwise-ruby-sdk/models/location.rb', line 557

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



545
546
547
# File 'lib/connectwise-ruby-sdk/models/location.rb', line 545

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



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/connectwise-ruby-sdk/models/location.rb', line 296

def valid?
  return false if @structure_level.nil?
  return false if @name.nil?
  return false if @name.to_s.length > 50
  return false if !@sales_rep.nil? && @sales_rep.to_s.length > 50
  return false if !@override_address_line1.nil? && @override_address_line1.to_s.length > 50
  return false if !@override_address_line2.nil? && @override_address_line2.to_s.length > 50
  return false if !@override_city.nil? && @override_city.to_s.length > 50
  return false if !@override_state.nil? && @override_state.to_s.length > 50
  return false if !@override_zip.nil? && @override_zip.to_s.length > 12
  return false if !@override_phone_number.nil? && @override_phone_number.to_s.length > 15
  return false if !@override_fax_number.nil? && @override_fax_number.to_s.length > 15
  return false if !@owa_url.nil? && @owa_url.to_s.length > 100
  return false if !@payroll_xref.nil? && @payroll_xref.to_s.length > 10
  return true
end