Class: ConnectWise::TrackAction

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ TrackAction

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
# File 'lib/connectwise-ruby-sdk/models/track_action.rb', line 124

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

end

Instance Attribute Details

#_infoObject

Metadata of the entity



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

def _info
  @_info
end

#activity_statusObject

Returns the value of attribute activity_status.



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

def activity_status
  @activity_status
end

#activity_typeObject

Returns the value of attribute activity_type.



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

def activity_type
  @activity_type
end

#bcc_contactObject

Returns the value of attribute bcc_contact.



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

def bcc_contact
  @bcc_contact
end

#cc_contactObject

Returns the value of attribute cc_contact.



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

def cc_contact
  @cc_contact
end

#company_statusObject

Returns the value of attribute company_status.



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

def company_status
  @company_status
end

#days_to_executeObject

Returns the value of attribute days_to_execute.



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

def days_to_execute
  @days_to_execute
end

#email_fromObject

Returns the value of attribute email_from.



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

def email_from
  @email_from
end

#email_recipientObject

Returns the value of attribute email_recipient.



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

def email_recipient
  @email_recipient
end

#groupObject

Returns the value of attribute group.



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

def group
  @group
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#notesObject

Returns the value of attribute notes.



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

def notes
  @notes
end

#notify_fromObject

Returns the value of attribute notify_from.



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

def notify_from
  @notify_from
end

#notify_typeObject

Returns the value of attribute notify_type.



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

def notify_type
  @notify_type
end

#notify_whoObject

Returns the value of attribute notify_who.



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

def notify_who
  @notify_who
end

#service_templateObject

Returns the value of attribute service_template.



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

def service_template
  @service_template
end

#specific_member_fromObject

Returns the value of attribute specific_member_from.



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

def specific_member_from
  @specific_member_from
end

#specific_member_toObject

Returns the value of attribute specific_member_to.



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

def specific_member_to
  @specific_member_to
end

#subjectObject

Returns the value of attribute subject.



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

def subject
  @subject
end

#trackObject

Returns the value of attribute track.



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

def track
  @track
end

Class Method Details

.attribute_mapObject

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



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/connectwise-ruby-sdk/models/track_action.rb', line 71

def self.attribute_map
  {
    :'id' => :'id',
    :'notify_type' => :'notifyType',
    :'service_template' => :'serviceTemplate',
    :'specific_member_to' => :'specificMemberTo',
    :'email_recipient' => :'emailRecipient',
    :'specific_member_from' => :'specificMemberFrom',
    :'email_from' => :'emailFrom',
    :'subject' => :'subject',
    :'notes' => :'notes',
    :'activity_type' => :'activityType',
    :'activity_status' => :'activityStatus',
    :'company_status' => :'companyStatus',
    :'track' => :'track',
    :'group' => :'group',
    :'cc_contact' => :'ccContact',
    :'bcc_contact' => :'bccContact',
    :'days_to_execute' => :'daysToExecute',
    :'notify_who' => :'notifyWho',
    :'notify_from' => :'notifyFrom',
    :'_info' => :'_info'
  }
end

.swagger_typesObject

Attribute type mapping.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/connectwise-ruby-sdk/models/track_action.rb', line 97

def self.swagger_types
  {
    :'id' => :'Integer',
    :'notify_type' => :'String',
    :'service_template' => :'ServiceTemplateReference',
    :'specific_member_to' => :'MemberReference',
    :'email_recipient' => :'String',
    :'specific_member_from' => :'MemberReference',
    :'email_from' => :'String',
    :'subject' => :'String',
    :'notes' => :'String',
    :'activity_type' => :'ActivityTypeReference',
    :'activity_status' => :'ActivityStatusReference',
    :'company_status' => :'CompanyStatusReference',
    :'track' => :'TrackReference',
    :'group' => :'GroupReference',
    :'cc_contact' => :'ContactReference',
    :'bcc_contact' => :'ContactReference',
    :'days_to_execute' => :'Integer',
    :'notify_who' => :'NotificationRecipientReference',
    :'notify_from' => :'NotificationRecipientReference',
    :'_info' => :'Metadata'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/connectwise-ruby-sdk/models/track_action.rb', line 317

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      notify_type == o.notify_type &&
      service_template == o.service_template &&
      specific_member_to == o.specific_member_to &&
      email_recipient == o.email_recipient &&
      specific_member_from == o.specific_member_from &&
      email_from == o.email_from &&
      subject == o.subject &&
      notes == o.notes &&
      activity_type == o.activity_type &&
      activity_status == o.activity_status &&
      company_status == o.company_status &&
      track == o.track &&
      group == o.group &&
      cc_contact == o.cc_contact &&
      bcc_contact == o.bcc_contact &&
      days_to_execute == o.days_to_execute &&
      notify_who == o.notify_who &&
      notify_from == o.notify_from &&
      _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



378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/connectwise-ruby-sdk/models/track_action.rb', line 378

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



444
445
446
447
448
449
450
451
452
453
454
455
456
# File 'lib/connectwise-ruby-sdk/models/track_action.rb', line 444

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



357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
# File 'lib/connectwise-ruby-sdk/models/track_action.rb', line 357

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


344
345
346
# File 'lib/connectwise-ruby-sdk/models/track_action.rb', line 344

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



350
351
352
# File 'lib/connectwise-ruby-sdk/models/track_action.rb', line 350

def hash
  [id, notify_type, service_template, specific_member_to, email_recipient, specific_member_from, email_from, subject, notes, activity_type, activity_status, company_status, track, group, cc_contact, bcc_contact, days_to_execute, notify_who, notify_from, _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



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
# File 'lib/connectwise-ruby-sdk/models/track_action.rb', line 214

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

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

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

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

  if !@days_to_execute.nil? && @days_to_execute > 9999
    invalid_properties.push("invalid value for 'days_to_execute', must be smaller than or equal to 9999.")
  end

  if !@days_to_execute.nil? && @days_to_execute < 0
    invalid_properties.push("invalid value for 'days_to_execute', must be greater than or equal to 0.")
  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



424
425
426
# File 'lib/connectwise-ruby-sdk/models/track_action.rb', line 424

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



430
431
432
433
434
435
436
437
438
# File 'lib/connectwise-ruby-sdk/models/track_action.rb', line 430

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



418
419
420
# File 'lib/connectwise-ruby-sdk/models/track_action.rb', line 418

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



245
246
247
248
249
250
251
252
253
254
255
# File 'lib/connectwise-ruby-sdk/models/track_action.rb', line 245

def valid?
  return false if @notify_type.nil?
  notify_type_validator = EnumAttributeValidator.new('String', ["AddToGroup", "ChangeCompanyStatus", "CreateActivity", "CreateServiceTicket", "SendEmail"])
  return false unless notify_type_validator.valid?(@notify_type)
  return false if !@email_recipient.nil? && @email_recipient.to_s.length > 250
  return false if !@email_from.nil? && @email_from.to_s.length > 250
  return false if !@subject.nil? && @subject.to_s.length > 100
  return false if !@days_to_execute.nil? && @days_to_execute > 9999
  return false if !@days_to_execute.nil? && @days_to_execute < 0
  return true
end