Class: ConnectWise::TrackAction

Inherits:
Object
  • Object
show all
Defined in:
lib/connect_wise/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

Raises:

  • (ArgumentError)


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
# File 'lib/connect_wise/models/track_action.rb', line 116

def initialize(attributes = {})
  raise ArgumentError, 'The input argument (attributes) must be a hash in `ConnectWise::TrackAction` initialize method' unless attributes.is_a?(Hash)

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

    h[k.to_sym] = v
  end

  self.notify_type = attributes[:notify_type] if attributes.key?(:notify_type)

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

  self.service_template = attributes[:service_template] if attributes.key?(:service_template)

  self.specific_member_to = attributes[:specific_member_to] if attributes.key?(:specific_member_to)

  self.email_recipient = attributes[:email_recipient] if attributes.key?(:email_recipient)

  self.specific_member_from = attributes[:specific_member_from] if attributes.key?(:specific_member_from)

  self.email_from = attributes[:email_from] if attributes.key?(:email_from)

  self.subject = attributes[:subject] if attributes.key?(:subject)

  self.notes = attributes[:notes] if attributes.key?(:notes)

  self.activity_type = attributes[:activity_type] if attributes.key?(:activity_type)

  self.activity_status = attributes[:activity_status] if attributes.key?(:activity_status)

  self.company_status = attributes[:company_status] if attributes.key?(:company_status)

  self.track = attributes[:track] if attributes.key?(:track)

  self.attached_track = attributes[:attached_track] if attributes.key?(:attached_track)

  self.group = attributes[:group] if attributes.key?(:group)

  self.cc_contact = attributes[:cc_contact] if attributes.key?(:cc_contact)

  self.bcc_contact = attributes[:bcc_contact] if attributes.key?(:bcc_contact)

  self.days_to_execute = attributes[:days_to_execute] if attributes.key?(:days_to_execute)

  self.notify_who = attributes[:notify_who] if attributes.key?(:notify_who)

  self.notify_from = attributes[:notify_from] if attributes.key?(:notify_from)

  return unless attributes.key?(:_info)
  return unless (value = attributes[:_info]).is_a?(Hash)

  self._info = value
end

Instance Attribute Details

#_infoObject

Returns the value of attribute _info.



16
17
18
# File 'lib/connect_wise/models/track_action.rb', line 16

def _info
  @_info
end

#activity_statusObject

Returns the value of attribute activity_status.



16
17
18
# File 'lib/connect_wise/models/track_action.rb', line 16

def activity_status
  @activity_status
end

#activity_typeObject

Returns the value of attribute activity_type.



16
17
18
# File 'lib/connect_wise/models/track_action.rb', line 16

def activity_type
  @activity_type
end

#attached_trackObject

Returns the value of attribute attached_track.



16
17
18
# File 'lib/connect_wise/models/track_action.rb', line 16

def attached_track
  @attached_track
end

#bcc_contactObject

Returns the value of attribute bcc_contact.



16
17
18
# File 'lib/connect_wise/models/track_action.rb', line 16

def bcc_contact
  @bcc_contact
end

#cc_contactObject

Returns the value of attribute cc_contact.



16
17
18
# File 'lib/connect_wise/models/track_action.rb', line 16

def cc_contact
  @cc_contact
end

#company_statusObject

Returns the value of attribute company_status.



16
17
18
# File 'lib/connect_wise/models/track_action.rb', line 16

def company_status
  @company_status
end

#days_to_executeObject

Returns the value of attribute days_to_execute.



16
17
18
# File 'lib/connect_wise/models/track_action.rb', line 16

def days_to_execute
  @days_to_execute
end

#email_fromObject

Max length: 250;



22
23
24
# File 'lib/connect_wise/models/track_action.rb', line 22

def email_from
  @email_from
end

#email_recipientObject

Max length: 250;



19
20
21
# File 'lib/connect_wise/models/track_action.rb', line 19

def email_recipient
  @email_recipient
end

#groupObject

Returns the value of attribute group.



16
17
18
# File 'lib/connect_wise/models/track_action.rb', line 16

def group
  @group
end

#idObject

Returns the value of attribute id.



16
17
18
# File 'lib/connect_wise/models/track_action.rb', line 16

def id
  @id
end

#notesObject

Returns the value of attribute notes.



16
17
18
# File 'lib/connect_wise/models/track_action.rb', line 16

def notes
  @notes
end

#notify_fromObject

Returns the value of attribute notify_from.



16
17
18
# File 'lib/connect_wise/models/track_action.rb', line 16

def notify_from
  @notify_from
end

#notify_typeObject

Returns the value of attribute notify_type.



16
17
18
# File 'lib/connect_wise/models/track_action.rb', line 16

def notify_type
  @notify_type
end

#notify_whoObject

Returns the value of attribute notify_who.



16
17
18
# File 'lib/connect_wise/models/track_action.rb', line 16

def notify_who
  @notify_who
end

#service_templateObject

Returns the value of attribute service_template.



16
17
18
# File 'lib/connect_wise/models/track_action.rb', line 16

def service_template
  @service_template
end

#specific_member_fromObject

Returns the value of attribute specific_member_from.



16
17
18
# File 'lib/connect_wise/models/track_action.rb', line 16

def specific_member_from
  @specific_member_from
end

#specific_member_toObject

Returns the value of attribute specific_member_to.



16
17
18
# File 'lib/connect_wise/models/track_action.rb', line 16

def specific_member_to
  @specific_member_to
end

#subjectObject

Max length: 100;



25
26
27
# File 'lib/connect_wise/models/track_action.rb', line 25

def subject
  @subject
end

#trackObject

Returns the value of attribute track.



16
17
18
# File 'lib/connect_wise/models/track_action.rb', line 16

def track
  @track
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



76
77
78
# File 'lib/connect_wise/models/track_action.rb', line 76

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/connect_wise/models/track_action.rb', line 49

def self.attribute_map
  {
    notify_type: :notifyType,
    id: :id,
    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,
    attached_track: :attachedTrack,
    group: :group,
    cc_contact: :ccContact,
    bcc_contact: :bccContact,
    days_to_execute: :daysToExecute,
    notify_who: :notifyWho,
    notify_from: :notifyFrom,
    _info: :_info
  }
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



245
246
247
# File 'lib/connect_wise/models/track_action.rb', line 245

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

.openapi_nullableObject

List of attributes with nullable: true



108
109
110
111
112
# File 'lib/connect_wise/models/track_action.rb', line 108

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

.openapi_typesObject

Attribute type mapping.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/connect_wise/models/track_action.rb', line 81

def self.openapi_types
  {
    notify_type: :String,
    id: :Integer,
    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,
    attached_track: :TrackReference,
    group: :GroupReference,
    cc_contact: :ContactReference,
    bcc_contact: :ContactReference,
    days_to_execute: :Integer,
    notify_who: :NotificationRecipientReference,
    notify_from: :NotificationRecipientReference,
    _info: :'Hash<String, String>'
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
# File 'lib/connect_wise/models/track_action.rb', line 203

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    notify_type == other.notify_type &&
    id == other.id &&
    service_template == other.service_template &&
    specific_member_to == other.specific_member_to &&
    email_recipient == other.email_recipient &&
    specific_member_from == other.specific_member_from &&
    email_from == other.email_from &&
    subject == other.subject &&
    notes == other.notes &&
    activity_type == other.activity_type &&
    activity_status == other.activity_status &&
    company_status == other.company_status &&
    track == other.track &&
    attached_track == other.attached_track &&
    group == other.group &&
    cc_contact == other.cc_contact &&
    bcc_contact == other.bcc_contact &&
    days_to_execute == other.days_to_execute &&
    notify_who == other.notify_who &&
    notify_from == other.notify_from &&
    _info == other._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



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
# File 'lib/connect_wise/models/track_action.rb', line 275

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 = ConnectWise.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



346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'lib/connect_wise/models/track_action.rb', line 346

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



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/connect_wise/models/track_action.rb', line 252

def build_from_hash(attributes)
  return nil 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)
      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
      send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }) if attributes[self.class.attribute_map[key]].is_a?(Array)
    elsif !attributes[self.class.attribute_map[key]].nil?
      send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


232
233
234
# File 'lib/connect_wise/models/track_action.rb', line 232

def eql?(other)
  self == other
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



238
239
240
# File 'lib/connect_wise/models/track_action.rb', line 238

def hash
  [notify_type, id, service_template, specific_member_to, email_recipient, specific_member_from, email_from, subject, notes, activity_type, activity_status, company_status, track, attached_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 properties with the reasons



174
175
176
177
178
179
# File 'lib/connect_wise/models/track_action.rb', line 174

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

  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



322
323
324
# File 'lib/connect_wise/models/track_action.rb', line 322

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



328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/connect_wise/models/track_action.rb', line 328

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = 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



316
317
318
# File 'lib/connect_wise/models/track_action.rb', line 316

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



183
184
185
186
187
188
189
190
# File 'lib/connect_wise/models/track_action.rb', line 183

def valid?
  return false if @notify_type.nil?

  notify_type_validator = EnumAttributeValidator.new('String', %w[CreateActivity SendEmail AddToGroup AttachTrack ChangeCompanyStatus CreateServiceTicket])
  return false unless notify_type_validator.valid?(@notify_type)

  true
end