Class: Propertyware::WorkOrder

Inherits:
Object
  • Object
show all
Defined in:
lib/propertyware/models/work_order.rb

Overview

Work Order

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ WorkOrder

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/propertyware/models/work_order.rb', line 241

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Propertyware::WorkOrder` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Propertyware::WorkOrder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'age')
    self.age = attributes[:'age']
  end

  if attributes.key?(:'approved')
    self.approved = attributes[:'approved']
  end

  if attributes.key?(:'approved_date')
    self.approved_date = attributes[:'approved_date']
  end

  if attributes.key?(:'assigned_vendors')
    if (value = attributes[:'assigned_vendors']).is_a?(Array)
      self.assigned_vendors = value
    end
  end

  if attributes.key?(:'authorize_enter')
    self.authorize_enter = attributes[:'authorize_enter']
  end

  if attributes.key?(:'building_id')
    self.building_id = attributes[:'building_id']
  end

  if attributes.key?(:'category')
    self.category = attributes[:'category']
  end

  if attributes.key?(:'completed_date')
    self.completed_date = attributes[:'completed_date']
  end

  if attributes.key?(:'contract_number')
    self.contract_number = attributes[:'contract_number']
  end

  if attributes.key?(:'cost_estimate')
    self.cost_estimate = attributes[:'cost_estimate']
  end

  if attributes.key?(:'created_by')
    self.created_by = attributes[:'created_by']
  end

  if attributes.key?(:'created_date_time')
    self.created_date_time = attributes[:'created_date_time']
  end

  if attributes.key?(:'custom_fields')
    if (value = attributes[:'custom_fields']).is_a?(Array)
      self.custom_fields = value
    end
  end

  if attributes.key?(:'date_to_enter')
    self.date_to_enter = attributes[:'date_to_enter']
  end

  if attributes.key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.key?(:'hour_estimate')
    self.hour_estimate = attributes[:'hour_estimate']
  end

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

  if attributes.key?(:'last_modified_by')
    self.last_modified_by = attributes[:'last_modified_by']
  end

  if attributes.key?(:'last_modified_date_time')
    self.last_modified_date_time = attributes[:'last_modified_date_time']
  end

  if attributes.key?(:'lease')
    self.lease = attributes[:'lease']
  end

  if attributes.key?(:'location')
    self.location = attributes[:'location']
  end

  if attributes.key?(:'maintenance_notice')
    self.maintenance_notice = attributes[:'maintenance_notice']
  end

  if attributes.key?(:'managed_by')
    self.managed_by = attributes[:'managed_by']
  end

  if attributes.key?(:'number')
    self.number = attributes[:'number']
  end

  if attributes.key?(:'portfolio_id')
    self.portfolio_id = attributes[:'portfolio_id']
  end

  if attributes.key?(:'priority')
    self.priority = attributes[:'priority']
  end

  if attributes.key?(:'requested_by')
    self.requested_by = attributes[:'requested_by']
  end

  if attributes.key?(:'required_materials')
    self.required_materials = attributes[:'required_materials']
  end

  if attributes.key?(:'scheduled_end_date')
    self.scheduled_end_date = attributes[:'scheduled_end_date']
  end

  if attributes.key?(:'search_tag')
    self.search_tag = attributes[:'search_tag']
  end

  if attributes.key?(:'source')
    self.source = attributes[:'source']
  end

  if attributes.key?(:'specific_location')
    self.specific_location = attributes[:'specific_location']
  end

  if attributes.key?(:'start_date')
    self.start_date = attributes[:'start_date']
  end

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.key?(:'type')
    self.type = attributes[:'type']
  end
end

Instance Attribute Details

#ageObject

Number of days that have passed since the work order was created.



20
21
22
# File 'lib/propertyware/models/work_order.rb', line 20

def age
  @age
end

#approvedObject

Indicates if work order is approved.



23
24
25
# File 'lib/propertyware/models/work_order.rb', line 23

def approved
  @approved
end

#approved_dateObject

Work order approved Date.



26
27
28
# File 'lib/propertyware/models/work_order.rb', line 26

def approved_date
  @approved_date
end

#assigned_vendorsObject

List of vendors attached to the work order.



29
30
31
# File 'lib/propertyware/models/work_order.rb', line 29

def assigned_vendors
  @assigned_vendors
end

#authorize_enterObject

Indicates if the tenant has granted your management staff access to enter his or her buildings and/or units.



32
33
34
# File 'lib/propertyware/models/work_order.rb', line 32

def authorize_enter
  @authorize_enter
end

#building_idObject

Id of the building associated with this work order.



35
36
37
# File 'lib/propertyware/models/work_order.rb', line 35

def building_id
  @building_id
end

#categoryObject

This classifies the work order into a category.



38
39
40
# File 'lib/propertyware/models/work_order.rb', line 38

def category
  @category
end

#completed_dateObject

Date on which the work was completed.



41
42
43
# File 'lib/propertyware/models/work_order.rb', line 41

def completed_date
  @completed_date
end

#contract_numberObject

Contract number.



44
45
46
# File 'lib/propertyware/models/work_order.rb', line 44

def contract_number
  @contract_number
end

#cost_estimateObject

This indicates the estimated cost as entered by a person, the actual cost as determined by the work order bills, and the invoiced amount is the amount the owner will see on his or her statement based on the bill and markup/discount amount.



47
48
49
# File 'lib/propertyware/models/work_order.rb', line 47

def cost_estimate
  @cost_estimate
end

#created_byObject

User who created the record.



50
51
52
# File 'lib/propertyware/models/work_order.rb', line 50

def created_by
  @created_by
end

#created_date_timeObject

Date and time the record was created. (Timezone: UTC)



53
54
55
# File 'lib/propertyware/models/work_order.rb', line 53

def created_date_time
  @created_date_time
end

#custom_fieldsObject

Custom fields.



56
57
58
# File 'lib/propertyware/models/work_order.rb', line 56

def custom_fields
  @custom_fields
end

#date_to_enterObject

Authorized date to enter unit.



59
60
61
# File 'lib/propertyware/models/work_order.rb', line 59

def date_to_enter
  @date_to_enter
end

#descriptionObject

This is a detailed description of the problem.



62
63
64
# File 'lib/propertyware/models/work_order.rb', line 62

def description
  @description
end

#hour_estimateObject

Expected number of hours to complete the work order.



65
66
67
# File 'lib/propertyware/models/work_order.rb', line 65

def hour_estimate
  @hour_estimate
end

#idObject

Unique identifier.



68
69
70
# File 'lib/propertyware/models/work_order.rb', line 68

def id
  @id
end

#last_modified_byObject

User who last modified the record.



71
72
73
# File 'lib/propertyware/models/work_order.rb', line 71

def last_modified_by
  @last_modified_by
end

#last_modified_date_timeObject

Date and time the record was last modified. (Timezone: UTC)



74
75
76
# File 'lib/propertyware/models/work_order.rb', line 74

def last_modified_date_time
  @last_modified_date_time
end

#leaseObject

If the work order is attached to an occupied building or unit, this is the lease name of that lease.



77
78
79
# File 'lib/propertyware/models/work_order.rb', line 77

def lease
  @lease
end

#locationObject

Buildings and/or units associated with this work order.



80
81
82
# File 'lib/propertyware/models/work_order.rb', line 80

def location
  @location
end

#maintenance_noticeObject

Maintenance notice defined for the building that the work order is attached to.



83
84
85
# File 'lib/propertyware/models/work_order.rb', line 83

def maintenance_notice
  @maintenance_notice
end

#managed_byObject

Name of the person who is responsible for managing the work order.



86
87
88
# File 'lib/propertyware/models/work_order.rb', line 86

def managed_by
  @managed_by
end

#numberObject

Number assigned to this work order.



89
90
91
# File 'lib/propertyware/models/work_order.rb', line 89

def number
  @number
end

#portfolio_idObject

Id of the portfolio associated with this work order.



92
93
94
# File 'lib/propertyware/models/work_order.rb', line 92

def portfolio_id
  @portfolio_id
end

#priorityObject

This identifies the priority of the work order as low, medium, or high.



95
96
97
# File 'lib/propertyware/models/work_order.rb', line 95

def priority
  @priority
end

#requested_byObject

This identifies the person that reported the problem, typically the tenant or owner associated with the buildings or units.



98
99
100
# File 'lib/propertyware/models/work_order.rb', line 98

def requested_by
  @requested_by
end

#required_materialsObject

List of materials required to complete the work order.



101
102
103
# File 'lib/propertyware/models/work_order.rb', line 101

def required_materials
  @required_materials
end

#scheduled_end_dateObject

Date on which the work is scheduled to be completed.



104
105
106
# File 'lib/propertyware/models/work_order.rb', line 104

def scheduled_end_date
  @scheduled_end_date
end

#search_tagObject

Search tag name.



107
108
109
# File 'lib/propertyware/models/work_order.rb', line 107

def search_tag
  @search_tag
end

#sourceObject

This identifies how the problem was reported, such as telephone, in person, email, etc.



110
111
112
# File 'lib/propertyware/models/work_order.rb', line 110

def source
  @source
end

#specific_locationObject

This describes the location in the buildings or units where the work is needed.



113
114
115
# File 'lib/propertyware/models/work_order.rb', line 113

def specific_location
  @specific_location
end

#start_dateObject

Date on which the work was started.



116
117
118
# File 'lib/propertyware/models/work_order.rb', line 116

def start_date
  @start_date
end

#statusObject

Current status of the work order.



119
120
121
# File 'lib/propertyware/models/work_order.rb', line 119

def status
  @status
end

#typeObject

This classifies the work order into one of the following types: general, service request, turnover, inspection, estimate etc.



122
123
124
# File 'lib/propertyware/models/work_order.rb', line 122

def type
  @type
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



188
189
190
# File 'lib/propertyware/models/work_order.rb', line 188

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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
# File 'lib/propertyware/models/work_order.rb', line 147

def self.attribute_map
  {
    :'age' => :'age',
    :'approved' => :'approved',
    :'approved_date' => :'approvedDate',
    :'assigned_vendors' => :'assignedVendors',
    :'authorize_enter' => :'authorizeEnter',
    :'building_id' => :'buildingID',
    :'category' => :'category',
    :'completed_date' => :'completedDate',
    :'contract_number' => :'contractNumber',
    :'cost_estimate' => :'costEstimate',
    :'created_by' => :'createdBy',
    :'created_date_time' => :'createdDateTime',
    :'custom_fields' => :'customFields',
    :'date_to_enter' => :'dateToEnter',
    :'description' => :'description',
    :'hour_estimate' => :'hourEstimate',
    :'id' => :'id',
    :'last_modified_by' => :'lastModifiedBy',
    :'last_modified_date_time' => :'lastModifiedDateTime',
    :'lease' => :'lease',
    :'location' => :'location',
    :'maintenance_notice' => :'maintenanceNotice',
    :'managed_by' => :'managedBy',
    :'number' => :'number',
    :'portfolio_id' => :'portfolioID',
    :'priority' => :'priority',
    :'requested_by' => :'requestedBy',
    :'required_materials' => :'requiredMaterials',
    :'scheduled_end_date' => :'scheduledEndDate',
    :'search_tag' => :'searchTag',
    :'source' => :'source',
    :'specific_location' => :'specificLocation',
    :'start_date' => :'startDate',
    :'status' => :'status',
    :'type' => :'type'
  }
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



493
494
495
# File 'lib/propertyware/models/work_order.rb', line 493

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



234
235
236
237
# File 'lib/propertyware/models/work_order.rb', line 234

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/propertyware/models/work_order.rb', line 193

def self.openapi_types
  {
    :'age' => :'Integer',
    :'approved' => :'Boolean',
    :'approved_date' => :'Date',
    :'assigned_vendors' => :'Array<BasicVendor>',
    :'authorize_enter' => :'String',
    :'building_id' => :'Integer',
    :'category' => :'String',
    :'completed_date' => :'Date',
    :'contract_number' => :'String',
    :'cost_estimate' => :'Float',
    :'created_by' => :'String',
    :'created_date_time' => :'Time',
    :'custom_fields' => :'Array<CustomField>',
    :'date_to_enter' => :'Time',
    :'description' => :'String',
    :'hour_estimate' => :'Float',
    :'id' => :'Integer',
    :'last_modified_by' => :'String',
    :'last_modified_date_time' => :'Time',
    :'lease' => :'String',
    :'location' => :'String',
    :'maintenance_notice' => :'String',
    :'managed_by' => :'String',
    :'number' => :'Integer',
    :'portfolio_id' => :'Integer',
    :'priority' => :'String',
    :'requested_by' => :'String',
    :'required_materials' => :'String',
    :'scheduled_end_date' => :'Date',
    :'search_tag' => :'String',
    :'source' => :'String',
    :'specific_location' => :'String',
    :'start_date' => :'Date',
    :'status' => :'String',
    :'type' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
463
464
465
466
467
468
469
470
471
472
473
474
475
476
# File 'lib/propertyware/models/work_order.rb', line 438

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      age == o.age &&
      approved == o.approved &&
      approved_date == o.approved_date &&
      assigned_vendors == o.assigned_vendors &&
      authorize_enter == o.authorize_enter &&
      building_id == o.building_id &&
      category == o.category &&
      completed_date == o.completed_date &&
      contract_number == o.contract_number &&
      cost_estimate == o.cost_estimate &&
      created_by == o.created_by &&
      created_date_time == o.created_date_time &&
      custom_fields == o.custom_fields &&
      date_to_enter == o.date_to_enter &&
      description == o.description &&
      hour_estimate == o.hour_estimate &&
      id == o.id &&
      last_modified_by == o.last_modified_by &&
      last_modified_date_time == o.last_modified_date_time &&
      lease == o.lease &&
      location == o.location &&
      maintenance_notice == o.maintenance_notice &&
      managed_by == o.managed_by &&
      number == o.number &&
      portfolio_id == o.portfolio_id &&
      priority == o.priority &&
      requested_by == o.requested_by &&
      required_materials == o.required_materials &&
      scheduled_end_date == o.scheduled_end_date &&
      search_tag == o.search_tag &&
      source == o.source &&
      specific_location == o.specific_location &&
      start_date == o.start_date &&
      status == o.status &&
      type == o.type
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



524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
# File 'lib/propertyware/models/work_order.rb', line 524

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.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
    # models (e.g. Pet) or oneOf
    klass = Propertyware.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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



595
596
597
598
599
600
601
602
603
604
605
606
607
# File 'lib/propertyware/models/work_order.rb', line 595

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



500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
# File 'lib/propertyware/models/work_order.rb', line 500

def build_from_hash(attributes)
  return unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that 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
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


480
481
482
# File 'lib/propertyware/models/work_order.rb', line 480

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



486
487
488
# File 'lib/propertyware/models/work_order.rb', line 486

def hash
  [age, approved, approved_date, assigned_vendors, authorize_enter, building_id, category, completed_date, contract_number, cost_estimate, created_by, created_date_time, custom_fields, date_to_enter, description, hour_estimate, id, last_modified_by, last_modified_date_time, lease, location, maintenance_notice, managed_by, number, portfolio_id, priority, requested_by, required_materials, scheduled_end_date, search_tag, source, specific_location, start_date, status, type].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



401
402
403
404
# File 'lib/propertyware/models/work_order.rb', line 401

def list_invalid_properties
  invalid_properties = Array.new
  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



571
572
573
# File 'lib/propertyware/models/work_order.rb', line 571

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



577
578
579
580
581
582
583
584
585
586
587
588
589
# File 'lib/propertyware/models/work_order.rb', line 577

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



565
566
567
# File 'lib/propertyware/models/work_order.rb', line 565

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



408
409
410
411
412
413
414
# File 'lib/propertyware/models/work_order.rb', line 408

def valid?
  authorize_enter_validator = EnumAttributeValidator.new('String', ["NO", "ANYTIME", "SPECIFIEDTIME"])
  return false unless authorize_enter_validator.valid?(@authorize_enter)
  priority_validator = EnumAttributeValidator.new('String', ["HIGH", "MEDIUM", "LOW"])
  return false unless priority_validator.valid?(@priority)
  true
end