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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9af6c6e5944dba21c3a02679fed84c94f6479593
4
- data.tar.gz: d328c58d6060bce53d1a3287e0c4678bdbb19efa
3
+ metadata.gz: c6f5c91532e3402b93b0447b2448462e0191ec91
4
+ data.tar.gz: bc97a5ca7bbc0210165f8cee08d2c72e4972e5df
5
5
  SHA512:
6
- metadata.gz: 5fea19ab39c42c2bf88a0e5ebf52641f63672ce52204f824200df419f7b54ffe193cf8fdf2bf927d158ea272a804f371ee32d82d4cf5bd59be4c09898057b921
7
- data.tar.gz: cc95a848a862ec798ad7cdf20630641ae7e567c16a51e899f6f540643350938813c3d28eff62432793d8c50fe0f74cdb18ff8cc65be1f3112e9454007aad38a9
6
+ metadata.gz: e932e233baad5358e32f2a87b1708e24d2f8e998c4b7b001e498219a54fbd43a4454fb30f5407a53174d47681d46a0f8d8a4d11df5605efd68de54700223dd0f
7
+ data.tar.gz: 070dbcbedfff2be3e2dd4f58b800ae16e3c092e15fddf9d1e81f728d1505b02aecedcc0f72c3c763bcb29116e2818cab61f829e9fab644aa00df8ed56b422705
@@ -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
 
@@ -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,
@@ -1,5 +1,5 @@
1
1
  module Adobe
2
2
  module Aem
3
- VERSION = '0.0.6'
3
+ VERSION = '0.0.7'
4
4
  end
5
5
  end
@@ -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")
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adobe-aem-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stanislaw Wozniak