Class: UltracartClient::WorkflowTask

Inherits:
Object
  • Object
show all
Defined in:
lib/ultracart_api/models/workflow_task.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ WorkflowTask

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
234
235
236
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
# File 'lib/ultracart_api/models/workflow_task.rb', line 162

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#assigned_to_groupObject

Assigned to group



18
19
20
# File 'lib/ultracart_api/models/workflow_task.rb', line 18

def assigned_to_group
  @assigned_to_group
end

#assigned_to_group_idObject

Assigned to group ID



21
22
23
# File 'lib/ultracart_api/models/workflow_task.rb', line 21

def assigned_to_group_id
  @assigned_to_group_id
end

#assigned_to_userObject

Assigned to user



24
25
26
# File 'lib/ultracart_api/models/workflow_task.rb', line 24

def assigned_to_user
  @assigned_to_user
end

#assigned_to_user_idObject

Assigned to user ID



27
28
29
# File 'lib/ultracart_api/models/workflow_task.rb', line 27

def assigned_to_user_id
  @assigned_to_user_id
end

#attachmentsObject

Attachments to the Workflow Task



30
31
32
# File 'lib/ultracart_api/models/workflow_task.rb', line 30

def attachments
  @attachments
end

#created_byObject

Returns the value of attribute created_by.



32
33
34
# File 'lib/ultracart_api/models/workflow_task.rb', line 32

def created_by
  @created_by
end

#created_dtsObject

Date/time that the workflow task was created



35
36
37
# File 'lib/ultracart_api/models/workflow_task.rb', line 35

def created_dts
  @created_dts
end

#delay_until_dtsObject

Date/time that the workflow task should delay until



38
39
40
# File 'lib/ultracart_api/models/workflow_task.rb', line 38

def delay_until_dts
  @delay_until_dts
end

#due_dtsObject

Date/time that the workflow task is due



41
42
43
# File 'lib/ultracart_api/models/workflow_task.rb', line 41

def due_dts
  @due_dts
end

#historiesObject

Array of history records for the task



44
45
46
# File 'lib/ultracart_api/models/workflow_task.rb', line 44

def histories
  @histories
end

#last_update_dtsObject

Date/time that the workflow task was last updated



47
48
49
# File 'lib/ultracart_api/models/workflow_task.rb', line 47

def last_update_dts
  @last_update_dts
end

#merchant_idObject

Merchant ID



50
51
52
# File 'lib/ultracart_api/models/workflow_task.rb', line 50

def merchant_id
  @merchant_id
end

#notesObject

Notes on the Workflow Task



53
54
55
# File 'lib/ultracart_api/models/workflow_task.rb', line 53

def notes
  @notes
end

#object_emailObject

Object is associated with customer email



56
57
58
# File 'lib/ultracart_api/models/workflow_task.rb', line 56

def object_email
  @object_email
end

#object_idObject

Object ID



59
60
61
# File 'lib/ultracart_api/models/workflow_task.rb', line 59

def object_id
  @object_id
end

#object_typeObject

Object Type



62
63
64
# File 'lib/ultracart_api/models/workflow_task.rb', line 62

def object_type
  @object_type
end

#object_urlObject

Object URL



65
66
67
# File 'lib/ultracart_api/models/workflow_task.rb', line 65

def object_url
  @object_url
end

#priorityObject

Priority



68
69
70
# File 'lib/ultracart_api/models/workflow_task.rb', line 68

def priority
  @priority
end

#statusObject

Status of the workflow task



71
72
73
# File 'lib/ultracart_api/models/workflow_task.rb', line 71

def status
  @status
end

#task_detailsObject

Task Details



74
75
76
# File 'lib/ultracart_api/models/workflow_task.rb', line 74

def task_details
  @task_details
end

#task_nameObject

Task Name



77
78
79
# File 'lib/ultracart_api/models/workflow_task.rb', line 77

def task_name
  @task_name
end

#workflow_task_uuidObject

Workflow Task UUID



80
81
82
# File 'lib/ultracart_api/models/workflow_task.rb', line 80

def workflow_task_uuid
  @workflow_task_uuid
end

Class Method Details

.attribute_mapObject

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



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/ultracart_api/models/workflow_task.rb', line 105

def self.attribute_map
  {
    :'assigned_to_group' => :'assigned_to_group',
    :'assigned_to_group_id' => :'assigned_to_group_id',
    :'assigned_to_user' => :'assigned_to_user',
    :'assigned_to_user_id' => :'assigned_to_user_id',
    :'attachments' => :'attachments',
    :'created_by' => :'created_by',
    :'created_dts' => :'created_dts',
    :'delay_until_dts' => :'delay_until_dts',
    :'due_dts' => :'due_dts',
    :'histories' => :'histories',
    :'last_update_dts' => :'last_update_dts',
    :'merchant_id' => :'merchant_id',
    :'notes' => :'notes',
    :'object_email' => :'object_email',
    :'object_id' => :'object_id',
    :'object_type' => :'object_type',
    :'object_url' => :'object_url',
    :'priority' => :'priority',
    :'status' => :'status',
    :'task_details' => :'task_details',
    :'task_name' => :'task_name',
    :'workflow_task_uuid' => :'workflow_task_uuid'
  }
end

.swagger_typesObject

Attribute type mapping.



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
# File 'lib/ultracart_api/models/workflow_task.rb', line 133

def self.swagger_types
  {
    :'assigned_to_group' => :'String',
    :'assigned_to_group_id' => :'Integer',
    :'assigned_to_user' => :'String',
    :'assigned_to_user_id' => :'Integer',
    :'attachments' => :'Array<WorkflowAttachment>',
    :'created_by' => :'WorkflowUser',
    :'created_dts' => :'String',
    :'delay_until_dts' => :'String',
    :'due_dts' => :'String',
    :'histories' => :'Array<WorkflowTaskHistory>',
    :'last_update_dts' => :'String',
    :'merchant_id' => :'String',
    :'notes' => :'Array<WorkflowNote>',
    :'object_email' => :'String',
    :'object_id' => :'String',
    :'object_type' => :'String',
    :'object_url' => :'String',
    :'priority' => :'String',
    :'status' => :'String',
    :'task_details' => :'String',
    :'task_name' => :'String',
    :'workflow_task_uuid' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
# File 'lib/ultracart_api/models/workflow_task.rb', line 314

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      assigned_to_group == o.assigned_to_group &&
      assigned_to_group_id == o.assigned_to_group_id &&
      assigned_to_user == o.assigned_to_user &&
      assigned_to_user_id == o.assigned_to_user_id &&
      attachments == o.attachments &&
      created_by == o.created_by &&
      created_dts == o.created_dts &&
      delay_until_dts == o.delay_until_dts &&
      due_dts == o.due_dts &&
      histories == o.histories &&
      last_update_dts == o.last_update_dts &&
      merchant_id == o.merchant_id &&
      notes == o.notes &&
      object_email == o.object_email &&
      object_id == o.object_id &&
      object_type == o.object_type &&
      object_url == o.object_url &&
      priority == o.priority &&
      status == o.status &&
      task_details == o.task_details &&
      task_name == o.task_name &&
      workflow_task_uuid == o.workflow_task_uuid
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



377
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
# File 'lib/ultracart_api/models/workflow_task.rb', line 377

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



443
444
445
446
447
448
449
450
451
452
453
454
455
# File 'lib/ultracart_api/models/workflow_task.rb', line 443

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



356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# File 'lib/ultracart_api/models/workflow_task.rb', line 356

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 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


343
344
345
# File 'lib/ultracart_api/models/workflow_task.rb', line 343

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



349
350
351
# File 'lib/ultracart_api/models/workflow_task.rb', line 349

def hash
  [assigned_to_group, assigned_to_group_id, assigned_to_user, assigned_to_user_id, attachments, created_by, created_dts, delay_until_dts, due_dts, histories, last_update_dts, merchant_id, notes, object_email, object_id, object_type, object_url, priority, status, task_details, task_name, workflow_task_uuid].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



265
266
267
268
# File 'lib/ultracart_api/models/workflow_task.rb', line 265

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



423
424
425
# File 'lib/ultracart_api/models/workflow_task.rb', line 423

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



429
430
431
432
433
434
435
436
437
# File 'lib/ultracart_api/models/workflow_task.rb', line 429

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



417
418
419
# File 'lib/ultracart_api/models/workflow_task.rb', line 417

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



272
273
274
275
276
277
278
279
280
# File 'lib/ultracart_api/models/workflow_task.rb', line 272

def valid?
  object_type_validator = EnumAttributeValidator.new('String', ['order', 'auto order', 'item', 'customer profile'])
  return false unless object_type_validator.valid?(@object_type)
  priority_validator = EnumAttributeValidator.new('String', ['1 - low', '2 - medium', '3 - high', '4 - critical'])
  return false unless priority_validator.valid?(@priority)
  status_validator = EnumAttributeValidator.new('String', ['open', 'closed', 'delayed', 'awaiting customer feedback'])
  return false unless status_validator.valid?(@status)
  true
end