Class: OTRS::Ticket::State

Inherits:
OTRS::Ticket show all
Defined in:
lib/otrs_connector/otrs/ticket/state.rb

Instance Attribute Summary

Attributes inherited from OTRS::Ticket

#age, #archive_flag, #changed, #create_time_unix, #created, #customer_id, #customer_user_id, #escalation_response_time, #escalation_solution_time, #escalation_time, #escalation_update_time, #group_id, #lock, #lock_id, #owner, #owner_id, #priority, #priority_id, #queue, #queue_id, #real_till_time_not_used, #responsible, #responsible_id, #service_id, #slaid, #state, #state_id, #state_type, #ticket_free_key1, #ticket_free_key10, #ticket_free_key11, #ticket_free_key12, #ticket_free_key13, #ticket_free_key14, #ticket_free_key15, #ticket_free_key16, #ticket_free_key2, #ticket_free_key3, #ticket_free_key4, #ticket_free_key5, #ticket_free_key6, #ticket_free_key7, #ticket_free_key8, #ticket_free_key9, #ticket_free_text1, #ticket_free_text10, #ticket_free_text11, #ticket_free_text12, #ticket_free_text13, #ticket_free_text14, #ticket_free_text15, #ticket_free_text16, #ticket_free_text2, #ticket_free_text3, #ticket_free_text4, #ticket_free_text5, #ticket_free_text6, #ticket_free_text7, #ticket_free_text8, #ticket_free_text9, #ticket_free_time1, #ticket_free_time2, #ticket_free_time3, #ticket_free_time4, #ticket_free_time5, #ticket_free_time6, #ticket_id, #ticket_number, #title, #type, #type_id, #unlock_timeout, #until_time

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from OTRS::Ticket

#create, #destroy, find, free_text_fields, #id, #name, #save, #set_free_text_field, ticket_number_lookup, where

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 = {}) ⇒ State

Returns a new instance of State.



11
12
13
14
15
16
# File 'lib/otrs_connector/otrs/ticket/state.rb', line 11

def initialize(attributes = {})
  attributes.each do |name, value|
    OTRS::Ticket.set_accessor(name.to_s.underscore)
    send("#{name.to_s.underscore.to_sym}=", value)
  end
end

Class Method Details

.allObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/otrs_connector/otrs/ticket/state.rb', line 18

def self.all
  data = { 'UserID' => 1 }
  params = { :object => 'StateObject', :method => 'StateList', :data => data }
  a = connect(params)
  a = Hash[*a]
  b = []
  a.each do |key,value|
    c = {}
    c[key] = value
    b << c
  end
  c = self.superclass.superclass::Relation.new
  b.each do |d|
    d.each do |key,value|
      tmp = {}
      tmp[:id] = key
      tmp[:name] = value
      c << new(tmp)
    end
  end
  c
end

.all_nameObject



41
42
43
44
45
46
47
# File 'lib/otrs_connector/otrs/ticket/state.rb', line 41

def self.all_name
  collection = []
  self.all.each do |s|
    collection << s.name
  end
  return collection
end

.set_accessor(key) ⇒ Object



3
4
5
# File 'lib/otrs_connector/otrs/ticket/state.rb', line 3

def self.set_accessor(key)
  attr_accessor key.to_sym
end

Instance Method Details

#persisted?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/otrs_connector/otrs/ticket/state.rb', line 7

def persisted?
  false
end