Class: SysAid::Ticket
- Inherits:
-
Object
- Object
- SysAid::Ticket
- Defined in:
- lib/sysaid/ticket.rb
Instance Attribute Summary collapse
-
#agreement ⇒ Object
Returns the value of attribute agreement.
-
#archive ⇒ Object
Returns the value of attribute archive.
-
#assign_counter ⇒ Object
Returns the value of attribute assign_counter.
-
#assigned_group ⇒ Object
Returns the value of attribute assigned_group.
-
#assigned_to ⇒ Object
Returns the value of attribute assigned_to.
-
#category ⇒ Object
Returns the value of attribute category.
-
#cc ⇒ Object
Returns the value of attribute cc.
-
#change_category ⇒ Object
Returns the value of attribute change_category.
-
#ciid ⇒ Object
Returns the value of attribute ciid.
-
#close_time ⇒ Object
Returns the value of attribute close_time.
-
#closure_information ⇒ Object
Returns the value of attribute closure_information.
-
#computer_id ⇒ Object
Returns the value of attribute computer_id.
-
#current_support_level ⇒ Object
Returns the value of attribute current_support_level.
-
#cust_int1 ⇒ Object
Returns the value of attribute cust_int1.
-
#cust_int2 ⇒ Object
Returns the value of attribute cust_int2.
-
#cust_list1 ⇒ Object
Returns the value of attribute cust_list1.
-
#cust_list2 ⇒ Object
Returns the value of attribute cust_list2.
-
#cust_notes ⇒ Object
Returns the value of attribute cust_notes.
-
#cust_text1 ⇒ Object
Returns the value of attribute cust_text1.
-
#cust_text2 ⇒ Object
Returns the value of attribute cust_text2.
-
#description ⇒ Object
Returns the value of attribute description.
-
#email_account ⇒ Object
Returns the value of attribute email_account.
-
#escalation ⇒ Object
Returns the value of attribute escalation.
-
#followup_text ⇒ Object
Returns the value of attribute followup_text.
-
#id ⇒ Object
Returns the value of attribute id.
-
#impact ⇒ Object
Returns the value of attribute impact.
-
#insert_time ⇒ Object
Returns the value of attribute insert_time.
-
#location ⇒ Object
Returns the value of attribute location.
-
#max_support_level ⇒ Object
Returns the value of attribute max_support_level.
-
#notes ⇒ Object
Returns the value of attribute notes.
-
#parent_link ⇒ Object
Returns the value of attribute parent_link.
-
#priority ⇒ Object
Returns the value of attribute priority.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
-
#reopen_counter ⇒ Object
Returns the value of attribute reopen_counter.
-
#request_user ⇒ Object
Returns the value of attribute request_user.
-
#resolution ⇒ Object
Returns the value of attribute resolution.
-
#solution ⇒ Object
Returns the value of attribute solution.
-
#source ⇒ Object
Returns the value of attribute source.
-
#sr_sub_type ⇒ Object
Returns the value of attribute sr_sub_type.
-
#sr_type ⇒ Object
Returns the value of attribute sr_type.
-
#status ⇒ Object
Returns the value of attribute status.
-
#sub_category ⇒ Object
Returns the value of attribute sub_category.
-
#submit_user ⇒ Object
Returns the value of attribute submit_user.
-
#success_rating ⇒ Object
Returns the value of attribute success_rating.
-
#task_id ⇒ Object
Returns the value of attribute task_id.
-
#third_level_category ⇒ Object
Returns the value of attribute third_level_category.
-
#title ⇒ Object
Returns the value of attribute title.
-
#update_time ⇒ Object
Returns the value of attribute update_time.
-
#update_user ⇒ Object
Returns the value of attribute update_user.
-
#urgency ⇒ Object
Returns the value of attribute urgency.
-
#user_manager ⇒ Object
Returns the value of attribute user_manager.
-
#version ⇒ Object
Returns the value of attribute version.
-
#workaround ⇒ Object
Returns the value of attribute workaround.
Class Method Summary collapse
Instance Method Summary collapse
-
#add_note(user, note, time = Time.now) ⇒ Object
Though the ‘notes’ field is merely an editable string, ‘add_note’ mimics the behavior of the SysAid web client.
-
#delete ⇒ Object
Deletes a ticket from the SysAid server.
-
#initialize ⇒ Ticket
constructor
A new instance of Ticket.
-
#refresh ⇒ Object
Loads the latest ticket information from the SysAid server.
-
#reset_all_attributes ⇒ Object
Needed by both initialize and delete (to empty out the object when deleted).
-
#save ⇒ Object
Saves a ticket back to the SysAid server.
Constructor Details
#initialize ⇒ Ticket
Returns a new instance of Ticket.
12 13 14 |
# File 'lib/sysaid/ticket.rb', line 12 def initialize reset_all_attributes end |
Instance Attribute Details
#agreement ⇒ Object
Returns the value of attribute agreement.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def agreement @agreement end |
#archive ⇒ Object
Returns the value of attribute archive.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def archive @archive end |
#assign_counter ⇒ Object
Returns the value of attribute assign_counter.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def assign_counter @assign_counter end |
#assigned_group ⇒ Object
Returns the value of attribute assigned_group.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def assigned_group @assigned_group end |
#assigned_to ⇒ Object
Returns the value of attribute assigned_to.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def assigned_to @assigned_to end |
#category ⇒ Object
Returns the value of attribute category.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def category @category end |
#cc ⇒ Object
Returns the value of attribute cc.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def cc @cc end |
#change_category ⇒ Object
Returns the value of attribute change_category.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def change_category @change_category end |
#ciid ⇒ Object
Returns the value of attribute ciid.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def ciid @ciid end |
#close_time ⇒ Object
Returns the value of attribute close_time.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def close_time @close_time end |
#closure_information ⇒ Object
Returns the value of attribute closure_information.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def closure_information @closure_information end |
#computer_id ⇒ Object
Returns the value of attribute computer_id.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def computer_id @computer_id end |
#current_support_level ⇒ Object
Returns the value of attribute current_support_level.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def current_support_level @current_support_level end |
#cust_int1 ⇒ Object
Returns the value of attribute cust_int1.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def cust_int1 @cust_int1 end |
#cust_int2 ⇒ Object
Returns the value of attribute cust_int2.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def cust_int2 @cust_int2 end |
#cust_list1 ⇒ Object
Returns the value of attribute cust_list1.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def cust_list1 @cust_list1 end |
#cust_list2 ⇒ Object
Returns the value of attribute cust_list2.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def cust_list2 @cust_list2 end |
#cust_notes ⇒ Object
Returns the value of attribute cust_notes.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def cust_notes @cust_notes end |
#cust_text1 ⇒ Object
Returns the value of attribute cust_text1.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def cust_text1 @cust_text1 end |
#cust_text2 ⇒ Object
Returns the value of attribute cust_text2.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def cust_text2 @cust_text2 end |
#description ⇒ Object
Returns the value of attribute description.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def description @description end |
#email_account ⇒ Object
Returns the value of attribute email_account.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def email_account @email_account end |
#escalation ⇒ Object
Returns the value of attribute escalation.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def escalation @escalation end |
#followup_text ⇒ Object
Returns the value of attribute followup_text.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def followup_text @followup_text end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def id @id end |
#impact ⇒ Object
Returns the value of attribute impact.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def impact @impact end |
#insert_time ⇒ Object
Returns the value of attribute insert_time.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def insert_time @insert_time end |
#location ⇒ Object
Returns the value of attribute location.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def location @location end |
#max_support_level ⇒ Object
Returns the value of attribute max_support_level.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def max_support_level @max_support_level end |
#notes ⇒ Object
Returns the value of attribute notes.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def notes @notes end |
#parent_link ⇒ Object
Returns the value of attribute parent_link.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def parent_link @parent_link end |
#priority ⇒ Object
Returns the value of attribute priority.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def priority @priority end |
#project_id ⇒ Object
Returns the value of attribute project_id.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def project_id @project_id end |
#reopen_counter ⇒ Object
Returns the value of attribute reopen_counter.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def reopen_counter @reopen_counter end |
#request_user ⇒ Object
Returns the value of attribute request_user.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def request_user @request_user end |
#resolution ⇒ Object
Returns the value of attribute resolution.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def resolution @resolution end |
#solution ⇒ Object
Returns the value of attribute solution.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def solution @solution end |
#source ⇒ Object
Returns the value of attribute source.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def source @source end |
#sr_sub_type ⇒ Object
Returns the value of attribute sr_sub_type.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def sr_sub_type @sr_sub_type end |
#sr_type ⇒ Object
Returns the value of attribute sr_type.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def sr_type @sr_type end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def status @status end |
#sub_category ⇒ Object
Returns the value of attribute sub_category.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def sub_category @sub_category end |
#submit_user ⇒ Object
Returns the value of attribute submit_user.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def submit_user @submit_user end |
#success_rating ⇒ Object
Returns the value of attribute success_rating.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def @success_rating end |
#task_id ⇒ Object
Returns the value of attribute task_id.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def task_id @task_id end |
#third_level_category ⇒ Object
Returns the value of attribute third_level_category.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def third_level_category @third_level_category end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def title @title end |
#update_time ⇒ Object
Returns the value of attribute update_time.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def update_time @update_time end |
#update_user ⇒ Object
Returns the value of attribute update_user.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def update_user @update_user end |
#urgency ⇒ Object
Returns the value of attribute urgency.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def urgency @urgency end |
#user_manager ⇒ Object
Returns the value of attribute user_manager.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def user_manager @user_manager end |
#version ⇒ Object
Returns the value of attribute version.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def version @version end |
#workaround ⇒ Object
Returns the value of attribute workaround.
4 5 6 |
# File 'lib/sysaid/ticket.rb', line 4 def workaround @workaround end |
Class Method Details
.find_by_id(ticket_id) ⇒ Object
72 73 74 75 76 77 78 79 80 |
# File 'lib/sysaid/ticket.rb', line 72 def self.find_by_id(ticket_id) ticket = SysAid::Ticket.new ticket.id = ticket_id return nil unless ticket.refresh return ticket end |
.find_by_query(query) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/sysaid/ticket.rb', line 82 def self.find_by_query(query) SysAid.ensure_logged_in response = SysAid.call(:execute_select_query, message: sql_query(query)) if response.to_hash[:execute_select_query_response][:return] return response.to_hash[:execute_select_query_response][:return] end return false end |
Instance Method Details
#add_note(user, note, time = Time.now) ⇒ Object
Though the ‘notes’ field is merely an editable string, ‘add_note’ mimics the behavior of the SysAid web client.
110 111 112 113 114 115 116 117 118 119 |
# File 'lib/sysaid/ticket.rb', line 110 def add_note(user, note, time = Time.now) # NOTE: Notes are prepended. new_note = "#{user} (#{time.strftime("%-m/%-d/%y %I:%M %p")}):\n #{note}" if self.notes self.notes = new_note + "\n=============================\n" + self.notes else self.notes = new_note end end |
#delete ⇒ Object
Deletes a ticket from the SysAid server
No return value as SysAid’s ‘delete’ call returns void. No idea why.
Example:
>> ticket_object.delete
=> true
147 148 149 150 151 152 153 |
# File 'lib/sysaid/ticket.rb', line 147 def delete SysAid.ensure_logged_in SysAid.call(:delete, message: to_xml(false)) reset_all_attributes end |
#refresh ⇒ Object
Loads the latest ticket information from the SysAid server
95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/sysaid/ticket.rb', line 95 def refresh SysAid.ensure_logged_in response = SysAid.call(:load_by_string_id, message: to_xml) if response.to_hash[:load_by_string_id_response][:return] set_self_from_response(response.to_hash[:load_by_string_id_response][:return]) return true end return false end |
#reset_all_attributes ⇒ Object
Needed by both initialize and delete (to empty out the object when deleted)
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/sysaid/ticket.rb', line 17 def reset_all_attributes self.agreement = nil self.archive = nil self.assign_counter = nil self.assigned_group = nil self.assigned_to = nil self.ciid = nil self.category = nil self.cc = nil self.change_category = nil self.close_time = Date.new self.closure_information = nil self.computer_id = nil self.current_support_level = nil self.cust_int1 = nil self.cust_int2 = nil self.cust_list1 = nil self.cust_list2 = nil self.cust_notes = nil self.cust_text1 = nil self.cust_text2 = nil self.description = nil self.email_account = nil self.escalation = nil self.followup_text = nil self.id = nil self.impact = nil self.insert_time = Date.new self.location = nil self.max_support_level = nil self.notes = nil self.parent_link = nil self.priority = nil self.project_id = nil self.reopen_counter = nil self.request_user = nil self.resolution = nil self.solution = nil self.source = nil self.sr_sub_type = nil self.sr_type = nil self.status = nil self.sub_category = nil self. = nil self.task_id = nil self.third_level_category = nil self.title = nil self.update_time = Date.new self.update_user = nil self.urgency = nil self.user_manager = nil self.version = nil self.workaround = nil end |
#save ⇒ Object
Saves a ticket back to the SysAid server
Example:
>> ticket_object.save
=> true
126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/sysaid/ticket.rb', line 126 def save SysAid.ensure_logged_in # Save it via the SOAP API response = SysAid.call(:save, message: to_xml(false)) if response.to_hash[:save_response][:return] # In the case of a new ticket, the SysAid response will be the assigned ID self.id = response.to_hash[:save_response][:return] unless self.id return true else return false end end |