Class: Merge::Ticketing::Ticket

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/ticketing/types/ticket.rb

Overview

# The Ticket Object

### Description
The `Ticket` object is used to represent a ticket or a task within a system.
### Usage Example
TODO

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: OMIT, remote_id: OMIT, created_at: OMIT, modified_at: OMIT, name: OMIT, assignees: OMIT, creator: OMIT, due_date: OMIT, status: OMIT, description: OMIT, collections: OMIT, ticket_type: OMIT, account: OMIT, contact: OMIT, parent_ticket: OMIT, attachments: OMIT, tags: OMIT, remote_created_at: OMIT, remote_updated_at: OMIT, completed_at: OMIT, remote_was_deleted: OMIT, ticket_url: OMIT, priority: OMIT, field_mappings: OMIT, remote_data: OMIT, remote_fields: OMIT, additional_properties: nil) ⇒ Merge::Ticketing::Ticket

Parameters:

  • id (String) (defaults to: OMIT)
  • remote_id (String) (defaults to: OMIT)

    The third-party API ID of the matching object.

  • created_at (DateTime) (defaults to: OMIT)

    The datetime that this object was created by Merge.

  • modified_at (DateTime) (defaults to: OMIT)

    The datetime that this object was modified by Merge.

  • name (String) (defaults to: OMIT)

    The ticket’s name.

  • assignees (Array<Merge::Ticketing::TicketAssigneesItem>) (defaults to: OMIT)
  • creator (Merge::Ticketing::TicketCreator) (defaults to: OMIT)

    The user who created this ticket.

  • due_date (DateTime) (defaults to: OMIT)

    The ticket’s due date.

  • status (Merge::Ticketing::TicketStatusEnum) (defaults to: OMIT)

    The current status of the ticket.

    • ‘OPEN` - OPEN

    • ‘CLOSED` - CLOSED

    • ‘IN_PROGRESS` - IN_PROGRESS

    • ‘ON_HOLD` - ON_HOLD

  • description (String) (defaults to: OMIT)

    The ticket’s description. HTML version of description is mapped if supported by the third-party platform.

  • collections (Array<Merge::Ticketing::TicketCollectionsItem>) (defaults to: OMIT)
  • ticket_type (String) (defaults to: OMIT)

    The sub category of the ticket within the 3rd party system. Examples include incident, task, subtask or to-do.

  • account (Merge::Ticketing::TicketAccount) (defaults to: OMIT)

    The account associated with the ticket.

  • contact (Merge::Ticketing::TicketContact) (defaults to: OMIT)

    The contact associated with the ticket.

  • parent_ticket (Merge::Ticketing::TicketParentTicket) (defaults to: OMIT)

    The ticket’s parent ticket.

  • attachments (Array<Merge::Ticketing::TicketAttachmentsItem>) (defaults to: OMIT)
  • tags (Array<String>) (defaults to: OMIT)
  • remote_created_at (DateTime) (defaults to: OMIT)

    When the third party’s ticket was created.

  • remote_updated_at (DateTime) (defaults to: OMIT)

    When the third party’s ticket was updated.

  • completed_at (DateTime) (defaults to: OMIT)

    When the ticket was completed.

  • remote_was_deleted (Boolean) (defaults to: OMIT)
  • ticket_url (String) (defaults to: OMIT)

    The 3rd party url of the Ticket.

  • priority (Merge::Ticketing::PriorityEnum) (defaults to: OMIT)

    The priority or urgency of the Ticket.

    • ‘URGENT` - URGENT

    • ‘HIGH` - HIGH

    • ‘NORMAL` - NORMAL

    • ‘LOW` - LOW

  • field_mappings (Hash{String => Object}) (defaults to: OMIT)
  • remote_data (Array<Merge::Ticketing::RemoteData>) (defaults to: OMIT)
  • remote_fields (Array<Merge::Ticketing::RemoteField>) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 134

def initialize(id: OMIT, remote_id: OMIT, created_at: OMIT, modified_at: OMIT, name: OMIT, assignees: OMIT,
               creator: OMIT, due_date: OMIT, status: OMIT, description: OMIT, collections: OMIT, ticket_type: OMIT, account: OMIT, contact: OMIT, parent_ticket: OMIT, attachments: OMIT, tags: OMIT, remote_created_at: OMIT, remote_updated_at: OMIT, completed_at: OMIT, remote_was_deleted: OMIT, ticket_url: OMIT, priority: OMIT, field_mappings: OMIT, remote_data: OMIT, remote_fields: OMIT, additional_properties: nil)
  @id = id if id != OMIT
  @remote_id = remote_id if remote_id != OMIT
  @created_at = created_at if created_at != OMIT
  @modified_at = modified_at if modified_at != OMIT
  @name = name if name != OMIT
  @assignees = assignees if assignees != OMIT
  @creator = creator if creator != OMIT
  @due_date = due_date if due_date != OMIT
  @status = status if status != OMIT
  @description = description if description != OMIT
  @collections = collections if collections != OMIT
  @ticket_type = ticket_type if ticket_type != OMIT
  @account =  if  != OMIT
  @contact = contact if contact != OMIT
  @parent_ticket = parent_ticket if parent_ticket != OMIT
  @attachments = attachments if attachments != OMIT
  @tags = tags if tags != OMIT
  @remote_created_at = remote_created_at if remote_created_at != OMIT
  @remote_updated_at = remote_updated_at if remote_updated_at != OMIT
  @completed_at = completed_at if completed_at != OMIT
  @remote_was_deleted = remote_was_deleted if remote_was_deleted != OMIT
  @ticket_url = ticket_url if ticket_url != OMIT
  @priority = priority if priority != OMIT
  @field_mappings = field_mappings if field_mappings != OMIT
  @remote_data = remote_data if remote_data != OMIT
  @remote_fields = remote_fields if remote_fields != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "id": id,
    "remote_id": remote_id,
    "created_at": created_at,
    "modified_at": modified_at,
    "name": name,
    "assignees": assignees,
    "creator": creator,
    "due_date": due_date,
    "status": status,
    "description": description,
    "collections": collections,
    "ticket_type": ticket_type,
    "account": ,
    "contact": contact,
    "parent_ticket": parent_ticket,
    "attachments": attachments,
    "tags": tags,
    "remote_created_at": remote_created_at,
    "remote_updated_at": remote_updated_at,
    "completed_at": completed_at,
    "remote_was_deleted": remote_was_deleted,
    "ticket_url": ticket_url,
    "priority": priority,
    "field_mappings": field_mappings,
    "remote_data": remote_data,
    "remote_fields": remote_fields
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#accountMerge::Ticketing::TicketAccount (readonly)

Returns The account associated with the ticket.

Returns:



57
58
59
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 57

def 
  @account
end

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



89
90
91
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 89

def additional_properties
  @additional_properties
end

#assigneesArray<Merge::Ticketing::TicketAssigneesItem> (readonly)



37
38
39
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 37

def assignees
  @assignees
end

#attachmentsArray<Merge::Ticketing::TicketAttachmentsItem> (readonly)



63
64
65
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 63

def attachments
  @attachments
end

#collectionsArray<Merge::Ticketing::TicketCollectionsItem> (readonly)



52
53
54
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 52

def collections
  @collections
end

#completed_atDateTime (readonly)

Returns When the ticket was completed.

Returns:

  • (DateTime)

    When the ticket was completed.



71
72
73
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 71

def completed_at
  @completed_at
end

#contactMerge::Ticketing::TicketContact (readonly)

Returns The contact associated with the ticket.

Returns:



59
60
61
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 59

def contact
  @contact
end

#created_atDateTime (readonly)

Returns The datetime that this object was created by Merge.

Returns:

  • (DateTime)

    The datetime that this object was created by Merge.



31
32
33
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 31

def created_at
  @created_at
end

#creatorMerge::Ticketing::TicketCreator (readonly)

Returns The user who created this ticket.

Returns:



39
40
41
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 39

def creator
  @creator
end

#descriptionString (readonly)

Returns The ticket’s description. HTML version of description is mapped if supported by the third-party platform.

Returns:

  • (String)

    The ticket’s description. HTML version of description is mapped if supported by the third-party platform.



50
51
52
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 50

def description
  @description
end

#due_dateDateTime (readonly)

Returns The ticket’s due date.

Returns:

  • (DateTime)

    The ticket’s due date.



41
42
43
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 41

def due_date
  @due_date
end

#field_mappingsHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


83
84
85
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 83

def field_mappings
  @field_mappings
end

#idString (readonly)

Returns:

  • (String)


27
28
29
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 27

def id
  @id
end

#modified_atDateTime (readonly)

Returns The datetime that this object was modified by Merge.

Returns:

  • (DateTime)

    The datetime that this object was modified by Merge.



33
34
35
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 33

def modified_at
  @modified_at
end

#nameString (readonly)

Returns The ticket’s name.

Returns:

  • (String)

    The ticket’s name.



35
36
37
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 35

def name
  @name
end

#parent_ticketMerge::Ticketing::TicketParentTicket (readonly)

Returns The ticket’s parent ticket.

Returns:



61
62
63
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 61

def parent_ticket
  @parent_ticket
end

#priorityMerge::Ticketing::PriorityEnum (readonly)

Returns The priority or urgency of the Ticket.

  • ‘URGENT` - URGENT

  • ‘HIGH` - HIGH

  • ‘NORMAL` - NORMAL

  • ‘LOW` - LOW.

Returns:



81
82
83
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 81

def priority
  @priority
end

#remote_created_atDateTime (readonly)

Returns When the third party’s ticket was created.

Returns:

  • (DateTime)

    When the third party’s ticket was created.



67
68
69
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 67

def remote_created_at
  @remote_created_at
end

#remote_dataArray<Merge::Ticketing::RemoteData> (readonly)

Returns:



85
86
87
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 85

def remote_data
  @remote_data
end

#remote_fieldsArray<Merge::Ticketing::RemoteField> (readonly)

Returns:



87
88
89
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 87

def remote_fields
  @remote_fields
end

#remote_idString (readonly)

Returns The third-party API ID of the matching object.

Returns:

  • (String)

    The third-party API ID of the matching object.



29
30
31
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 29

def remote_id
  @remote_id
end

#remote_updated_atDateTime (readonly)

Returns When the third party’s ticket was updated.

Returns:

  • (DateTime)

    When the third party’s ticket was updated.



69
70
71
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 69

def remote_updated_at
  @remote_updated_at
end

#remote_was_deletedBoolean (readonly)

Returns:

  • (Boolean)


73
74
75
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 73

def remote_was_deleted
  @remote_was_deleted
end

#statusMerge::Ticketing::TicketStatusEnum (readonly)

Returns The current status of the ticket.

  • ‘OPEN` - OPEN

  • ‘CLOSED` - CLOSED

  • ‘IN_PROGRESS` - IN_PROGRESS

  • ‘ON_HOLD` - ON_HOLD.

Returns:



47
48
49
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 47

def status
  @status
end

#tagsArray<String> (readonly)

Returns:

  • (Array<String>)


65
66
67
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 65

def tags
  @tags
end

#ticket_typeString (readonly)

Returns The sub category of the ticket within the 3rd party system. Examples include incident, task, subtask or to-do.

Returns:

  • (String)

    The sub category of the ticket within the 3rd party system. Examples include incident, task, subtask or to-do.



55
56
57
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 55

def ticket_type
  @ticket_type
end

#ticket_urlString (readonly)

Returns The 3rd party url of the Ticket.

Returns:

  • (String)

    The 3rd party url of the Ticket.



75
76
77
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 75

def ticket_url
  @ticket_url
end

Class Method Details

.from_json(json_object:) ⇒ Merge::Ticketing::Ticket

Deserialize a JSON object to an instance of Ticket

Parameters:

  • json_object (String)

Returns:



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
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
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 199

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  remote_id = parsed_json["remote_id"]
  created_at = (DateTime.parse(parsed_json["created_at"]) unless parsed_json["created_at"].nil?)
  modified_at = (DateTime.parse(parsed_json["modified_at"]) unless parsed_json["modified_at"].nil?)
  name = parsed_json["name"]
  assignees = parsed_json["assignees"]&.map do |item|
    item = item.to_json
    Merge::Ticketing::TicketAssigneesItem.from_json(json_object: item)
  end
  if parsed_json["creator"].nil?
    creator = nil
  else
    creator = parsed_json["creator"].to_json
    creator = Merge::Ticketing::TicketCreator.from_json(json_object: creator)
  end
  due_date = (DateTime.parse(parsed_json["due_date"]) unless parsed_json["due_date"].nil?)
  status = parsed_json["status"]
  description = parsed_json["description"]
  collections = parsed_json["collections"]&.map do |item|
    item = item.to_json
    Merge::Ticketing::TicketCollectionsItem.from_json(json_object: item)
  end
  ticket_type = parsed_json["ticket_type"]
  if parsed_json["account"].nil?
     = nil
  else
     = parsed_json["account"].to_json
     = Merge::Ticketing::TicketAccount.from_json(json_object: )
  end
  if parsed_json["contact"].nil?
    contact = nil
  else
    contact = parsed_json["contact"].to_json
    contact = Merge::Ticketing::TicketContact.from_json(json_object: contact)
  end
  if parsed_json["parent_ticket"].nil?
    parent_ticket = nil
  else
    parent_ticket = parsed_json["parent_ticket"].to_json
    parent_ticket = Merge::Ticketing::TicketParentTicket.from_json(json_object: parent_ticket)
  end
  attachments = parsed_json["attachments"]&.map do |item|
    item = item.to_json
    Merge::Ticketing::TicketAttachmentsItem.from_json(json_object: item)
  end
  tags = parsed_json["tags"]
  remote_created_at = unless parsed_json["remote_created_at"].nil?
                        DateTime.parse(parsed_json["remote_created_at"])
                      end
  remote_updated_at = unless parsed_json["remote_updated_at"].nil?
                        DateTime.parse(parsed_json["remote_updated_at"])
                      end
  completed_at = (DateTime.parse(parsed_json["completed_at"]) unless parsed_json["completed_at"].nil?)
  remote_was_deleted = parsed_json["remote_was_deleted"]
  ticket_url = parsed_json["ticket_url"]
  priority = parsed_json["priority"]
  field_mappings = parsed_json["field_mappings"]
  remote_data = parsed_json["remote_data"]&.map do |item|
    item = item.to_json
    Merge::Ticketing::RemoteData.from_json(json_object: item)
  end
  remote_fields = parsed_json["remote_fields"]&.map do |item|
    item = item.to_json
    Merge::Ticketing::RemoteField.from_json(json_object: item)
  end
  new(
    id: id,
    remote_id: remote_id,
    created_at: created_at,
    modified_at: modified_at,
    name: name,
    assignees: assignees,
    creator: creator,
    due_date: due_date,
    status: status,
    description: description,
    collections: collections,
    ticket_type: ticket_type,
    account: ,
    contact: contact,
    parent_ticket: parent_ticket,
    attachments: attachments,
    tags: tags,
    remote_created_at: remote_created_at,
    remote_updated_at: remote_updated_at,
    completed_at: completed_at,
    remote_was_deleted: remote_was_deleted,
    ticket_url: ticket_url,
    priority: priority,
    field_mappings: field_mappings,
    remote_data: remote_data,
    remote_fields: remote_fields,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 311

def self.validate_raw(obj:)
  obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.remote_id&.is_a?(String) != false || raise("Passed value for field obj.remote_id is not the expected type, validation failed.")
  obj.created_at&.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.")
  obj.modified_at&.is_a?(DateTime) != false || raise("Passed value for field obj.modified_at is not the expected type, validation failed.")
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.assignees&.is_a?(Array) != false || raise("Passed value for field obj.assignees is not the expected type, validation failed.")
  obj.creator.nil? || Merge::Ticketing::TicketCreator.validate_raw(obj: obj.creator)
  obj.due_date&.is_a?(DateTime) != false || raise("Passed value for field obj.due_date is not the expected type, validation failed.")
  obj.status&.is_a?(Merge::Ticketing::TicketStatusEnum) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
  obj.collections&.is_a?(Array) != false || raise("Passed value for field obj.collections is not the expected type, validation failed.")
  obj.ticket_type&.is_a?(String) != false || raise("Passed value for field obj.ticket_type is not the expected type, validation failed.")
  obj..nil? || Merge::Ticketing::TicketAccount.validate_raw(obj: obj.)
  obj.contact.nil? || Merge::Ticketing::TicketContact.validate_raw(obj: obj.contact)
  obj.parent_ticket.nil? || Merge::Ticketing::TicketParentTicket.validate_raw(obj: obj.parent_ticket)
  obj.attachments&.is_a?(Array) != false || raise("Passed value for field obj.attachments is not the expected type, validation failed.")
  obj.tags&.is_a?(Array) != false || raise("Passed value for field obj.tags is not the expected type, validation failed.")
  obj.remote_created_at&.is_a?(DateTime) != false || raise("Passed value for field obj.remote_created_at is not the expected type, validation failed.")
  obj.remote_updated_at&.is_a?(DateTime) != false || raise("Passed value for field obj.remote_updated_at is not the expected type, validation failed.")
  obj.completed_at&.is_a?(DateTime) != false || raise("Passed value for field obj.completed_at is not the expected type, validation failed.")
  obj.remote_was_deleted&.is_a?(Boolean) != false || raise("Passed value for field obj.remote_was_deleted is not the expected type, validation failed.")
  obj.ticket_url&.is_a?(String) != false || raise("Passed value for field obj.ticket_url is not the expected type, validation failed.")
  obj.priority&.is_a?(Merge::Ticketing::PriorityEnum) != false || raise("Passed value for field obj.priority is not the expected type, validation failed.")
  obj.field_mappings&.is_a?(Hash) != false || raise("Passed value for field obj.field_mappings is not the expected type, validation failed.")
  obj.remote_data&.is_a?(Array) != false || raise("Passed value for field obj.remote_data is not the expected type, validation failed.")
  obj.remote_fields&.is_a?(Array) != false || raise("Passed value for field obj.remote_fields is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of Ticket to a JSON object

Returns:

  • (String)


301
302
303
# File 'lib/merge_ruby_client/ticketing/types/ticket.rb', line 301

def to_json(*_args)
  @_field_set&.to_json
end