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,45 +1,45 @@
1
- # -*- encoding : utf-8 -*-
2
1
  module Reactor
3
2
  module Cm
4
3
  class Language
5
4
  def self.get(username = nil)
6
5
  begin
7
6
  options = {}
8
- options = {:login => username} if username
7
+ options = { login: username } if username
9
8
  request = XmlRequest.prepare do |xml|
10
- xml.tag!('userConfig-getTexts', options) do
11
- xml.tag!('listitem') do
12
- xml.text!('languages.language')
13
- end
14
- end
15
- end
9
+ xml.tag!("userConfig-getTexts", options) do
10
+ xml.tag!("listitem") do
11
+ xml.text!("languages.language")
12
+ end
13
+ end
14
+ end
16
15
  response = request.execute!
17
- response.xpath('//listitem').text
18
- rescue => e
19
- return nil
16
+ response.xpath("//listitem").text
17
+ rescue StandardError
18
+ nil
20
19
  end
21
20
  end
22
21
 
23
22
  # FIXME: broken ([011003] Die Klasse '%s' wird nicht unterstützt.)
24
23
  def self.set(*args)
25
24
  username = language = nil
26
- raise ArgumentError.new('set requires one or two parameters') unless [1,2].include? args.length
25
+ raise ArgumentError, "set requires one or two parameters" unless [1, 2].include? args.length
27
26
 
28
27
  username, language = *args if args.length == 2
29
28
  language = *args if args.length == 1
30
29
 
31
- raise ArgumentError.new('language cannot be nil') if language.nil?
30
+ raise ArgumentError, "language cannot be nil" if language.nil?
31
+
32
32
  options = {}
33
- options = {:login => username} if username
33
+ options = { login: username } if username
34
34
 
35
35
  begin
36
36
  request = XmlRequest.prepare do |xml|
37
- xml.tag!('userConfig.setTexts', options) do
38
- xml.tag!('dictitem') do
39
- xml.tag!('key') do
40
- xml.text!('languages.language')
37
+ xml.tag!("userConfig.setTexts", options) do
38
+ xml.tag!("dictitem") do
39
+ xml.tag!("key") do
40
+ xml.text!("languages.language")
41
41
  end
42
- xml.tag!('value') do
42
+ xml.tag!("value") do
43
43
  xml.text!(language)
44
44
  end
45
45
  end
@@ -47,11 +47,10 @@ module Reactor
47
47
  end
48
48
  response = request.execute!
49
49
  response.ok?
50
- rescue => e
51
- return false
50
+ rescue StandardError
51
+ false
52
52
  end
53
53
  end
54
-
55
54
  end
56
55
  end
57
56
  end
@@ -1,4 +1,3 @@
1
- # -*- encoding : utf-8 -*-
2
1
  module Reactor
3
2
  module Cm
4
3
  class Link
@@ -6,22 +5,22 @@ module Reactor
6
5
  attr_accessor :title, :target, :position
7
6
 
8
7
  def self.exists?(id)
9
- return !Link.get(id).nil?
10
- rescue XmlRequestError => e
11
- return false
8
+ !Link.get(id).nil?
9
+ rescue XmlRequestError
10
+ false
12
11
  end
13
12
 
14
13
  def self.get(id)
15
14
  link = Link.new
16
- link.send(:get,id)
15
+ link.send(:get, id)
17
16
  link
18
17
  end
19
18
 
20
- def self.create_inside(obj, attr, url, title=nil, target=nil)
19
+ def self.create_inside(obj, attr, url, title = nil, target = nil)
21
20
  create(obj.edited_content, attr, url, title, target)
22
21
  end
23
22
 
24
- def self.create(content, attr, url, title=nil, target=nil)
23
+ def self.create(content, attr, url, title = nil, target = nil)
25
24
  link = Link.new
26
25
  link.send(:create, content, attr, url, title, target)
27
26
  link
@@ -42,65 +41,64 @@ module Reactor
42
41
  end
43
42
 
44
43
  def dest_url=(url)
45
- @is_external = (/^\// =~ url).nil?
44
+ @is_external = (%r{^/} =~ url).nil?
46
45
  @dest_obj_id = Obj.get(url).obj_id unless @is_external
47
46
  @dest_url = url
48
47
  end
49
48
 
50
49
  def save!
51
50
  request = XmlRequest.prepare do |xml|
52
- xml.where_key_tag!(base_name, 'id', @link_id)
51
+ xml.where_key_tag!(base_name, "id", @link_id)
53
52
  xml.set_tag!(base_name) do
54
- xml.tag!('target', @target) if @target
55
- xml.tag!('title', @title) if @title
56
- xml.tag!('destinationUrl', @dest_url) if @dest_url
57
- xml.tag!('position', @position) if @position
53
+ xml.tag!("target", @target) if @target
54
+ xml.tag!("title", @title) if @title
55
+ xml.tag!("destinationUrl", @dest_url) if @dest_url
56
+ xml.tag!("position", @position) if @position
58
57
  end
59
58
  end
60
- response = request.execute!
59
+ request.execute!
61
60
  end
62
61
 
63
62
  def hash
64
63
  # yes, to_s.to_is is neccesary,
65
64
  # because self.link_id is of type REXML::Text for the most of the time
66
- self.link_id.to_s.to_i
65
+ link_id.to_s.to_i
67
66
  end
68
67
 
69
-
70
68
  def eql?(other)
71
- self.link_id == other.link_id
69
+ link_id == other.link_id
72
70
  end
73
71
 
74
72
  def delete!
75
73
  request = XmlRequest.prepare do |xml|
76
- xml.where_key_tag!(base_name, 'id', @link_id)
74
+ xml.where_key_tag!(base_name, "id", @link_id)
77
75
  xml.tag!("#{base_name}-delete")
78
76
  end
79
- response = request.execute!
77
+ request.execute!
80
78
  end
81
79
 
82
80
  protected
83
- def initialize
84
- end
81
+
82
+ def initialize; end
85
83
 
86
84
  def base_name
87
- 'link'
85
+ "link"
88
86
  end
89
87
 
90
88
  def get(id)
91
89
  request = XmlRequest.prepare do |xml|
92
- xml.where_key_tag!(base_name, 'id', id)
93
- xml.get_key_tag!(base_name, ['id', 'isExternalLink', 'target', 'title', 'destination', 'destinationUrl', 'position'])
90
+ xml.where_key_tag!(base_name, "id", id)
91
+ xml.get_key_tag!(base_name, %w(id isExternalLink target title destination destinationUrl position))
94
92
  end
95
- response = request.execute!
93
+ response = request.execute!
96
94
 
97
- @link_id = response.xpath('//id/text()')
98
- @is_external = response.xpath('//isExternalLink/text()') == '1'
99
- @target = response.xpath('//target/text()').presence
100
- @title = response.xpath('//title/text()').presence
101
- @dest_obj_id = response.xpath('//destination/text()').presence
102
- @dest_url = response.xpath('//destinationUrl/text()').presence
103
- @position = response.xpath('//position/text()').presence
95
+ @link_id = response.xpath("//id/text()")
96
+ @is_external = response.xpath("//isExternalLink/text()") == "1"
97
+ @target = response.xpath("//target/text()").presence
98
+ @title = response.xpath("//title/text()").presence
99
+ @dest_obj_id = response.xpath("//destination/text()").presence
100
+ @dest_url = response.xpath("//destinationUrl/text()").presence
101
+ @position = response.xpath("//position/text()").presence
104
102
 
105
103
  self
106
104
  end
@@ -108,25 +106,25 @@ module Reactor
108
106
  def create(content, attr, url, title = nil, target = nil)
109
107
  request = XmlRequest.prepare do |xml|
110
108
  xml.create_tag!(base_name) do
111
- xml.tag!('attributeName', attr.to_s)
112
- xml.tag!('sourceContent', content.to_s)
113
- xml.tag!('destinationUrl', url.to_s)
109
+ xml.tag!("attributeName", attr.to_s)
110
+ xml.tag!("sourceContent", content.to_s)
111
+ xml.tag!("destinationUrl", url.to_s)
114
112
  end
115
113
  end
116
114
  response = request.execute!
117
115
 
118
- id = response.xpath('//id/text()')
116
+ id = response.xpath("//id/text()")
119
117
  get(id)
120
118
 
121
119
  if !title.nil? || !target.nil?
122
120
  request = XmlRequest.prepare do |xml|
123
- xml.where_key_tag!(base_name, 'id', id)
121
+ xml.where_key_tag!(base_name, "id", id)
124
122
  xml.set_tag!(base_name) do
125
- xml.value_tag!('title', title) if title
126
- xml.value_tag!('target', target) if target
123
+ xml.value_tag!("title", title) if title
124
+ xml.value_tag!("target", target) if target
127
125
  end
128
126
  end
129
- response = request.execute!
127
+ request.execute!
130
128
  end
131
129
 
132
130
  self
@@ -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 LiveGroup class respects the user management configured in the content manager and
9
6
  # handles all live groups. See @Group for further details.
10
7
  class LiveGroup < Group
11
-
12
8
  protected
13
9
 
14
10
  # Overwritten method from +Group+.
@@ -17,11 +13,8 @@ module Reactor
17
13
  end
18
14
 
19
15
  def self.base_name
20
- 'secondaryGroupProxy'
16
+ "secondaryGroupProxy"
21
17
  end
22
-
23
18
  end
24
-
25
19
  end
26
-
27
20
  end
@@ -5,37 +5,37 @@ module Reactor
5
5
  def where(conditions = {})
6
6
  request = XmlRequest.prepare do |xml|
7
7
  where_part(xml, conditions)
8
- xml.tag!('logEntry-get') do
9
- xml.tag!('logTime')
10
- xml.tag!('logText')
11
- xml.tag!('logType')
12
- xml.tag!('objectId')
13
- xml.tag!('receiver')
14
- xml.tag!('userLogin')
8
+ xml.tag!("logEntry-get") do
9
+ xml.tag!("logTime")
10
+ xml.tag!("logText")
11
+ xml.tag!("logType")
12
+ xml.tag!("objectId")
13
+ xml.tag!("receiver")
14
+ xml.tag!("userLogin")
15
15
  end
16
16
  end
17
17
  response = request.execute!
18
-
18
+
19
19
  result = []
20
- log_entries = response.xpath('//logEntry')
21
- log_entries = [log_entries] unless log_entries.kind_of?(Array)
20
+ log_entries = response.xpath("//logEntry")
21
+ log_entries = [log_entries] unless log_entries.is_a?(Array)
22
22
  log_entries.each do |log_entry_node|
23
23
  dict = {}
24
24
  log_entry_node.each_element do |value_node|
25
- if value_node.name == 'logTime'
26
- dict[value_node.name] = value_node.elements['isoDateTime'].text.to_s
27
- else
28
- dict[value_node.name] = value_node.text.to_s
29
- end
25
+ dict[value_node.name] = if value_node.name == "logTime"
26
+ value_node.elements["isoDateTime"].text.to_s
27
+ else
28
+ value_node.text.to_s
29
+ end
30
30
  end
31
31
 
32
32
  result << dict
33
33
  end
34
34
 
35
- return result
35
+ result
36
36
  rescue Reactor::Cm::XmlRequestError => e
37
- if e.message =~ /#{Regexp.escape('[060001] Es wurde kein Eintrag gefunden.')}/
38
- return []
37
+ if /#{Regexp.escape('[060001] Es wurde kein Eintrag gefunden.')}/.match?(e.message)
38
+ []
39
39
  else
40
40
  raise e
41
41
  end
@@ -44,15 +44,16 @@ module Reactor
44
44
  def delete(conditions)
45
45
  request = XmlRequest.prepare do |xml|
46
46
  where_part(xml, conditions)
47
- xml.tag!('logEntry-delete')
47
+ xml.tag!("logEntry-delete")
48
48
  end
49
49
  response = request.execute!
50
- result = response.xpath('//deleteLogEntriesCount').map {|x| x.text.to_s }.first
50
+ response.xpath("//deleteLogEntriesCount").map { |x| x.text.to_s }.first
51
51
  end
52
52
 
53
53
  protected
54
+
54
55
  def where_part(xml, conditions)
55
- xml.tag!('logEntry-where') do
56
+ xml.tag!("logEntry-where") do
56
57
  conditions.each do |key, value|
57
58
  xml.tag!(key.to_s, value.to_s)
58
59
  end
@@ -1,8 +1,9 @@
1
- # -*- encoding : utf-8 -*-
2
1
  module Reactor
3
2
  module Cm
4
3
  class MissingCredentials < StandardError
5
- def initialize ; super("CM access credentials are missing. Check your configuration or supplied credentials.") ; end
4
+ def initialize
5
+ super("CM access credentials are missing. Check your configuration or supplied credentials.")
6
+ end
6
7
  end
7
8
  end
8
9
  end
@@ -1,13 +1,11 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'net/http'
3
- require 'reactor/cm/xml_response'
4
- require 'reactor/cm/xml_multi_request_error'
5
- require 'reactor/cm/xml_markup'
6
- require 'nokogiri'
1
+ require "net/http"
2
+ require "reactor/cm/xml_response"
3
+ require "reactor/cm/xml_multi_request_error"
4
+ require "reactor/cm/xml_markup"
5
+ require "nokogiri"
7
6
 
8
7
  module Reactor
9
8
  module Cm
10
-
11
9
  class MultiXmlRequest
12
10
  def self.timeout
13
11
  Reactor::Cm::XmlRequest.timeout
@@ -18,59 +16,56 @@ module Reactor
18
16
  end
19
17
 
20
18
  def self.execute
21
- access = Configuration::xml_access
19
+ access = Configuration.xml_access
22
20
  sanity_check(access)
23
21
  xml = XmlMarkup.new
24
- xml2 = nil
25
- ret = nil
26
22
  xml.instruct!
27
23
  req = nil
28
- ret = xml.tag!('cm-payload', 'payload-id' =>'abcabc', 'timestamp' => Time.now.getutc.strftime('%Y%m%d%H%M%S'), 'version' => '6.7.3') do
29
- xml.tag!('cm-header') do
30
- xml.tag!('cm-sender', 'sender-id' => access[:id], 'name' => "ruby-simple-client")
31
- xml.tag!('cm-authentication', 'login' => access[:username], 'token' => token(access[:username],access[:secret]))
24
+ ret = xml.tag!("cm-payload", "payload-id" => "abcabc", "timestamp" => Time.now.getutc.strftime("%Y%m%d%H%M%S"), "version" => "6.7.3") do
25
+ xml.tag!("cm-header") do
26
+ xml.tag!("cm-sender", "sender-id" => access[:id], "name" => "ruby-simple-client")
27
+ xml.tag!("cm-authentication", "login" => access[:username], "token" => token(access[:username], access[:secret]))
32
28
  end
33
- req = self.new(xml).tap do |instance|
29
+ req = new(xml).tap do |instance|
34
30
  yield instance
35
31
  end
36
32
  end
37
33
  req.execute!(ret)
38
34
  end
39
35
 
40
- def mandatory(&block)
36
+ def mandatory
41
37
  req_id = self.class.generate_id
42
38
  @mandatory << req_id
43
- @builder.tag!('cm-request', 'request-id' => req_id, 'preclusive' => 'true') do |xml2|
39
+ @builder.tag!("cm-request", "request-id" => req_id, "preclusive" => "true") do |xml2|
44
40
  yield xml2
45
41
  end
46
42
  end
47
43
 
48
- def optional(&block)
44
+ def optional
49
45
  req_id = self.class.generate_id
50
46
  @optional << req_id
51
- @builder.tag!('cm-request', 'request-id' => req_id, 'preclusive' => 'false') do |xml2|
47
+ @builder.tag!("cm-request", "request-id" => req_id, "preclusive" => "false") do |xml2|
52
48
  yield xml2
53
49
  end
54
50
  end
55
51
 
56
52
  def execute!(xml)
57
- access = Configuration::xml_access
53
+ access = Configuration.xml_access
58
54
  payload = xml
59
55
 
60
56
  res = Net::HTTP.new(access[:host], access[:port]).start do |http|
61
57
  http.read_timeout = self.class.timeout
62
- req = Net::HTTP::Post.new('/xml')
58
+ req = Net::HTTP::Post.new("/xml")
63
59
  req.body = payload
64
60
  http.request(req)
65
61
  end
66
62
 
67
- result = MultiXmlResponse.new(res.body, @mandatory, @optional)
63
+ MultiXmlResponse.new(res.body, @mandatory, @optional)
68
64
  end
69
65
 
70
66
  class << self
71
-
72
67
  def generate_id
73
- rand(10000)
68
+ rand(10_000)
74
69
  end
75
70
 
76
71
  protected
@@ -90,7 +85,9 @@ module Reactor
90
85
 
91
86
  class MultiXmlResponse
92
87
  def initialize(xml, mandatory, optional)
93
- @xml, @mandatory, @optional = xml, mandatory, optional
88
+ @xml = xml
89
+ @mandatory = mandatory
90
+ @optional = optional
94
91
  @n = Nokogiri::XML.parse(@xml)
95
92
  end
96
93