infopark_reactor 1.26.1 → 1.27.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +25 -0
  3. data/.rubocop_todo.yml +363 -0
  4. data/Rakefile +10 -13
  5. data/app/models/rails_connector/abstract_obj.rb +2 -1
  6. data/config/routes.rb +0 -1
  7. data/infopark_reactor.gemspec +16 -15
  8. data/lib/generators/cm/migration/migration_generator.rb +4 -8
  9. data/lib/infopark_reactor.rb +43 -69
  10. data/lib/reactor/already_released.rb +1 -2
  11. data/lib/reactor/attributes.rb +92 -268
  12. data/lib/reactor/attributes/date_serializer.rb +20 -16
  13. data/lib/reactor/attributes/html_serializer.rb +6 -5
  14. data/lib/reactor/attributes/link_list_extender.rb +10 -8
  15. data/lib/reactor/attributes/link_list_from_accessor.rb +2 -1
  16. data/lib/reactor/attributes/link_list_from_attr_values.rb +2 -1
  17. data/lib/reactor/attributes/link_list_serializer.rb +8 -7
  18. data/lib/reactor/attributes_handlers.rb +164 -0
  19. data/lib/reactor/cache/permission.rb +6 -9
  20. data/lib/reactor/cache/user.rb +3 -6
  21. data/lib/reactor/cm/attribute.rb +16 -16
  22. data/lib/reactor/cm/attribute_group.rb +18 -21
  23. data/lib/reactor/cm/blob_too_small_error.rb +2 -2
  24. data/lib/reactor/cm/bridge.rb +6 -9
  25. data/lib/reactor/cm/channel.rb +3 -4
  26. data/lib/reactor/cm/editorial_group.rb +2 -9
  27. data/lib/reactor/cm/group.rb +30 -43
  28. data/lib/reactor/cm/job.rb +23 -25
  29. data/lib/reactor/cm/language.rb +21 -22
  30. data/lib/reactor/cm/link.rb +38 -40
  31. data/lib/reactor/cm/live_group.rb +2 -9
  32. data/lib/reactor/cm/log_entry.rb +22 -21
  33. data/lib/reactor/cm/missing_credentials.rb +3 -2
  34. data/lib/reactor/cm/multi_xml_request.rb +22 -25
  35. data/lib/reactor/cm/obj.rb +159 -154
  36. data/lib/reactor/cm/obj_class.rb +52 -51
  37. data/lib/reactor/cm/object_base.rb +26 -21
  38. data/lib/reactor/cm/permissions.rb +7 -7
  39. data/lib/reactor/cm/user.rb +43 -51
  40. data/lib/reactor/cm/workflow.rb +11 -12
  41. data/lib/reactor/cm/xml_attribute.rb +10 -19
  42. data/lib/reactor/cm/xml_markup.rb +7 -10
  43. data/lib/reactor/cm/xml_multi_request_error.rb +1 -3
  44. data/lib/reactor/cm/xml_request.rb +21 -29
  45. data/lib/reactor/cm/xml_request_error.rb +1 -3
  46. data/lib/reactor/cm/xml_response.rb +8 -16
  47. data/lib/reactor/cm/xml_single_request_error.rb +3 -5
  48. data/lib/reactor/configuration.rb +1 -3
  49. data/lib/reactor/engine.rb +5 -10
  50. data/lib/reactor/legacy.rb +6 -7
  51. data/lib/reactor/link/external.rb +8 -5
  52. data/lib/reactor/link/internal.rb +8 -5
  53. data/lib/reactor/link/temporary_link.rb +16 -17
  54. data/lib/reactor/main.rb +11 -15
  55. data/lib/reactor/migration.rb +52 -53
  56. data/lib/reactor/no_working_version.rb +1 -2
  57. data/lib/reactor/not_permitted.rb +1 -2
  58. data/lib/reactor/permission.rb +36 -38
  59. data/lib/reactor/persistence.rb +104 -178
  60. data/lib/reactor/plans/common_attribute.rb +7 -7
  61. data/lib/reactor/plans/common_attribute_group.rb +6 -6
  62. data/lib/reactor/plans/common_channel.rb +6 -6
  63. data/lib/reactor/plans/common_group.rb +7 -14
  64. data/lib/reactor/plans/common_job.rb +6 -6
  65. data/lib/reactor/plans/common_obj_class.rb +11 -11
  66. data/lib/reactor/plans/create_attribute.rb +1 -3
  67. data/lib/reactor/plans/create_attribute_group.rb +1 -3
  68. data/lib/reactor/plans/create_channel.rb +2 -3
  69. data/lib/reactor/plans/create_group.rb +3 -10
  70. data/lib/reactor/plans/create_job.rb +3 -4
  71. data/lib/reactor/plans/create_obj.rb +12 -14
  72. data/lib/reactor/plans/create_obj_class.rb +1 -2
  73. data/lib/reactor/plans/delete_attribute.rb +1 -3
  74. data/lib/reactor/plans/delete_attribute_group.rb +2 -4
  75. data/lib/reactor/plans/delete_channel.rb +3 -6
  76. data/lib/reactor/plans/delete_group.rb +2 -9
  77. data/lib/reactor/plans/delete_job.rb +3 -5
  78. data/lib/reactor/plans/delete_obj.rb +3 -4
  79. data/lib/reactor/plans/delete_obj_class.rb +1 -2
  80. data/lib/reactor/plans/prepared.rb +3 -4
  81. data/lib/reactor/plans/rename_group.rb +4 -11
  82. data/lib/reactor/plans/rename_obj_class.rb +1 -2
  83. data/lib/reactor/plans/update_attribute.rb +1 -3
  84. data/lib/reactor/plans/update_attribute_group.rb +2 -4
  85. data/lib/reactor/plans/update_group.rb +2 -9
  86. data/lib/reactor/plans/update_job.rb +4 -8
  87. data/lib/reactor/plans/update_obj.rb +6 -7
  88. data/lib/reactor/plans/update_obj_class.rb +0 -2
  89. data/lib/reactor/rc_independent.rb +0 -1
  90. data/lib/reactor/session.rb +27 -31
  91. data/lib/reactor/session/observers.rb +3 -5
  92. data/lib/reactor/session/user.rb +6 -7
  93. data/lib/reactor/session_helper/auth_filter.rb +9 -0
  94. data/lib/reactor/session_helper/auth_helper.rb +24 -0
  95. data/lib/reactor/session_helper/rsession_helper.rb +16 -0
  96. data/lib/reactor/session_helper/session_state.rb +31 -0
  97. data/lib/reactor/streaming_upload.rb +0 -1
  98. data/lib/reactor/sudo.rb +2 -3
  99. data/lib/reactor/support/link_matcher.rb +8 -7
  100. data/lib/reactor/tools/migrator.rb +30 -35
  101. data/lib/reactor/tools/response_handler/xml_attribute.rb +27 -33
  102. data/lib/reactor/tools/smart_xml_logger.rb +20 -22
  103. data/lib/reactor/tools/sower.rb +22 -23
  104. data/lib/reactor/tools/uploader.rb +12 -17
  105. data/lib/reactor/tools/versioner.rb +29 -30
  106. data/lib/reactor/tools/where_query.rb +11 -14
  107. data/lib/reactor/tools/workflow_generator.rb +26 -28
  108. data/lib/reactor/tools/xml_attributes.rb +7 -14
  109. data/lib/reactor/tools/xpath_extractor.rb +2 -1
  110. data/lib/reactor/validations.rb +20 -16
  111. data/lib/reactor/version.rb +1 -2
  112. data/lib/reactor/workflow.rb +10 -33
  113. data/lib/reactor/workflow/comment.rb +28 -0
  114. data/lib/reactor/workflow/empty.rb +0 -1
  115. data/lib/reactor/workflow/standard.rb +4 -3
  116. data/lib/tasks/cm_migrate.rake +3 -3
  117. data/lib/tasks/cm_seeds.rake +9 -16
  118. metadata +64 -28
  119. data/app/models/rails_connector/abstract_model.rb +0 -7
  120. data/app/models/rails_connector/attribute.rb +0 -94
  121. data/app/models/rails_connector/blob_mapping.rb +0 -16
  122. data/app/models/rails_connector/channel.rb +0 -41
  123. data/app/models/rails_connector/content.rb +0 -12
  124. data/app/models/rails_connector/job.rb +0 -14
  125. data/app/models/rails_connector/obj_class.rb +0 -158
  126. data/app/models/rails_connector/obj_class_attr.rb +0 -5
  127. data/app/models/rails_connector/object_with_meta_data.rb +0 -18
  128. data/lib/rails_connector/meta/eager_loader.rb +0 -91
  129. data/lib/reactor/rails_connector_meta.rb +0 -149
  130. data/lib/reactor/session_helper.rb +0 -72
@@ -1,15 +1,15 @@
1
- require 'reactor/cm/object_base'
1
+ require "reactor/cm/object_base"
2
2
 
3
3
  module Reactor
4
4
  module Cm
5
- class AttributeGroup < ObjectBase
6
- set_base_name 'attributeGroup'
5
+ class AttributeGroup < ObjectBase
6
+ set_base_name "attributeGroup"
7
7
 
8
8
  attribute :obj_class, name: :objClass
9
9
  attribute :name
10
10
  attribute :title
11
11
 
12
- attribute :attributes, :except => [:set], :type => :list
12
+ attribute :attributes, except: [:set], type: :list
13
13
  attribute :index
14
14
 
15
15
  # virtual attribute!
@@ -31,15 +31,13 @@ module Reactor
31
31
 
32
32
  response = request.execute!
33
33
 
34
- return response.ok?
35
-
36
- rescue XmlRequestError => e
37
- return false
34
+ response.ok?
35
+ rescue XmlRequestError
36
+ false
38
37
  end
39
38
 
40
-
41
- def self.create(obj_class, name, index=nil)
42
- pk = [obj_class, name].join('.')
39
+ def self.create(obj_class, name, index = nil)
40
+ pk = [obj_class, name].join(".")
43
41
  attributes = {
44
42
  objClass: obj_class,
45
43
  name: name
@@ -50,25 +48,24 @@ module Reactor
50
48
  end
51
49
 
52
50
  def add_attributes(attributes)
53
- add_or_remove_attributes(attributes, 'add')
51
+ add_or_remove_attributes(attributes, "add")
54
52
  end
55
53
 
56
54
  def remove_attributes(attributes)
57
- add_or_remove_attributes(attributes, 'remove')
55
+ add_or_remove_attributes(attributes, "remove")
58
56
  end
59
57
 
60
58
  def move_attribute(attribute, index)
61
59
  request = XmlRequest.prepare do |xml|
62
60
  xml.where_key_tag!(base_name, primary_key, primary_key_value)
63
61
  xml.tag!("#{base_name}-moveAttribute") do
64
- xml.tag!('attribute') do
62
+ xml.tag!("attribute") do
65
63
  xml.text!(attribute.to_s)
66
64
  end
67
- xml.tag!('index') do
65
+ xml.tag!("index") do
68
66
  xml.text!(index.to_s)
69
67
  end
70
68
  end
71
-
72
69
  end
73
70
 
74
71
  response = request.execute!
@@ -77,16 +74,17 @@ module Reactor
77
74
  end
78
75
 
79
76
  def set(attr, value)
80
- self.send(:"#{attr}=", value)
77
+ send(:"#{attr}=", value)
81
78
  end
82
79
 
83
80
  protected
81
+
84
82
  def primary_key_value
85
- "#{self.obj_class}.#{self.name}"
83
+ "#{obj_class}.#{name}"
86
84
  end
87
85
 
88
86
  def primary_key_value_set(value)
89
- a = value.split('.')
87
+ a = value.split(".")
90
88
  self.obj_class = a.first
91
89
  self.name = a.last
92
90
  end
@@ -96,12 +94,11 @@ module Reactor
96
94
  xml.where_key_tag!(base_name, primary_key, primary_key_value)
97
95
  xml.tag!("#{base_name}-#{add_or_remove}Attributes") do
98
96
  attributes.each do |attribute|
99
- xml.tag!('listitem') do
97
+ xml.tag!("listitem") do
100
98
  xml.text!(attribute)
101
99
  end
102
100
  end
103
101
  end
104
-
105
102
  end
106
103
 
107
104
  response = request.execute!
@@ -1,9 +1,9 @@
1
1
  module Reactor
2
2
  module Cm
3
3
  class BlobTooSmallError < XmlRequestError
4
- def initialize(msg=nil)
4
+ def initialize(msg = nil)
5
5
  super(msg ||
6
- 'The blob is too small (smaller than tuning.minStreamingDataLength) to get streaming ticket id')
6
+ "The blob is too small (smaller than tuning.minStreamingDataLength) to get streaming ticket id")
7
7
  end
8
8
  end
9
9
  end
@@ -1,18 +1,17 @@
1
- # -*- encoding : utf-8 -*-
2
1
  module Reactor
3
2
  module Cm
4
3
  class Bridge
5
4
  # credit goes to Anton
6
5
  def self.login_for(sessionId)
7
6
  old_username = Reactor::Configuration.xml_access[:username]
8
- Reactor::Configuration.xml_access[:username] = 'root'
7
+ Reactor::Configuration.xml_access[:username] = "root"
9
8
  begin
10
9
  response = Reactor::Cm::XmlRequest.prepare do |xml|
11
- xml.tag!('licenseManager-logins')
10
+ xml.tag!("licenseManager-logins")
12
11
  end.execute!
13
12
  login = nil
14
- result = response.xpath('//licenseManager-logins/listitem')
15
- result = [result] unless result.kind_of?(Array)
13
+ result = response.xpath("//licenseManager-logins/listitem")
14
+ result = [result] unless result.is_a?(Array)
16
15
  result.each do |login_data_element|
17
16
  properties = deserialize_login_data(login_data_element.text)
18
17
  if properties[:sessionId] == sessionId && properties[:interface] == "X"
@@ -21,7 +20,7 @@ module Reactor
21
20
  end
22
21
  end
23
22
  login
24
- rescue => e
23
+ rescue StandardError => e
25
24
  Rails.logger.error "Login to CM failed! #{e.class}: #{e.message}"
26
25
  nil
27
26
  ensure
@@ -29,19 +28,17 @@ module Reactor
29
28
  end
30
29
  end
31
30
 
32
- private
33
31
  def self.deserialize_login_data(serialized_property_list)
34
32
  entry_delimiter = /;\r?\n/
35
33
  no_braces = serialized_property_list[1..(serialized_property_list.rindex(entry_delimiter) - 1)]
36
34
  property_list_lines = no_braces.split(entry_delimiter)
37
- property_list_lines.inject(properties = {}) do |map, line|
35
+ property_list_lines.each_with_object(properties = {}) do |line, map|
38
36
  key, value = line.strip.scan(/^([^=]*) = (.*)$/).first
39
37
  if value[0..0] == '"'
40
38
  value = value[1..(value.length - 2)]
41
39
  value.gsub!(/\\(.)/, '\1')
42
40
  end
43
41
  map[key.to_sym] = value
44
- map
45
42
  end
46
43
  properties
47
44
  end
@@ -1,17 +1,16 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'reactor/cm/object_base'
1
+ require "reactor/cm/object_base"
3
2
 
4
3
  module Reactor
5
4
  module Cm
6
5
  class Channel < ObjectBase
7
6
  # Attribute definitions
8
- attribute :name, :except => [:set]
7
+ attribute :name, except: [:set]
9
8
  attribute :title
10
9
 
11
10
  primary_key :name
12
11
 
13
12
  def self.create(name)
14
- super(name, {:name => name})
13
+ super(name, { name: name })
15
14
  end
16
15
  end
17
16
  end
@@ -1,14 +1,10 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'reactor/cm/group'
1
+ require "reactor/cm/group"
3
2
 
4
3
  module Reactor
5
-
6
4
  module Cm
7
-
8
5
  # The EditorialGroup class respects the user management configured in the content manager and
9
6
  # handles all editorial groups. See @Group for further details.
10
7
  class EditorialGroup < Group
11
-
12
8
  primary_key :name
13
9
 
14
10
  protected
@@ -19,11 +15,8 @@ module Reactor
19
15
  end
20
16
 
21
17
  def self.base_name
22
- 'groupProxy'
18
+ "groupProxy"
23
19
  end
24
-
25
20
  end
26
-
27
21
  end
28
-
29
22
  end
@@ -1,32 +1,27 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'reactor/cm/xml_request'
3
- require 'reactor/cm/xml_response'
4
- require 'reactor/cm/xml_request_error'
5
- require 'reactor/tools/xml_attributes'
6
- require 'reactor/tools/response_handler/xml_attribute'
7
- require 'reactor/tools/where_query'
1
+ require "reactor/cm/xml_request"
2
+ require "reactor/cm/xml_response"
3
+ require "reactor/cm/xml_request_error"
4
+ require "reactor/tools/xml_attributes"
5
+ require "reactor/tools/response_handler/xml_attribute"
6
+ require "reactor/tools/where_query"
8
7
 
9
- require 'reactor/cm/permissions'
8
+ require "reactor/cm/permissions"
10
9
 
11
10
  module Reactor
12
-
13
11
  module Cm
14
-
15
12
  # The Group class can be used to work with user groups defined or known to the content manager.
16
13
  # It allows you to create, edit and delete groups, handle users and permissions and get the
17
14
  # group meta data. The Group class does not respect the user management defined under
18
15
  # "config/userManagement.xml", but is the basis for class like @EditorialGroup or @LiveGroup
19
16
  # that respect the user management.
20
17
  class Group
21
-
22
18
  include XmlAttributes
23
19
  extend WhereQuery
24
20
 
25
21
  class << self
26
-
27
22
  # Method returns true if a group with the given +name+ exists, false otherwise.
28
23
  def exists?(name)
29
- object = new(:name => name)
24
+ object = new(name: name)
30
25
 
31
26
  begin
32
27
  object.send(:get).present?
@@ -37,12 +32,12 @@ module Reactor
37
32
 
38
33
  # Returns all known group names as an array of strings.
39
34
  def all(match = nil)
40
- self.where("groupText", match)
35
+ where("groupText", match)
41
36
  end
42
37
 
43
38
  # See @get.
44
39
  def get(name)
45
- object = new(:name => name)
40
+ object = new(name: name)
46
41
  object.send(:get)
47
42
  object
48
43
  end
@@ -53,16 +48,15 @@ module Reactor
53
48
  object.send(:create)
54
49
  object
55
50
  end
56
-
57
51
  end
58
52
 
59
53
  include Permissions
60
54
 
61
- attribute :name, :except => [:set]
62
- attribute :display_title, :name => :displayTitle, :only => [:get]
63
- attribute :real_name, :name => :realName
55
+ attribute :name, except: [:set]
56
+ attribute :display_title, name: :displayTitle, only: [:get]
57
+ attribute :real_name, name: :realName
64
58
  attribute :owner
65
- attribute :users, :type => :list
59
+ attribute :users, type: :list
66
60
 
67
61
  primary_key :name
68
62
 
@@ -73,7 +67,7 @@ module Reactor
73
67
 
74
68
  # Add the given +users+ to the current set of group users.
75
69
  def add_users!(users)
76
- users = users.kind_of?(Array) ? users : [users]
70
+ users = users.is_a?(Array) ? users : [users]
77
71
  users = self.users | users
78
72
 
79
73
  set_users(users)
@@ -81,7 +75,7 @@ module Reactor
81
75
 
82
76
  # Remove the given +users+ from the current set of group users.
83
77
  def remove_users!(users)
84
- users = users.kind_of?(Array) ? users : [users]
78
+ users = users.is_a?(Array) ? users : [users]
85
79
  users = self.users - users
86
80
 
87
81
  set_users(users)
@@ -90,7 +84,7 @@ module Reactor
90
84
  # Set the group users to the given +users+.
91
85
  def set_users!(users)
92
86
  request = XmlRequest.prepare do |xml|
93
- xml.where_key_tag!(base_name, self.class.primary_key, self.name)
87
+ xml.where_key_tag!(base_name, self.class.primary_key, name)
94
88
  xml.set_key_tag!(base_name, self.class.xml_attribute(:users).name, users)
95
89
  end
96
90
 
@@ -102,10 +96,10 @@ module Reactor
102
96
  # Saves all settable instance attributes to the Content Manager.
103
97
  def save!
104
98
  request = XmlRequest.prepare do |xml|
105
- xml.where_key_tag!(base_name, self.class.primary_key, self.name)
99
+ xml.where_key_tag!(base_name, self.class.primary_key, name)
106
100
  xml.set_tag!(base_name) do
107
101
  self.class.attributes(:set).each do |name, xml_attribute|
108
- value = self.send(name)
102
+ value = send(name)
109
103
 
110
104
  xml.value_tag!(xml_attribute.name, value)
111
105
  end
@@ -120,7 +114,7 @@ module Reactor
120
114
  # Deletes the current group instance.
121
115
  def delete!
122
116
  request = XmlRequest.prepare do |xml|
123
- xml.where_key_tag!(base_name, self.class.primary_key, self.name)
117
+ xml.where_key_tag!(base_name, self.class.primary_key, name)
124
118
  xml.delete_tag!(base_name)
125
119
  end
126
120
 
@@ -134,15 +128,13 @@ module Reactor
134
128
  # group. The method returns the new group object.
135
129
  def rename!(name)
136
130
  new_attributes =
137
- self.class.attributes.inject({}) do |hash, mapping|
138
- key, _ = mapping
139
-
140
- hash[key] = self.send(key)
131
+ self.class.attributes.each_with_object({}) do |mapping, hash|
132
+ key, = mapping
141
133
 
142
- hash
143
- end
134
+ hash[key] = send(key)
135
+ end
144
136
 
145
- if self.delete!
137
+ if delete!
146
138
  new_attributes[:name] = name
147
139
 
148
140
  self.class.create(new_attributes)
@@ -162,7 +154,7 @@ module Reactor
162
154
  end
163
155
 
164
156
  def self.base_name
165
- 'group'
157
+ "group"
166
158
  end
167
159
 
168
160
  def initialize(attributes = {})
@@ -172,7 +164,7 @@ module Reactor
172
164
  # Retrieves a single group matching the name set in the current instance.
173
165
  def get
174
166
  request = XmlRequest.prepare do |xml|
175
- xml.where_key_tag!(base_name, self.class.primary_key, self.name)
167
+ xml.where_key_tag!(base_name, self.class.primary_key, name)
176
168
  xml.get_key_tag!(base_name, self.class.xml_attribute_names)
177
169
  end
178
170
 
@@ -193,7 +185,7 @@ module Reactor
193
185
  request = XmlRequest.prepare do |xml|
194
186
  xml.create_tag!(base_name) do |xml|
195
187
  self.class.attributes(:create).each do |name, xml_attribute|
196
- value = self.send(name)
188
+ value = send(name)
197
189
 
198
190
  xml.value_tag!(xml_attribute.name, value) if value.present?
199
191
  end
@@ -213,18 +205,13 @@ module Reactor
213
205
  self.class.attribute_names.each do |name|
214
206
  value = attributes[name]
215
207
 
216
- if value.present?
217
- set_attribute(name, value)
218
- end
208
+ set_attribute(name, value) if value.present?
219
209
  end
220
210
  end
221
211
 
222
212
  def set_attribute(name, value) # :nodoc:
223
- self.send("#{name}=", value)
213
+ send("#{name}=", value)
224
214
  end
225
-
226
215
  end
227
-
228
216
  end
229
-
230
217
  end
@@ -1,36 +1,34 @@
1
- # -*- encoding : utf-8 -*-
2
-
3
- require 'reactor/cm/object_base'
1
+ require "reactor/cm/object_base"
4
2
 
5
3
  module Reactor
6
4
  module Cm
7
5
  class Job < ObjectBase
8
- attribute :name, :except => [:set]
6
+ attribute :name, except: [:set]
9
7
  attribute :title
10
- attribute :is_active, :name => :isActive
8
+ attribute :is_active, name: :isActive
11
9
  attribute :comment
12
- attribute :exec_login, :name => :execLogin
13
- attribute :exec_perm, :name => :execPerm
10
+ attribute :exec_login, name: :execLogin
11
+ attribute :exec_perm, name: :execPerm
14
12
  # This attribute has the following format:
15
13
  # [{:years => ['2001', '2002']}, {:years => ['2002', '2003'], :minutes => ['11', '12']}]
16
- attribute :schedule, :type => :schedule
14
+ attribute :schedule, type: :schedule
17
15
  attribute :script
18
16
 
19
17
  primary_key :name
20
18
 
21
19
  def self.serialize_attribute_to_xml(xml, xml_attribute, value)
22
20
  if xml_attribute.type.to_sym == :schedule
23
- xml.tag!('schedule') do
21
+ xml.tag!("schedule") do
24
22
  (value || []).each do |schedule_entry|
25
- xml.tag!('listitem') do
23
+ xml.tag!("listitem") do
26
24
  schedule_entry.each do |dim, values|
27
- xml.tag!('dictitem') do
28
- xml.tag!('key') do
25
+ xml.tag!("dictitem") do
26
+ xml.tag!("key") do
29
27
  xml.text!(dim.to_s)
30
28
  end
31
- xml.tag!('value') do
29
+ xml.tag!("value") do
32
30
  values.each do |val|
33
- xml.tag!('listitem', val)
31
+ xml.tag!("listitem", val)
34
32
  end
35
33
  end
36
34
  end
@@ -43,37 +41,37 @@ module Reactor
43
41
  end
44
42
  end
45
43
 
46
- def self.create(pk_value, attributes={})
44
+ def self.create(pk_value, attributes = {})
47
45
  request = XmlRequest.prepare do |xml|
48
46
  xml.create_tag!(base_name) do
49
- attributes.merge(:name => pk_value).each do |attr_name, attr_value|
50
- self.serialize_attribute_to_xml(xml, self.xml_attribute(attr_name), attr_value)
47
+ attributes.merge(name: pk_value).each do |attr_name, attr_value|
48
+ serialize_attribute_to_xml(xml, xml_attribute(attr_name), attr_value)
51
49
  end
52
50
  end
53
51
  end
54
52
 
55
- response = request.execute!
53
+ request.execute!
56
54
 
57
- return get(pk_value)
55
+ get(pk_value)
58
56
  end
59
57
 
60
58
  def exec
61
- simple_commnad('exec')
59
+ simple_commnad("exec")
62
60
  end
63
61
 
64
62
  def cancel
65
- simple_command('cancel')
63
+ simple_command("cancel")
66
64
  end
67
65
 
68
66
  protected
67
+
69
68
  def simple_command(cmd_name)
70
69
  request = XmlRequest.prepare do |xml|
71
- xml.where_key_tag!(self.base_name, 'name', self.name)
72
- xml.tag!("#{self.base_name}-#{cmd_name}")
70
+ xml.where_key_tag!(base_name, "name", name)
71
+ xml.tag!("#{base_name}-#{cmd_name}")
73
72
  end
74
- response = request.execute!
73
+ request.execute!
75
74
  end
76
75
  end
77
76
  end
78
77
  end
79
-