ruby_aem 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: adee0fa39b5e6387a053f8fa861b051dba558004
4
- data.tar.gz: 42463a2fe8b518cbe59708f0c25e4e57236a37c3
3
+ metadata.gz: dfcbbc34c1b0c32618de4ed051e3200d0075d745
4
+ data.tar.gz: a781563d14864bcd3556fb09478e6552afb6dcca
5
5
  SHA512:
6
- metadata.gz: 67c39af0344376142ef51c4cdbb4102f2e9fd62ffbd4ec4f5df0cedefac9433f5ea2385baaa137a6748fd5913f1a8bc740e76c135151f45faf3fdb2a4eb6245a
7
- data.tar.gz: a29515290ace64711864512f2f1eea5b36aae998d175f7090296de4b4274e93e6022a95735da904611ab05cdf29320d2bc0975fd6832634a5dcf7e76bebe0fd9
6
+ metadata.gz: 40382b1e0af6ee9bd28e295eb5ca44a0d2789cad9dbdfcf7351d70971b46cd2f44a7cff445a6b39a8ba8eb8c112ec5a5c5d77fbb7e4adf425012a9f5d93965d4
7
+ data.tar.gz: 94aef808d85f0110e23b00c991b18024b0bb0d80930f958f05541591af4a7a72dd0efb44342038b56330641c256b8eb2e17fc49bdc6e573015e37ac00f748688
@@ -1,18 +1,16 @@
1
- =begin
2
- Copyright 2016 Shine Solutions
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- =end
1
+ # Copyright 2016-2017 Shine Solutions
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
16
14
 
17
15
  require 'ruby_aem/error'
18
16
  require 'ruby_aem/handlers/file'
@@ -28,7 +26,6 @@ module RubyAem
28
26
  # Client class makes Swagger AEM API calls and handles the response as
29
27
  # configured in conf/spec.yaml .
30
28
  class Client
31
-
32
29
  # Initialise a client.
33
30
  #
34
31
  # @param apis a hash of Swagger AEM client's API instances
@@ -50,7 +47,6 @@ module RubyAem
50
47
  # @param call_params API call parameters
51
48
  # @return RubyAem::Result
52
49
  def call(clazz, action, call_params)
53
-
54
50
  resource_name = clazz.name.downcase.sub('rubyaem::resources::', '')
55
51
  resource = @spec[resource_name]
56
52
  action_spec = resource['actions'][action]
@@ -126,13 +122,12 @@ module RubyAem
126
122
  if responses_spec.key?(response.status_code)
127
123
  response_spec = responses_spec[response.status_code]
128
124
  handler = response_spec['handler']
129
- result = Handlers.send(handler, response, response_spec, call_params)
125
+ Handlers.send(handler, response, response_spec, call_params)
130
126
  else
131
127
  message = "Unexpected response\nstatus code: #{response.status_code}\nheaders: #{response.headers}\nbody: #{response.body}"
132
128
  result = Result.new(message, response)
133
129
  raise RubyAem::Error.new(message, result)
134
130
  end
135
131
  end
136
-
137
132
  end
138
133
  end
@@ -1,21 +1,18 @@
1
- =begin
2
- Copyright 2016 Shine Solutions
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- =end
1
+ # Copyright 2016-2017 Shine Solutions
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
16
14
 
17
15
  module RubyAem
18
-
19
16
  class Error < StandardError
20
17
  attr_accessor :result
21
18
 
@@ -23,6 +20,5 @@ module RubyAem
23
20
  super(message)
24
21
  self.result = result
25
22
  end
26
-
27
23
  end
28
24
  end
@@ -1,23 +1,20 @@
1
- =begin
2
- Copyright 2016 Shine Solutions
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- =end
1
+ # Copyright 2016-2017 Shine Solutions
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
16
14
 
17
15
  module RubyAem
18
16
  # Response handlers for file payload.
19
17
  module Handlers
20
-
21
18
  # Handle downloaded file by copying from temporary location to file_path call param.
22
19
  # The downloaded file in temporary location will then be deleted.
23
20
  # data, status_code, and headers are all returned from RubyAem::Client call.
@@ -26,8 +23,7 @@ module RubyAem
26
23
  # @param response_spec response specification as configured in conf/spec.yaml
27
24
  # @param call_params API call parameters
28
25
  # @return RubyAem::Result
29
- def Handlers.file_download(response, response_spec, call_params)
30
-
26
+ def self.file_download(response, response_spec, call_params)
31
27
  FileUtils.cp(response.body.path, "#{call_params[:file_path]}/#{call_params[:package_name]}-#{call_params[:package_version]}.zip")
32
28
  response.body.delete
33
29
 
@@ -35,6 +31,5 @@ module RubyAem
35
31
 
36
32
  RubyAem::Result.new(message, response)
37
33
  end
38
-
39
34
  end
40
35
  end
@@ -1,25 +1,22 @@
1
- =begin
2
- Copyright 2016 Shine Solutions
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- =end
1
+ # Copyright 2016-2017 Shine Solutions
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
16
14
 
17
15
  require 'nokogiri'
18
16
 
19
17
  module RubyAem
20
18
  # Response handlers for HTML payload.
21
19
  module Handlers
22
-
23
20
  # Parse authorizable ID from response body data.
24
21
  # This is used to get the authorizable ID of a newly created user/group.
25
22
  #
@@ -27,12 +24,11 @@ module RubyAem
27
24
  # @param response_spec response specification as configured in conf/spec.yaml
28
25
  # @param call_params API call parameters
29
26
  # @return RubyAem::Result
30
- def Handlers.html_authorizable_id(response, response_spec, call_params)
31
-
27
+ def self.html_authorizable_id(response, response_spec, call_params)
32
28
  html = Nokogiri::HTML(response.body)
33
29
  authorizable_id = html.xpath('//title/text()').to_s
34
30
  authorizable_id.slice! "Content created #{call_params[:path]}"
35
- call_params[:authorizable_id] = authorizable_id.sub(/^\//, '')
31
+ call_params[:authorizable_id] = authorizable_id.sub(%r{^/}, '')
36
32
 
37
33
  message = response_spec['message'] % call_params
38
34
 
@@ -48,8 +44,7 @@ module RubyAem
48
44
  # @param response_spec response specification as configured in conf/spec.yaml
49
45
  # @param call_params API call parameters
50
46
  # @return RubyAem::Result
51
- def Handlers.html_package_service_allow_error(response, response_spec, call_params)
52
-
47
+ def self.html_package_service_allow_error(response, response_spec, call_params)
53
48
  html = Nokogiri::HTML(response.body)
54
49
  title = html.xpath('//title/text()').to_s
55
50
  desc = html.xpath('//p/text()').to_s
@@ -70,8 +65,7 @@ module RubyAem
70
65
  # @param response_spec response specification as configured in conf/spec.yaml
71
66
  # @param call_params API call parameters
72
67
  # @return RubyAem::Result
73
- def Handlers.html_change_password(response, response_spec, call_params)
74
-
68
+ def self.html_change_password(response, response_spec, call_params)
75
69
  html = Nokogiri::HTML(response.body)
76
70
  user = html.xpath('//body/div/table/tr/td/b/text()').to_s
77
71
  desc = html.xpath('//body/div/table/tr/td/font/text()').to_s
@@ -86,6 +80,5 @@ module RubyAem
86
80
  raise RubyAem::Error.new(message, result)
87
81
  end
88
82
  end
89
-
90
83
  end
91
84
  end
@@ -1,18 +1,16 @@
1
- =begin
2
- Copyright 2016 Shine Solutions
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- =end
1
+ # Copyright 2016-2017 Shine Solutions
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
16
14
 
17
15
  require 'json'
18
16
  require 'ruby_aem/error'
@@ -20,15 +18,13 @@ require 'ruby_aem/error'
20
18
  module RubyAem
21
19
  # Response handlers for JSON payload.
22
20
  module Handlers
23
-
24
21
  # Handle JSON response payload containing authorizable ID.
25
22
  #
26
23
  # @param response HTTP response containing status_code, body, and headers
27
24
  # @param response_spec response specification as configured in conf/spec.yaml
28
25
  # @param call_params API call parameters
29
26
  # @return RubyAem::Result
30
- def Handlers.json_authorizable_id(response, response_spec, call_params)
31
-
27
+ def self.json_authorizable_id(response, response_spec, call_params)
32
28
  json = JSON.parse(response.body)
33
29
  authorizable_id = nil
34
30
  if json['success'] == true && json['hits'].length == 1
@@ -50,8 +46,7 @@ module RubyAem
50
46
  # @param response_spec response specification as configured in conf/spec.yaml
51
47
  # @param call_params additional call_params information
52
48
  # @return RubyAem::Result
53
- def Handlers.json_package_service(response, response_spec, call_params)
54
-
49
+ def self.json_package_service(response, response_spec, call_params)
55
50
  json = JSON.parse(response.body)
56
51
 
57
52
  message = json['msg']
@@ -70,15 +65,12 @@ module RubyAem
70
65
  # @param response_spec response specification as configured in conf/spec.yaml
71
66
  # @param call_params additional call_params information
72
67
  # @return RubyAem::Result
73
- def Handlers.json_package_filter(response, response_spec, call_params)
74
-
68
+ def self.json_package_filter(response, response_spec, call_params)
75
69
  json = JSON.parse(response.body)
76
70
 
77
71
  filter = []
78
72
  json.each do |key, value|
79
- if json[key]['root'] != nil
80
- filter.push(json[key]['root'])
81
- end
73
+ filter.push(json[key]['root']) unless json[key]['root'].nil?
82
74
  end
83
75
 
84
76
  message = response_spec['message'] % call_params
@@ -86,7 +78,6 @@ module RubyAem
86
78
  result = RubyAem::Result.new(message, response)
87
79
  result.data = filter
88
80
  result
89
-
90
81
  end
91
82
 
92
83
  # Handle AEM Health Check Servlet JSON payload.
@@ -95,8 +86,7 @@ module RubyAem
95
86
  # @param response_spec response specification as configured in conf/spec.yaml
96
87
  # @param call_params additional call_params information
97
88
  # @return RubyAem::Result
98
- def Handlers.json_aem_health_check(response, response_spec, call_params)
99
-
89
+ def self.json_aem_health_check(response, response_spec, call_params)
100
90
  json = JSON.parse(response.body)
101
91
 
102
92
  message = response_spec['message'] % call_params
@@ -104,7 +94,6 @@ module RubyAem
104
94
  result = RubyAem::Result.new(message, response)
105
95
  result.data = json['results']
106
96
  result
107
-
108
97
  end
109
98
 
110
99
  # Extract a list of agent names from getAgents JSON payload.
@@ -113,8 +102,7 @@ module RubyAem
113
102
  # @param response_spec response specification as configured in conf/spec.yaml
114
103
  # @param call_params additional call_params information
115
104
  # @return RubyAem::Result
116
- def Handlers.json_agents(response, response_spec, call_params)
117
-
105
+ def self.json_agents(response, response_spec, call_params)
118
106
  json = JSON.parse(response.body)
119
107
 
120
108
  agent_names = []
@@ -129,8 +117,6 @@ module RubyAem
129
117
  result = RubyAem::Result.new(message, response)
130
118
  result.data = agent_names
131
119
  result
132
-
133
120
  end
134
-
135
121
  end
136
122
  end
@@ -1,18 +1,16 @@
1
- =begin
2
- Copyright 2016 Shine Solutions
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- =end
1
+ # Copyright 2016-2017 Shine Solutions
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
16
14
 
17
15
  require 'ruby_aem/error'
18
16
  require 'ruby_aem/result'
@@ -20,7 +18,6 @@ require 'ruby_aem/result'
20
18
  module RubyAem
21
19
  # Response handlers for no payload.
22
20
  module Handlers
23
-
24
21
  # Simple handler by returning result that contains status and message as
25
22
  # configured in conf/spec.yaml AS-IS.
26
23
  #
@@ -28,7 +25,7 @@ module RubyAem
28
25
  # @param response_spec response specification as configured in conf/spec.yaml
29
26
  # @param call_params API call parameters
30
27
  # @return RubyAem::Result
31
- def Handlers.simple(response, response_spec, call_params)
28
+ def self.simple(response, response_spec, call_params)
32
29
  message = response_spec['message'] % call_params
33
30
  RubyAem::Result.new(message, response)
34
31
  end
@@ -39,7 +36,7 @@ module RubyAem
39
36
  # @param response_spec response specification as configured in conf/spec.yaml
40
37
  # @param call_params API call parameters
41
38
  # @return RubyAem::Result
42
- def Handlers.simple_true(response, response_spec, call_params)
39
+ def self.simple_true(response, response_spec, call_params)
43
40
  result = Handlers.simple(response, response_spec, call_params)
44
41
  result.data = true
45
42
  result
@@ -51,7 +48,7 @@ module RubyAem
51
48
  # @param response_spec response specification as configured in conf/spec.yaml
52
49
  # @param call_params API call parameters
53
50
  # @return RubyAem::Result
54
- def Handlers.simple_false(response, response_spec, call_params)
51
+ def self.simple_false(response, response_spec, call_params)
55
52
  result = Handlers.simple(response, response_spec, call_params)
56
53
  result.data = false
57
54
  result
@@ -63,7 +60,7 @@ module RubyAem
63
60
  # @param response_spec response specification as configured in conf/spec.yaml
64
61
  # @param call_params API call parameters
65
62
  # @return RubyAem::Result
66
- def Handlers.simple_nil(response, response_spec, call_params)
63
+ def self.simple_nil(response, response_spec, call_params)
67
64
  result = Handlers.simple(response, response_spec, call_params)
68
65
  result.data = nil
69
66
  result
@@ -75,10 +72,9 @@ module RubyAem
75
72
  # @param response_spec response specification as configured in conf/spec.yaml
76
73
  # @param call_params API call parameters
77
74
  # @return RubyAem::Result
78
- def Handlers.simple_error(response, response_spec, call_params)
75
+ def self.simple_error(response, response_spec, call_params)
79
76
  result = Handlers.simple(response, response_spec, call_params)
80
77
  raise RubyAem::Error.new(result.message, result)
81
78
  end
82
-
83
79
  end
84
80
  end
@@ -1,33 +1,29 @@
1
- =begin
2
- Copyright 2016 Shine Solutions
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- =end
1
+ # Copyright 2016-2017 Shine Solutions
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
16
14
 
17
15
  require 'nokogiri'
18
16
 
19
17
  module RubyAem
20
18
  # Response handlers for XML payload.
21
19
  module Handlers
22
-
23
20
  # Handle package list XML by removing non-packages data.
24
21
  #
25
22
  # @param response HTTP response containing status_code, body, and headers
26
23
  # @param response_spec response specification as configured in conf/spec.yaml
27
24
  # @param call_params API call parameters
28
25
  # @return RubyAem::Result
29
- def Handlers.xml_package_list(response, response_spec, call_params)
30
-
26
+ def self.xml_package_list(response, response_spec, call_params)
31
27
  xml = Nokogiri::XML(response.body)
32
28
 
33
29
  status_code = xml.xpath('//crx/response/status/@code').to_s
@@ -43,6 +39,5 @@ module RubyAem
43
39
 
44
40
  result
45
41
  end
46
-
47
42
  end
48
43
  end
@@ -1,18 +1,16 @@
1
- =begin
2
- Copyright 2016 Shine Solutions
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- =end
1
+ # Copyright 2016-2017 Shine Solutions
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
16
14
 
17
15
  require 'retries'
18
16
  require 'ruby_aem/error'
@@ -21,7 +19,6 @@ module RubyAem
21
19
  module Resources
22
20
  # AEM class contains API calls related to managing the AEM instance itself.
23
21
  class Aem
24
-
25
22
  # Initialise an AEM instance.
26
23
  #
27
24
  # @param client RubyAem::Client
@@ -35,7 +32,7 @@ module RubyAem
35
32
  # Retrieve AEM login page.
36
33
  #
37
34
  # @return RubyAem::Result
38
- def get_login_page()
35
+ def get_login_page
39
36
  @client.call(self.class, __callee__.to_s, @call_params)
40
37
  end
41
38
 
@@ -48,7 +45,6 @@ module RubyAem
48
45
  # @param combine_tags_or
49
46
  # @return RubyAem::Result
50
47
  def get_aem_health_check(opts = {})
51
-
52
48
  @call_params = @call_params.merge(opts)
53
49
  @client.call(self.class, __callee__.to_s, @call_params)
54
50
  end
@@ -77,17 +73,17 @@ module RubyAem
77
73
  opts[:_retries][:max_sleep_seconds] = opts[:_retries][:max_sleep_seconds].to_i
78
74
 
79
75
  result = nil
80
- with_retries(:max_tries => opts[:_retries][:max_tries], :base_sleep_seconds => opts[:_retries][:base_sleep_seconds], :max_sleep_seconds => opts[:_retries][:max_sleep_seconds]) { |retries_count|
76
+ with_retries(max_tries: opts[:_retries][:max_tries], base_sleep_seconds: opts[:_retries][:base_sleep_seconds], max_sleep_seconds: opts[:_retries][:max_sleep_seconds]) { |retries_count|
81
77
  begin
82
- result = get_login_page()
78
+ result = get_login_page
83
79
  if result.response.body !~ /QUICKSTART_HOMEPAGE/
84
- puts 'Retrieve login page attempt #%d: %s but not ready yet' % [retries_count, result.message]
80
+ puts format('Retrieve login page attempt #%d: %s but not ready yet', retries_count, result.message)
85
81
  raise StandardError.new(result.message)
86
82
  else
87
- puts 'Retrieve login page attempt #%d: %s and ready' % [retries_count, result.message]
83
+ puts format('Retrieve login page attempt #%d: %s and ready', retries_count, result.message)
88
84
  end
89
85
  rescue RubyAem::Error => err
90
- puts 'Retrieve login page attempt #%d: %s' % [retries_count, err.message]
86
+ puts format('Retrieve login page attempt #%d: %s', retries_count, err.message)
91
87
  raise StandardError.new(err.message)
92
88
  end
93
89
  }
@@ -118,10 +114,10 @@ module RubyAem
118
114
  opts[:_retries][:max_sleep_seconds] = opts[:_retries][:max_sleep_seconds].to_i
119
115
 
120
116
  result = nil
121
- with_retries(:max_tries => opts[:_retries][:max_tries], :base_sleep_seconds => opts[:_retries][:base_sleep_seconds], :max_sleep_seconds => opts[:_retries][:max_sleep_seconds]) { |retries_count|
117
+ with_retries(max_tries: opts[:_retries][:max_tries], base_sleep_seconds: opts[:_retries][:base_sleep_seconds], max_sleep_seconds: opts[:_retries][:max_sleep_seconds]) { |retries_count|
122
118
  begin
123
- result = get_aem_health_check({ :tags => opts[:tags], :combine_tags_or => opts[:combine_tags_or] })
124
- is_ok = true;
119
+ result = get_aem_health_check(tags: opts[:tags], combine_tags_or: opts[:combine_tags_or])
120
+ is_ok = true
125
121
  result.data.each { |check|
126
122
  if check['status'] != 'OK'
127
123
  is_ok = false
@@ -129,13 +125,13 @@ module RubyAem
129
125
  end
130
126
  }
131
127
  if is_ok == false
132
- puts 'Retrieve AEM Health Check attempt #%d: %s but not ok yet' % [retries_count, result.message]
128
+ puts format('Retrieve AEM Health Check attempt #%d: %s but not ok yet', retries_count, result.message)
133
129
  raise StandardError.new(result.message)
134
130
  else
135
- puts 'Retrieve AEM Health Check attempt #%d: %s and ok' % [retries_count, result.message]
131
+ puts format('Retrieve AEM Health Check attempt #%d: %s and ok', retries_count, result.message)
136
132
  end
137
133
  rescue RubyAem::Error => err
138
- puts 'Retrieve AEM Health Check attempt #%d: %s' % [retries_count, err.message]
134
+ puts format('Retrieve AEM Health Check attempt #%d: %s', retries_count, err.message)
139
135
  raise StandardError.new(err.message)
140
136
  end
141
137
  }
@@ -150,7 +146,6 @@ module RubyAem
150
146
  @call_params[:run_mode] = run_mode
151
147
  @client.call(self.class, __callee__.to_s, @call_params)
152
148
  end
153
-
154
149
  end
155
150
  end
156
151
  end