Class: Adobe::Aem::System

Inherits:
Object
  • Object
show all
Defined in:
lib/adobe/aem/system.rb

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ System

Returns a new instance of System.



6
7
8
# File 'lib/adobe/aem/system.rb', line 6

def initialize(context)
  @context = context
end

Instance Method Details

#get_bundle(name) ⇒ Object



28
29
30
31
32
# File 'lib/adobe/aem/system.rb', line 28

def get_bundle(name)
  @context.connector.get("/system/console/bundles/#{name}.json")
rescue Adobe::Aem::NotFound
  nil
end

#install_bundle(path) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/adobe/aem/system.rb', line 34

def install_bundle(path)
  options = {
    action: :install,
    bundleStartLevel: 20
  }

  raise "File: #{path} does not exist" unless File.exists?(path)
  options[:bundlefile] = UploadIO.new(path, 'application/java-archive')

  @context.connector.multipart_post('/system/console/bundles', options)
end

#refresh_bundle_imports(name) ⇒ Object



24
25
26
# File 'lib/adobe/aem/system.rb', line 24

def refresh_bundle_imports(name)
  @context.connector.post("/system/console/bundles/#{name}", action: 'refresh')
end

#start_bundle(name) ⇒ Object



20
21
22
# File 'lib/adobe/aem/system.rb', line 20

def start_bundle(name)
  @context.connector.post("/system/console/bundles/#{name}", action: 'start')
end

#stop_bundle(name) ⇒ Object



17
18
19
# File 'lib/adobe/aem/system.rb', line 17

def stop_bundle(name)
  @context.connector.post("/system/console/bundles/#{name}", action: 'stop')
end

#uninstall_bundle(name) ⇒ Object



14
15
16
# File 'lib/adobe/aem/system.rb', line 14

def uninstall_bundle(name)
  @context.connector.post("/system/console/bundles/#{name}", action: 'uninstall')
end

#update_configuration(name, options) ⇒ Object



10
11
12
# File 'lib/adobe/aem/system.rb', line 10

def update_configuration(name, options)
  @context.connector.post("/system/console/configMgr/#{name}", options)
end