Class: Reactor::Cm::Job
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from ObjectBase
#base_name, base_name, #delete, #delete!, delete!, exists?, get, inherited, #initialize, #reload, #save, #save!, #serialize_attribute_to_xml, set_base_name
Class Method Details
.create(pk_value, attributes = {}) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/reactor/cm/job.rb', line 46
def self.create(pk_value, attributes={})
request = XmlRequest.prepare do |xml|
xml.create_tag!(base_name) do
attributes.merge(:name => pk_value).each do |attr_name, attr_value|
self.serialize_attribute_to_xml(xml, self.xml_attribute(attr_name), attr_value)
end
end
end
response = request.execute!
return get(pk_value)
end
|
.serialize_attribute_to_xml(xml, xml_attribute, value) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/reactor/cm/job.rb', line 21
def self.serialize_attribute_to_xml(xml, xml_attribute, value)
if xml_attribute.type.to_sym == :schedule
xml.tag!('schedule') do
(value || []).each do |schedule_entry|
xml.tag!('listitem') do
schedule_entry.each do |dim, values|
xml.tag!('dictitem') do
xml.tag!('key') do
xml.text!(dim.to_s)
end
xml.tag!('value') do
values.each do |val|
xml.tag!('listitem', val)
end
end
end
end
end
end
end
else
super(xml, xml_attribute, value)
end
end
|
Instance Method Details
#cancel ⇒ Object
64
65
66
|
# File 'lib/reactor/cm/job.rb', line 64
def cancel
simple_command('cancel')
end
|
#exec ⇒ Object
60
61
62
|
# File 'lib/reactor/cm/job.rb', line 60
def exec
simple_commnad('exec')
end
|