adobe-aem-api 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/adobe/aem/connector.rb +4 -0
- data/lib/adobe/aem/system.rb +6 -0
- data/lib/adobe/aem/version.rb +1 -1
- data/spec/api_spec.rb +20 -0
- data/spec/helpers/mock_aem.rb +8 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6f5c91532e3402b93b0447b2448462e0191ec91
|
4
|
+
data.tar.gz: bc97a5ca7bbc0210165f8cee08d2c72e4972e5df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e932e233baad5358e32f2a87b1708e24d2f8e998c4b7b001e498219a54fbd43a4454fb30f5407a53174d47681d46a0f8d8a4d11df5605efd68de54700223dd0f
|
7
|
+
data.tar.gz: 070dbcbedfff2be3e2dd4f58b800ae16e3c092e15fddf9d1e81f728d1505b02aecedcc0f72c3c763bcb29116e2818cab61f829e9fab644aa00df8ed56b422705
|
data/lib/adobe/aem/connector.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
module Adobe
|
2
2
|
module Aem
|
3
|
+
|
4
|
+
class NotFound < StandardError; end
|
5
|
+
|
3
6
|
class Connector
|
4
7
|
def initialize(context)
|
5
8
|
@context = context
|
@@ -109,6 +112,7 @@ module Adobe
|
|
109
112
|
end
|
110
113
|
|
111
114
|
def verify(response)
|
115
|
+
raise Adobe::Aem::NotFound if response.is_a?(Net::HTTPNotFound)
|
112
116
|
raise StandardError.new(response.class.to_s) unless
|
113
117
|
[Net::HTTPOK, Net::HTTPCreated, Net::HTTPFound].include?(response.class)
|
114
118
|
|
data/lib/adobe/aem/system.rb
CHANGED
@@ -25,6 +25,12 @@ module Adobe
|
|
25
25
|
@context.connector.post("/system/console/bundles/#{name}", action: 'refresh')
|
26
26
|
end
|
27
27
|
|
28
|
+
def get_bundle(name)
|
29
|
+
@context.connector.get("/system/console/bundles/#{name}")
|
30
|
+
rescue Adobe::Aem::NotFound
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
|
28
34
|
def install_bundle(path)
|
29
35
|
options = {
|
30
36
|
action: :install,
|
data/lib/adobe/aem/version.rb
CHANGED
data/spec/api_spec.rb
CHANGED
@@ -62,6 +62,26 @@ module Adobe
|
|
62
62
|
expect(JSON.parse(b)["action"]).to eq("uninstall")
|
63
63
|
end
|
64
64
|
|
65
|
+
it "should stop a bundle" do
|
66
|
+
b = subject.stop_bundle("uk.sponte.bundle").body
|
67
|
+
expect(JSON.parse(b)["action"]).to eq("stop")
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should start a bundle" do
|
71
|
+
b = subject.start_bundle("uk.sponte.bundle").body
|
72
|
+
expect(JSON.parse(b)["action"]).to eq("start")
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should get a bundle" do
|
76
|
+
b = subject.get_bundle("uk.sponte.bundle")
|
77
|
+
expect(b).to_not be_nil
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should get nil for non existent bundle" do
|
81
|
+
b = subject.get_bundle("uk.sponte.bundle.err")
|
82
|
+
expect(b).to be_nil
|
83
|
+
end
|
84
|
+
|
65
85
|
it "should refresh_package_imports" do
|
66
86
|
b = subject.refresh_bundle_imports("uk.sponte.bundle").body
|
67
87
|
expect(JSON.parse(b)["action"]).to eq("refresh")
|
data/spec/helpers/mock_aem.rb
CHANGED
@@ -12,6 +12,14 @@ class MockAem < Sinatra::Application
|
|
12
12
|
'<html><div id=Location href=/etc/replication/agents.author/stan /></html>'
|
13
13
|
end
|
14
14
|
|
15
|
+
get '/system/console/bundles/:id' do
|
16
|
+
if params[:id] == 'uk.sponte.bundle'
|
17
|
+
return "{}"
|
18
|
+
end
|
19
|
+
|
20
|
+
return 404
|
21
|
+
end
|
22
|
+
|
15
23
|
post '/system/console/bundles/?:id?' do
|
16
24
|
params.to_json
|
17
25
|
end
|