Class: IssueCentre::TicketConnection

Inherits:
GenericConnection show all
Defined in:
lib/issue_centre/ticket_connection.rb

Instance Method Summary collapse

Constructor Details

#initialize(customer_url, session_key, options = {}) ⇒ CustomerConnection

Connection client for authenticating and retrieving ticket information from IssueCentre

Parameters:



16
17
18
19
# File 'lib/issue_centre/ticket_connection.rb', line 16

def initialize( customer_url, session_key, options = {})
  #      @session_key = session_key
  super( customer_url, options)
end

Instance Method Details

#get_closed_tickets(session_key, company_id, page_size, page_num) ⇒ Array

Return (closed) tickets from IssueCentre for this contract

Parameters:

  • session_key (SessionKey)

    SessionKey object

  • company_id (Integer)

    A Company ID for the function to return closed tickets for. Zero returns a list of all closed tickets across all companies.

  • page_size (Integer)

    The number of tickets to be returned per page.

  • page_num (Integer)

    Which page number [1+] to return tickets for.

Returns:

  • (Array)

    An array of closed tickets and details as hashes



61
62
63
64
65
66
67
68
69
# File 'lib/issue_centre/ticket_connection.rb', line 61

def get_closed_tickets( session_key, company_id, page_size, page_num)
  response_xml = self.call( :get_closed_tickets, message: {
                              arg0: session_key,
                              arg1: company_id,
                              arg2: page_size,
                              arg3: page_num
                            })
  response = IssueCentre::Response.parse( response_xml)
end

#get_events_for_ticket(session_key, ticket_id) ⇒ Array

Return all events from IssueCentre for this ticket

Parameters:

  • session_key (String)

    SessionKey object

  • ticket_id (Integer)

    Ticket ID for the required ticket

Returns:

  • (Array)

    An array of events and details as hashes



80
81
82
83
84
85
86
# File 'lib/issue_centre/ticket_connection.rb', line 80

def get_events_for_ticket( session_key, ticket_id)
  response_xml = self.call( :get_events_for_ticket, message: {
                              arg0: session_key,
                              arg1: ticket_id
                            })
  response = IssueCentre::Response.parse( response_xml)
end

#get_open_tickets(session_key, company_id, page_size, page_num) ⇒ Array

Return (open) tickets from IssueCentre for this contract

Parameters:

  • session_key (String)

    SessionKey for this session

  • company_id (Integer)

    A Company ID for the function to return open tickets for. Zero returns a list of all open tickets across all companies.

  • page_size (Integer)

    The number of tickets to be returned per page.

  • page_num (Integer)

    Which page number [1+] to return tickets for.

Returns:

  • (Array)

    An array of open tickets and details as hashes



36
37
38
39
40
41
42
43
44
# File 'lib/issue_centre/ticket_connection.rb', line 36

def get_open_tickets( session_key, company_id, page_size, page_num)
  response_xml = self.call( :get_open_tickets, message: {
                              arg0: session_key,
                              arg1: company_id,
                              arg2: page_size,
                              arg3: page_num
                            })
  response = IssueCentre::Response.parse( response_xml)
end

#get_ticket_details(session_key, ticket_id) ⇒ Array

Return all details from IssueCentre for this ticket

Parameters:

  • session_key (String)

    SessionKey object

  • ticket_id (Integer)

    Ticket ID for the required ticket

Returns:

  • (Array)

    An array of details as hashes



98
99
100
101
102
103
104
# File 'lib/issue_centre/ticket_connection.rb', line 98

def get_ticket_details( session_key, ticket_id)
  response_xml = self.call( :get_ticket_details, message: {
                              api_key: session_key,
                              ticket: ticket_id
                            })
  response = IssueCentre::Response.parse( response_xml)
end

#search_tickets(session_key, company_id, contact_id, vendor_id, product_id, status, owner_id, ticket_reference, client_reference, supplier_reference, company_reference, date_from, date_to, ticket_status, priority, free_text, page_size, page_num, tags) ⇒ Array

Return all tickets from IssueCentre that match these search parameters

Parameters:

  • session_key (String)

    SessionKey object

  • company_id (Integer)

    Company ID to search for (0 returns tickets for all companies)

  • contact_id (Integer)

    Contact ID to search for (0 returns tickets for all contacts)

  • vendor_id (Integer)

    Vendor ID to search for (0 returns tickets for all vendors)

  • product_id (Integer)

    Product ID to search for (0 returns tickets for all products)

  • status (Symbol)

    Ticket status to search for (:open, :closed, :both)

  • ticket_reference (String)

    Ticket reference to search for (“” returns tickets for all references)

  • owner_id (Integer)

    Ticket Owner ID to limit search by (0 returns tickets for all references)

  • client_reference (String)

    Client reference to search for (“” returns tickets for all references)

  • supplier_reference (String)

    Ticket reference to search for (“” returns tickets for all references)

  • company_reference (String)

    Ticket reference to search for (“” returns tickets for all references)

  • date_from (Time)

    Date and time to search from (based on ticket creation date)

  • date_to (Time)

    Date and time to search until (based on ticket creation date)

  • ticket_status (Integer)

    The ticket status code to search for (0 returns all status codes)

  • priority (Integer)

    The ticket priority code to search for (0 returns all priority codes)

  • free_text (String)

    Text to search for within the tickets

  • page_size (Integer)

    The number of tickets to be returned per page.

  • page_num (Integer)

    Which page number [1+] to return tickets for.

  • tags (String)

    Which tags to limit the search to

Returns:

  • (Array)

    An array of tickets and details as hashes



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
# File 'lib/issue_centre/ticket_connection.rb', line 163

def search_tickets( session_key, company_id, contact_id,
                    vendor_id, product_id, status, owner_id,
                    ticket_reference, client_reference,
                    supplier_reference, company_reference,
                    date_from, date_to, ticket_status, priority, free_text,
                    page_size, page_num, tags)

  response_xml = self.call( :search_tickets, message: {
                              arg0:  session_key,
                              arg1:  company_id,
                              arg2:  contact_id,
                              arg3:  vendor_id,
                              arg4:  product_id,
                              arg5:  status,
                              arg6:  owner_id,
                              arg7:  ticket_reference,
                              arg8:  client_reference,
                              arg9:  supplier_reference,
                              arg10: company_reference,
                              arg11: date_from,
                              arg12: date_to,
                              arg13: ticket_status,
                              arg14: priority,
                              arg15: free_text,
                              arg16: page_size,
                              arg17: page_num,
                              arg18: tags
                            })
  response = IssueCentre::Response.parse( response_xml)
end