Class: OTRS::Ticket
Direct Known Subclasses
Defined Under Namespace
Classes: Article, State, TicketQueue, Type
Instance Attribute Summary collapse
-
#age ⇒ Object
Returns the value of attribute age.
-
#archive_flag ⇒ Object
Returns the value of attribute archive_flag.
-
#changed ⇒ Object
Returns the value of attribute changed.
-
#create_time_unix ⇒ Object
Returns the value of attribute create_time_unix.
-
#created ⇒ Object
Returns the value of attribute created.
-
#customer_id ⇒ Object
Returns the value of attribute customer_id.
-
#customer_user_id ⇒ Object
Returns the value of attribute customer_user_id.
-
#escalation_response_time ⇒ Object
Returns the value of attribute escalation_response_time.
-
#escalation_solution_time ⇒ Object
Returns the value of attribute escalation_solution_time.
-
#escalation_time ⇒ Object
Returns the value of attribute escalation_time.
-
#escalation_update_time ⇒ Object
Returns the value of attribute escalation_update_time.
-
#group_id ⇒ Object
Returns the value of attribute group_id.
-
#lock ⇒ Object
Returns the value of attribute lock.
-
#lock_id ⇒ Object
Returns the value of attribute lock_id.
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#owner_id ⇒ Object
Returns the value of attribute owner_id.
-
#priority ⇒ Object
Returns the value of attribute priority.
-
#priority_id ⇒ Object
Returns the value of attribute priority_id.
-
#queue ⇒ Object
Returns the value of attribute queue.
-
#queue_id ⇒ Object
Returns the value of attribute queue_id.
-
#real_till_time_not_used ⇒ Object
Returns the value of attribute real_till_time_not_used.
-
#responsible ⇒ Object
Returns the value of attribute responsible.
-
#responsible_id ⇒ Object
Returns the value of attribute responsible_id.
-
#service_id ⇒ Object
Returns the value of attribute service_id.
-
#slaid ⇒ Object
Returns the value of attribute slaid.
-
#state ⇒ Object
Returns the value of attribute state.
-
#state_id ⇒ Object
Returns the value of attribute state_id.
-
#state_type ⇒ Object
Returns the value of attribute state_type.
-
#ticket_free_key1 ⇒ Object
Returns the value of attribute ticket_free_key1.
-
#ticket_free_key10 ⇒ Object
Returns the value of attribute ticket_free_key10.
-
#ticket_free_key11 ⇒ Object
Returns the value of attribute ticket_free_key11.
-
#ticket_free_key12 ⇒ Object
Returns the value of attribute ticket_free_key12.
-
#ticket_free_key13 ⇒ Object
Returns the value of attribute ticket_free_key13.
-
#ticket_free_key14 ⇒ Object
Returns the value of attribute ticket_free_key14.
-
#ticket_free_key15 ⇒ Object
Returns the value of attribute ticket_free_key15.
-
#ticket_free_key16 ⇒ Object
Returns the value of attribute ticket_free_key16.
-
#ticket_free_key2 ⇒ Object
Returns the value of attribute ticket_free_key2.
-
#ticket_free_key3 ⇒ Object
Returns the value of attribute ticket_free_key3.
-
#ticket_free_key4 ⇒ Object
Returns the value of attribute ticket_free_key4.
-
#ticket_free_key5 ⇒ Object
Returns the value of attribute ticket_free_key5.
-
#ticket_free_key6 ⇒ Object
Returns the value of attribute ticket_free_key6.
-
#ticket_free_key7 ⇒ Object
Returns the value of attribute ticket_free_key7.
-
#ticket_free_key8 ⇒ Object
Returns the value of attribute ticket_free_key8.
-
#ticket_free_key9 ⇒ Object
Returns the value of attribute ticket_free_key9.
-
#ticket_free_text1 ⇒ Object
Returns the value of attribute ticket_free_text1.
-
#ticket_free_text10 ⇒ Object
Returns the value of attribute ticket_free_text10.
-
#ticket_free_text11 ⇒ Object
Returns the value of attribute ticket_free_text11.
-
#ticket_free_text12 ⇒ Object
Returns the value of attribute ticket_free_text12.
-
#ticket_free_text13 ⇒ Object
Returns the value of attribute ticket_free_text13.
-
#ticket_free_text14 ⇒ Object
Returns the value of attribute ticket_free_text14.
-
#ticket_free_text15 ⇒ Object
Returns the value of attribute ticket_free_text15.
-
#ticket_free_text16 ⇒ Object
Returns the value of attribute ticket_free_text16.
-
#ticket_free_text2 ⇒ Object
Returns the value of attribute ticket_free_text2.
-
#ticket_free_text3 ⇒ Object
Returns the value of attribute ticket_free_text3.
-
#ticket_free_text4 ⇒ Object
Returns the value of attribute ticket_free_text4.
-
#ticket_free_text5 ⇒ Object
Returns the value of attribute ticket_free_text5.
-
#ticket_free_text6 ⇒ Object
Returns the value of attribute ticket_free_text6.
-
#ticket_free_text7 ⇒ Object
Returns the value of attribute ticket_free_text7.
-
#ticket_free_text8 ⇒ Object
Returns the value of attribute ticket_free_text8.
-
#ticket_free_text9 ⇒ Object
Returns the value of attribute ticket_free_text9.
-
#ticket_free_time1 ⇒ Object
Returns the value of attribute ticket_free_time1.
-
#ticket_free_time2 ⇒ Object
Returns the value of attribute ticket_free_time2.
-
#ticket_free_time3 ⇒ Object
Returns the value of attribute ticket_free_time3.
-
#ticket_free_time4 ⇒ Object
Returns the value of attribute ticket_free_time4.
-
#ticket_free_time5 ⇒ Object
Returns the value of attribute ticket_free_time5.
-
#ticket_free_time6 ⇒ Object
Returns the value of attribute ticket_free_time6.
-
#ticket_id ⇒ Object
Returns the value of attribute ticket_id.
-
#ticket_number ⇒ Object
Returns the value of attribute ticket_number.
-
#title ⇒ Object
Returns the value of attribute title.
-
#type ⇒ Object
Returns the value of attribute type.
-
#type_id ⇒ Object
Returns the value of attribute type_id.
-
#unlock_timeout ⇒ Object
Returns the value of attribute unlock_timeout.
-
#until_time ⇒ Object
Returns the value of attribute until_time.
Class Method Summary collapse
- .find(id) ⇒ Object
- .free_text_fields(id) ⇒ Object
- .ticket_number_lookup(ticket_id) ⇒ Object
- .where(attributes) ⇒ Object
Instance Method Summary collapse
- #create(attributes) ⇒ Object
- #destroy ⇒ Object
- #id ⇒ Object
-
#initialize(attributes = {}) ⇒ Ticket
constructor
A new instance of Ticket.
- #name ⇒ Object
- #persisted? ⇒ Boolean
- #save ⇒ Object
- #set_free_text_field(id, key, value) ⇒ Object
Methods inherited from OTRS
api_url, api_url=, #attributes, #connect, connect, get_from_remote, object_preprocessor, password, password=, process_response, setup_connection_params, user, user=
Constructor Details
#initialize(attributes = {}) ⇒ Ticket
Returns a new instance of Ticket.
33 34 35 36 37 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 33 def initialize(attributes = {}) attributes.each do |name, value| send("#{name.to_s.underscore.to_sym}=", value) end end |
Instance Attribute Details
#age ⇒ Object
Returns the value of attribute age.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def age @age end |
#archive_flag ⇒ Object
Returns the value of attribute archive_flag.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def archive_flag @archive_flag end |
#changed ⇒ Object
Returns the value of attribute changed.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def changed @changed end |
#create_time_unix ⇒ Object
Returns the value of attribute create_time_unix.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def create_time_unix @create_time_unix end |
#created ⇒ Object
Returns the value of attribute created.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def created @created end |
#customer_id ⇒ Object
Returns the value of attribute customer_id.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def customer_id @customer_id end |
#customer_user_id ⇒ Object
Returns the value of attribute customer_user_id.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def customer_user_id @customer_user_id end |
#escalation_response_time ⇒ Object
Returns the value of attribute escalation_response_time.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def escalation_response_time @escalation_response_time end |
#escalation_solution_time ⇒ Object
Returns the value of attribute escalation_solution_time.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def escalation_solution_time @escalation_solution_time end |
#escalation_time ⇒ Object
Returns the value of attribute escalation_time.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def escalation_time @escalation_time end |
#escalation_update_time ⇒ Object
Returns the value of attribute escalation_update_time.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def escalation_update_time @escalation_update_time end |
#group_id ⇒ Object
Returns the value of attribute group_id.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def group_id @group_id end |
#lock ⇒ Object
Returns the value of attribute lock.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def lock @lock end |
#lock_id ⇒ Object
Returns the value of attribute lock_id.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def lock_id @lock_id end |
#owner ⇒ Object
Returns the value of attribute owner.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def owner @owner end |
#owner_id ⇒ Object
Returns the value of attribute owner_id.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def owner_id @owner_id end |
#priority ⇒ Object
Returns the value of attribute priority.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def priority @priority end |
#priority_id ⇒ Object
Returns the value of attribute priority_id.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def priority_id @priority_id end |
#queue ⇒ Object
Returns the value of attribute queue.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def queue @queue end |
#queue_id ⇒ Object
Returns the value of attribute queue_id.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def queue_id @queue_id end |
#real_till_time_not_used ⇒ Object
Returns the value of attribute real_till_time_not_used.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def real_till_time_not_used @real_till_time_not_used end |
#responsible ⇒ Object
Returns the value of attribute responsible.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def responsible @responsible end |
#responsible_id ⇒ Object
Returns the value of attribute responsible_id.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def responsible_id @responsible_id end |
#service_id ⇒ Object
Returns the value of attribute service_id.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def service_id @service_id end |
#slaid ⇒ Object
Returns the value of attribute slaid.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def slaid @slaid end |
#state ⇒ Object
Returns the value of attribute state.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def state @state end |
#state_id ⇒ Object
Returns the value of attribute state_id.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def state_id @state_id end |
#state_type ⇒ Object
Returns the value of attribute state_type.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def state_type @state_type end |
#ticket_free_key1 ⇒ Object
Returns the value of attribute ticket_free_key1.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_key1 @ticket_free_key1 end |
#ticket_free_key10 ⇒ Object
Returns the value of attribute ticket_free_key10.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_key10 @ticket_free_key10 end |
#ticket_free_key11 ⇒ Object
Returns the value of attribute ticket_free_key11.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_key11 @ticket_free_key11 end |
#ticket_free_key12 ⇒ Object
Returns the value of attribute ticket_free_key12.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_key12 @ticket_free_key12 end |
#ticket_free_key13 ⇒ Object
Returns the value of attribute ticket_free_key13.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_key13 @ticket_free_key13 end |
#ticket_free_key14 ⇒ Object
Returns the value of attribute ticket_free_key14.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_key14 @ticket_free_key14 end |
#ticket_free_key15 ⇒ Object
Returns the value of attribute ticket_free_key15.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_key15 @ticket_free_key15 end |
#ticket_free_key16 ⇒ Object
Returns the value of attribute ticket_free_key16.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_key16 @ticket_free_key16 end |
#ticket_free_key2 ⇒ Object
Returns the value of attribute ticket_free_key2.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_key2 @ticket_free_key2 end |
#ticket_free_key3 ⇒ Object
Returns the value of attribute ticket_free_key3.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_key3 @ticket_free_key3 end |
#ticket_free_key4 ⇒ Object
Returns the value of attribute ticket_free_key4.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_key4 @ticket_free_key4 end |
#ticket_free_key5 ⇒ Object
Returns the value of attribute ticket_free_key5.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_key5 @ticket_free_key5 end |
#ticket_free_key6 ⇒ Object
Returns the value of attribute ticket_free_key6.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_key6 @ticket_free_key6 end |
#ticket_free_key7 ⇒ Object
Returns the value of attribute ticket_free_key7.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_key7 @ticket_free_key7 end |
#ticket_free_key8 ⇒ Object
Returns the value of attribute ticket_free_key8.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_key8 @ticket_free_key8 end |
#ticket_free_key9 ⇒ Object
Returns the value of attribute ticket_free_key9.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_key9 @ticket_free_key9 end |
#ticket_free_text1 ⇒ Object
Returns the value of attribute ticket_free_text1.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_text1 @ticket_free_text1 end |
#ticket_free_text10 ⇒ Object
Returns the value of attribute ticket_free_text10.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_text10 @ticket_free_text10 end |
#ticket_free_text11 ⇒ Object
Returns the value of attribute ticket_free_text11.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_text11 @ticket_free_text11 end |
#ticket_free_text12 ⇒ Object
Returns the value of attribute ticket_free_text12.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_text12 @ticket_free_text12 end |
#ticket_free_text13 ⇒ Object
Returns the value of attribute ticket_free_text13.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_text13 @ticket_free_text13 end |
#ticket_free_text14 ⇒ Object
Returns the value of attribute ticket_free_text14.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_text14 @ticket_free_text14 end |
#ticket_free_text15 ⇒ Object
Returns the value of attribute ticket_free_text15.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_text15 @ticket_free_text15 end |
#ticket_free_text16 ⇒ Object
Returns the value of attribute ticket_free_text16.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_text16 @ticket_free_text16 end |
#ticket_free_text2 ⇒ Object
Returns the value of attribute ticket_free_text2.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_text2 @ticket_free_text2 end |
#ticket_free_text3 ⇒ Object
Returns the value of attribute ticket_free_text3.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_text3 @ticket_free_text3 end |
#ticket_free_text4 ⇒ Object
Returns the value of attribute ticket_free_text4.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_text4 @ticket_free_text4 end |
#ticket_free_text5 ⇒ Object
Returns the value of attribute ticket_free_text5.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_text5 @ticket_free_text5 end |
#ticket_free_text6 ⇒ Object
Returns the value of attribute ticket_free_text6.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_text6 @ticket_free_text6 end |
#ticket_free_text7 ⇒ Object
Returns the value of attribute ticket_free_text7.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_text7 @ticket_free_text7 end |
#ticket_free_text8 ⇒ Object
Returns the value of attribute ticket_free_text8.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_text8 @ticket_free_text8 end |
#ticket_free_text9 ⇒ Object
Returns the value of attribute ticket_free_text9.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_text9 @ticket_free_text9 end |
#ticket_free_time1 ⇒ Object
Returns the value of attribute ticket_free_time1.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_time1 @ticket_free_time1 end |
#ticket_free_time2 ⇒ Object
Returns the value of attribute ticket_free_time2.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_time2 @ticket_free_time2 end |
#ticket_free_time3 ⇒ Object
Returns the value of attribute ticket_free_time3.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_time3 @ticket_free_time3 end |
#ticket_free_time4 ⇒ Object
Returns the value of attribute ticket_free_time4.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_time4 @ticket_free_time4 end |
#ticket_free_time5 ⇒ Object
Returns the value of attribute ticket_free_time5.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_time5 @ticket_free_time5 end |
#ticket_free_time6 ⇒ Object
Returns the value of attribute ticket_free_time6.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_free_time6 @ticket_free_time6 end |
#ticket_id ⇒ Object
Returns the value of attribute ticket_id.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_id @ticket_id end |
#ticket_number ⇒ Object
Returns the value of attribute ticket_number.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def ticket_number @ticket_number end |
#title ⇒ Object
Returns the value of attribute title.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def title @title end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def type @type end |
#type_id ⇒ Object
Returns the value of attribute type_id.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def type_id @type_id end |
#unlock_timeout ⇒ Object
Returns the value of attribute unlock_timeout.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def unlock_timeout @unlock_timeout end |
#until_time ⇒ Object
Returns the value of attribute until_time.
7 8 9 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 7 def until_time @until_time end |
Class Method Details
.find(id) ⇒ Object
106 107 108 109 110 111 112 113 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 106 def self.find(id) data = { 'TicketID' => id, 'UserID' => 1 } params = { :object => 'TicketObject', :method => 'TicketGet', :data => data } object = self.object_preprocessor(connect(params)) object.run_callbacks :find do object end end |
.free_text_fields(id) ⇒ Object
129 130 131 132 133 134 135 136 137 138 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 129 def self.free_text_fields(id) data = {:UserID => 1, :Type => 'TicketFreeText' + id.to_s} params = { :object => 'TicketObject', :method => 'TicketFreeTextGet', :data => data } a = self.connect(params).first.symbolize_keys #b = [] #a.each do |key,value| # b << [value,key] #end #return b end |
.ticket_number_lookup(ticket_id) ⇒ Object
39 40 41 42 43 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 39 def self.ticket_number_lookup(ticket_id) data = { 'TicketID' => ticket_id, 'UserID' => 1 } params = { :object => 'TicketObject', :method => 'TicketNumberLookup', :data => data } connect(params).first end |
.where(attributes) ⇒ Object
116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 116 def self.where(attributes) attributes['UserID'] = 1 attributes['Result'] = 'ARRAY' data = attributes params = { :object => 'TicketObjectCustom', :method => 'TicketSearch', :data => data } a = connect(params) results = self.superclass::Relation.new a.each do |ticket| results << self.object_preprocessor(ticket) #Add find results to array end results end |
Instance Method Details
#create(attributes) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 51 def create(attributes) attributes[:type] ||= 'Incident' attributes[:state] ||= 'new' attributes[:queue] ||= 'Service Desk' attributes[:lock] ||= 'unlock' attributes[:priority] ||= '3 normal' attributes[:user_id] ||= '1' attributes[:owner_id] ||= attributes[:user_id] tmp = {} attributes.each do |key,value| if key == :user_id tmp[:UserID] = value end if key == :owner_id tmp[:OwnerID] = value end if key == :customer_id tmp[:CustomerID] = value end if key != :user_id or key != :owner_id or key != :customer_id tmp[key.to_s.camelize.to_sym] = value end end attributes = tmp data = attributes params = { :object => 'TicketObject', :method => 'TicketCreate', :data => data } a = connect(params) ticket_id = a.first article = OTRS::Ticket::Article.new( :ticket_id => ticket_id, :body => attributes[:Body], :email => attributes[:Email], :title => attributes[:Title]) if article.save ticket = self.class.find(ticket_id) attributes = ticket.attributes attributes.each do |key,value| instance_variable_set "@#{key.to_s}", value end ticket else ticket.destroy raise 'Could not create ticket' end end |
#destroy ⇒ Object
98 99 100 101 102 103 104 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 98 def destroy id = @ticket_id data = { 'TicketID' => id, 'UserID' => 1 } params = { :object => 'TicketObject', :method => 'TicketDelete', :data => data } connect(params) "Ticket ID: #{id} deleted" end |
#id ⇒ Object
25 26 27 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 25 def id self.ticket_id end |
#name ⇒ Object
147 148 149 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 147 def name self.title end |
#persisted? ⇒ Boolean
29 30 31 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 29 def persisted? false end |
#save ⇒ Object
45 46 47 48 49 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 45 def save run_callbacks :save do self.create(self.attributes) end end |
#set_free_text_field(id, key, value) ⇒ Object
140 141 142 143 144 145 |
# File 'lib/otrs_connector/otrs/ticket.rb', line 140 def set_free_text_field(id, key, value) data = { :UserID => 1, :Counter => id, :Key => key, :Value => value, :TicketID => self.id } params = { :object => 'TicketObject', :method => 'TicketFreeTextSet', :data => data } a = self.connect(params) if a.first == 1 then return true else return false end end |