Class: SysAid::Ticket

Inherits:
Object
  • Object
show all
Defined in:
lib/sysaid/ticket.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTicket

Returns a new instance of Ticket.



12
13
14
15
16
# File 'lib/sysaid/ticket.rb', line 12

def initialize
  self.close_time = Date.new
  self.insert_time = Date.new
  self.update_time = Date.new
end

Instance Attribute Details

#agreementObject

Returns the value of attribute agreement.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def agreement
  @agreement
end

#archiveObject

Returns the value of attribute archive.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def archive
  @archive
end

#assign_counterObject

Returns the value of attribute assign_counter.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def assign_counter
  @assign_counter
end

#assigned_groupObject

Returns the value of attribute assigned_group.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def assigned_group
  @assigned_group
end

#assigned_toObject

Returns the value of attribute assigned_to.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def assigned_to
  @assigned_to
end

#categoryObject

Returns the value of attribute category.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def category
  @category
end

#ccObject

Returns the value of attribute cc.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def cc
  @cc
end

#change_categoryObject

Returns the value of attribute change_category.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def change_category
  @change_category
end

#ciidObject

Returns the value of attribute ciid.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def ciid
  @ciid
end

#close_timeObject

Returns the value of attribute close_time.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def close_time
  @close_time
end

#closure_informationObject

Returns the value of attribute closure_information.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def closure_information
  @closure_information
end

#computer_idObject

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_levelObject

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_int1Object

Returns the value of attribute cust_int1.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def cust_int1
  @cust_int1
end

#cust_int2Object

Returns the value of attribute cust_int2.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def cust_int2
  @cust_int2
end

#cust_list1Object

Returns the value of attribute cust_list1.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def cust_list1
  @cust_list1
end

#cust_list2Object

Returns the value of attribute cust_list2.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def cust_list2
  @cust_list2
end

#cust_notesObject

Returns the value of attribute cust_notes.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def cust_notes
  @cust_notes
end

#cust_text1Object

Returns the value of attribute cust_text1.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def cust_text1
  @cust_text1
end

#cust_text2Object

Returns the value of attribute cust_text2.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def cust_text2
  @cust_text2
end

#descriptionObject

Returns the value of attribute description.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def description
  @description
end

#email_accountObject

Returns the value of attribute email_account.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def 
  
end

#escalationObject

Returns the value of attribute escalation.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def escalation
  @escalation
end

#followup_textObject

Returns the value of attribute followup_text.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def followup_text
  @followup_text
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def id
  @id
end

#impactObject

Returns the value of attribute impact.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def impact
  @impact
end

#insert_timeObject

Returns the value of attribute insert_time.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def insert_time
  @insert_time
end

#locationObject

Returns the value of attribute location.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def location
  @location
end

#max_support_levelObject

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

#notesObject

Returns the value of attribute notes.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def notes
  @notes
end

Returns the value of attribute parent_link.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def parent_link
  @parent_link
end

#priorityObject

Returns the value of attribute priority.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def priority
  @priority
end

#project_idObject

Returns the value of attribute project_id.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def project_id
  @project_id
end

#reopen_counterObject

Returns the value of attribute reopen_counter.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def reopen_counter
  @reopen_counter
end

#request_userObject

Returns the value of attribute request_user.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def request_user
  @request_user
end

#resolutionObject

Returns the value of attribute resolution.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def resolution
  @resolution
end

#solutionObject

Returns the value of attribute solution.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def solution
  @solution
end

#sourceObject

Returns the value of attribute source.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def source
  @source
end

#sr_sub_typeObject

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_typeObject

Returns the value of attribute sr_type.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def sr_type
  @sr_type
end

#statusObject

Returns the value of attribute status.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def status
  @status
end

#sub_categoryObject

Returns the value of attribute sub_category.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def sub_category
  @sub_category
end

#submit_userObject

Returns the value of attribute submit_user.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def submit_user
  @submit_user
end

#success_ratingObject

Returns the value of attribute success_rating.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def success_rating
  @success_rating
end

#task_idObject

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_categoryObject

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

#titleObject

Returns the value of attribute title.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def title
  @title
end

#update_timeObject

Returns the value of attribute update_time.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def update_time
  @update_time
end

#update_userObject

Returns the value of attribute update_user.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def update_user
  @update_user
end

#urgencyObject

Returns the value of attribute urgency.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def urgency
  @urgency
end

#user_managerObject

Returns the value of attribute user_manager.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def user_manager
  @user_manager
end

#versionObject

Returns the value of attribute version.



4
5
6
# File 'lib/sysaid/ticket.rb', line 4

def version
  @version
end

#workaroundObject

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



18
19
20
21
22
23
24
25
26
# File 'lib/sysaid/ticket.rb', line 18

def self.find_by_id(ticket_id)
  ticket = SysAid::Ticket.new
  
  ticket.id = ticket_id
  
  return nil unless ticket.refresh
  
  return ticket
end

Instance Method Details

#deleteObject

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


66
67
68
# File 'lib/sysaid/ticket.rb', line 66

def delete
  SysAid.client.call(:delete, message: to_xml(false))
end

#refreshObject

Loads the latest user information from the SysAid server



29
30
31
32
33
34
35
36
37
38
# File 'lib/sysaid/ticket.rb', line 29

def refresh
  response = SysAid.client.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

#saveObject

Saves a ticket back to the SysAid server

Example:

>> ticket_object.save
=> true


45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/sysaid/ticket.rb', line 45

def save
  if SysAid.logged_in? == false
    raise "You must log in before creating or saving a ticket."
  end
  
  # Save it via the SOAP API
  response = SysAid.client.call(:save, message: to_xml(false))
  if response.to_hash[:save_response][:return]
    return true
  else
    return false
  end
end