Class: MistApi::Ticket
- Defined in:
- lib/mist_api/models/ticket.rb
Overview
Support Ticket
Instance Attribute Summary collapse
-
#case_number ⇒ String
TODO: Write general description for this method.
-
#comments ⇒ Array[TicketComment]
TODO: Write general description for this method.
-
#created_at ⇒ Integer
TODO: Write general description for this method.
-
#id ⇒ UUID | String
Unique ID of the object instance in the Mist Organization.
-
#requester ⇒ String
Unique ID of the object instance in the Mist Organization.
-
#requester_email ⇒ String
Email of the requester.
-
#status ⇒ TicketStatusEnum
Ticket status.
-
#subject ⇒ String
Ticket status.
-
#type ⇒ String
Question (default) / bug / critical.
-
#updated_at ⇒ Integer
Question (default) / bug / critical.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(subject = nil, type = nil, case_number = SKIP, comments = SKIP, created_at = SKIP, id = SKIP, requester = SKIP, requester_email = SKIP, status = SKIP, updated_at = SKIP, additional_properties = nil) ⇒ Ticket
constructor
A new instance of Ticket.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(subject = nil, type = nil, case_number = SKIP, comments = SKIP, created_at = SKIP, id = SKIP, requester = SKIP, requester_email = SKIP, status = SKIP, updated_at = SKIP, additional_properties = nil) ⇒ Ticket
Returns a new instance of Ticket.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/mist_api/models/ticket.rb', line 99 def initialize(subject = nil, type = nil, case_number = SKIP, comments = SKIP, created_at = SKIP, id = SKIP, requester = SKIP, requester_email = SKIP, status = SKIP, updated_at = SKIP, additional_properties = nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @case_number = case_number unless case_number == SKIP @comments = comments unless comments == SKIP @created_at = created_at unless created_at == SKIP @id = id unless id == SKIP @requester = requester unless requester == SKIP @requester_email = requester_email unless requester_email == SKIP @status = status unless status == SKIP @subject = subject @type = type @updated_at = updated_at unless updated_at == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#case_number ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/mist_api/models/ticket.rb', line 14 def case_number @case_number end |
#comments ⇒ Array[TicketComment]
TODO: Write general description for this method
18 19 20 |
# File 'lib/mist_api/models/ticket.rb', line 18 def comments @comments end |
#created_at ⇒ Integer
TODO: Write general description for this method
22 23 24 |
# File 'lib/mist_api/models/ticket.rb', line 22 def created_at @created_at end |
#id ⇒ UUID | String
Unique ID of the object instance in the Mist Organization
26 27 28 |
# File 'lib/mist_api/models/ticket.rb', line 26 def id @id end |
#requester ⇒ String
Unique ID of the object instance in the Mist Organization
30 31 32 |
# File 'lib/mist_api/models/ticket.rb', line 30 def requester @requester end |
#requester_email ⇒ String
Email of the requester
34 35 36 |
# File 'lib/mist_api/models/ticket.rb', line 34 def requester_email @requester_email end |
#status ⇒ TicketStatusEnum
Ticket status. enum:
* open: ticket is open, Mist is working on it
* pending: ticket is open and Requester attention is needed (e.g. Mist
is asking for some more information)
* solved: ticket is marked as solved / considered by Mist (requester can
update it, causing it to re-open; or rate it)
* closed: ticket is archived and cannot be changed.
44 45 46 |
# File 'lib/mist_api/models/ticket.rb', line 44 def status @status end |
#subject ⇒ String
Ticket status. enum:
* open: ticket is open, Mist is working on it
* pending: ticket is open and Requester attention is needed (e.g. Mist
is asking for some more information)
* solved: ticket is marked as solved / considered by Mist (requester can
update it, causing it to re-open; or rate it)
* closed: ticket is archived and cannot be changed.
54 55 56 |
# File 'lib/mist_api/models/ticket.rb', line 54 def subject @subject end |
#type ⇒ String
Question (default) / bug / critical
58 59 60 |
# File 'lib/mist_api/models/ticket.rb', line 58 def type @type end |
#updated_at ⇒ Integer
Question (default) / bug / critical
62 63 64 |
# File 'lib/mist_api/models/ticket.rb', line 62 def updated_at @updated_at end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/mist_api/models/ticket.rb', line 120 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. subject = hash.key?('subject') ? hash['subject'] : nil type = hash.key?('type') ? hash['type'] : nil case_number = hash.key?('case_number') ? hash['case_number'] : SKIP # Parameter is an array, so we need to iterate through it comments = nil unless hash['comments'].nil? comments = [] hash['comments'].each do |structure| comments << (TicketComment.from_hash(structure) if structure) end end comments = SKIP unless hash.key?('comments') created_at = hash.key?('created_at') ? hash['created_at'] : SKIP id = hash.key?('id') ? hash['id'] : SKIP requester = hash.key?('requester') ? hash['requester'] : SKIP requester_email = hash.key?('requester_email') ? hash['requester_email'] : SKIP status = hash.key?('status') ? hash['status'] : SKIP updated_at = hash.key?('updated_at') ? hash['updated_at'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. Ticket.new(subject, type, case_number, comments, created_at, id, requester, requester_email, status, updated_at, additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/mist_api/models/ticket.rb', line 65 def self.names @_hash = {} if @_hash.nil? @_hash['case_number'] = 'case_number' @_hash['comments'] = 'comments' @_hash['created_at'] = 'created_at' @_hash['id'] = 'id' @_hash['requester'] = 'requester' @_hash['requester_email'] = 'requester_email' @_hash['status'] = 'status' @_hash['subject'] = 'subject' @_hash['type'] = 'type' @_hash['updated_at'] = 'updated_at' @_hash end |
.nullables ⇒ Object
An array for nullable fields
95 96 97 |
# File 'lib/mist_api/models/ticket.rb', line 95 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/mist_api/models/ticket.rb', line 81 def self.optionals %w[ case_number comments created_at id requester requester_email status updated_at ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
176 177 178 179 180 181 182 183 |
# File 'lib/mist_api/models/ticket.rb', line 176 def inspect class_name = self.class.name.split('::').last "<#{class_name} case_number: #{@case_number.inspect}, comments: #{@comments.inspect},"\ " created_at: #{@created_at.inspect}, id: #{@id.inspect}, requester: #{@requester.inspect},"\ " requester_email: #{@requester_email.inspect}, status: #{@status.inspect}, subject:"\ " #{@subject.inspect}, type: #{@type.inspect}, updated_at: #{@updated_at.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
167 168 169 170 171 172 173 |
# File 'lib/mist_api/models/ticket.rb', line 167 def to_s class_name = self.class.name.split('::').last "<#{class_name} case_number: #{@case_number}, comments: #{@comments}, created_at:"\ " #{@created_at}, id: #{@id}, requester: #{@requester}, requester_email:"\ " #{@requester_email}, status: #{@status}, subject: #{@subject}, type: #{@type}, updated_at:"\ " #{@updated_at}, additional_properties: #{@additional_properties}>" end |