Class: RubyAem::Resources::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_aem/resources/node.rb

Overview

Node class contains API calls related to managing an AEM node.

Instance Method Summary collapse

Constructor Details

#initialize(client, path, name) ⇒ Object

Initialise a node.

Parameters:

  • client

    RubyAem::Client

  • path

    the path to the node, e.g. /apps/system/

  • name

    the node name, e.g. somenode



28
29
30
31
32
33
34
35
36
# File 'lib/ruby_aem/resources/node.rb', line 28

def initialize(client, path, name)
  @client = client
  @call_params = {
    path: path,
    name: name
  }

  @call_params[:path] = RubyAem::Swagger.path(@call_params[:path])
end

Instance Method Details

#create(type) ⇒ Object

Create a new node.

Parameters:

  • type

    the node type, e.g. sling:Folder

Returns:

  • RubyAem::Result



42
43
44
45
# File 'lib/ruby_aem/resources/node.rb', line 42

def create(type)
  @call_params[:type] = type
  @client.call(self.class, __callee__.to_s, @call_params)
end

#deleteObject

Delete the node.

Returns:

  • RubyAem::Result



50
51
52
# File 'lib/ruby_aem/resources/node.rb', line 50

def delete()
  @client.call(self.class, __callee__.to_s, @call_params)
end

#existsObject

Check whether the node exists or not. If the node exists, this method returns a true result data, false otherwise.

Returns:

  • RubyAem::Result



59
60
61
# File 'lib/ruby_aem/resources/node.rb', line 59

def exists()
  @client.call(self.class, __callee__.to_s, @call_params)
end