Class: OTRS::Change::State

Inherits:
OTRS::Change show all
Defined in:
lib/otrs_connector/otrs/change/state.rb

Constant Summary collapse

@@class =
'ITSM::ChangeManagement::Change::State'

Instance Attribute Summary

Attributes inherited from OTRS::Change

#accounted_time, #actual_end_time, #actual_start_time, #cab_agents, #cab_customers, #category, #category_id, #change_builder_id, #change_by, #change_free_key1, #change_free_key10, #change_free_key11, #change_free_key12, #change_free_key13, #change_free_key14, #change_free_key15, #change_free_key16, #change_free_key17, #change_free_key18, #change_free_key19, #change_free_key2, #change_free_key20, #change_free_key21, #change_free_key22, #change_free_key23, #change_free_key24, #change_free_key25, #change_free_key26, #change_free_key27, #change_free_key28, #change_free_key29, #change_free_key3, #change_free_key30, #change_free_key31, #change_free_key32, #change_free_key33, #change_free_key34, #change_free_key35, #change_free_key36, #change_free_key37, #change_free_key38, #change_free_key39, #change_free_key4, #change_free_key40, #change_free_key41, #change_free_key42, #change_free_key43, #change_free_key44, #change_free_key45, #change_free_key46, #change_free_key47, #change_free_key48, #change_free_key49, #change_free_key5, #change_free_key50, #change_free_key6, #change_free_key7, #change_free_key8, #change_free_key9, #change_free_text1, #change_free_text10, #change_free_text11, #change_free_text12, #change_free_text13, #change_free_text14, #change_free_text15, #change_free_text16, #change_free_text17, #change_free_text18, #change_free_text19, #change_free_text2, #change_free_text20, #change_free_text21, #change_free_text22, #change_free_text23, #change_free_text24, #change_free_text25, #change_free_text26, #change_free_text27, #change_free_text28, #change_free_text29, #change_free_text3, #change_free_text30, #change_free_text31, #change_free_text32, #change_free_text33, #change_free_text34, #change_free_text35, #change_free_text36, #change_free_text37, #change_free_text38, #change_free_text39, #change_free_text4, #change_free_text40, #change_free_text41, #change_free_text42, #change_free_text43, #change_free_text44, #change_free_text45, #change_free_text46, #change_free_text47, #change_free_text48, #change_free_text49, #change_free_text5, #change_free_text50, #change_free_text6, #change_free_text7, #change_free_text8, #change_free_text9, #change_id, #change_manager_id, #change_number, #change_state, #change_state_id, #change_state_signal, #change_time, #change_title, #create_by, #create_time, #description, #description_plain, #impact, #impact_id, #justification, #justification_plain, #planned_effort, #planned_end_time, #planned_start_time, #priority, #priority_id, #requested_time, #work_order_count, #work_order_i_ds

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from OTRS::Change

#create, #destroy, find, #id, #name, #save, #status, #update_attributes, where, #work_orders

Methods inherited from OTRS

api_url, api_url=, #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.



20
21
22
23
24
25
# File 'lib/otrs_connector/otrs/change/state.rb', line 20

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

Class Method Details

.allObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/otrs_connector/otrs/change/state.rb', line 27

def self.all
  data = { 'Class' => @@class, 'UserID' => 1 }
  params = { :object => 'StateMachineObject', :method => 'StateList', :data => data }
  a = connect(params).flatten
  b = self.superclass.superclass::Relation.new
  a.each do |c|
    tmp = {}
    c.each do |key,value|
      case key
      when "Key" then tmp[:id] = value
      when "Value" then tmp[:name] = value
      end
    end
    c = tmp
    b << new(c)
  end
  b
end

.set_accessor(key) ⇒ Object



4
5
6
# File 'lib/otrs_connector/otrs/change/state.rb', line 4

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

Instance Method Details

#attributesObject



12
13
14
15
16
17
18
# File 'lib/otrs_connector/otrs/change/state.rb', line 12

def attributes
  attributes = {}
  self.instance_variables.each do |v|
    attributes[v.to_s.gsub('@','').to_sym] = self.instance_variable_get(v)
  end
  attributes
end

#persisted?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/otrs_connector/otrs/change/state.rb', line 8

def persisted?
  false
end