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



25
26
27
28
29
30
31
32
33
# File 'lib/ruby_aem/resources/node.rb', line 25

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



39
40
41
42
# File 'lib/ruby_aem/resources/node.rb', line 39

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

#deleteObject

Delete the node.

Returns:

  • RubyAem::Result



47
48
49
# File 'lib/ruby_aem/resources/node.rb', line 47

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



56
57
58
# File 'lib/ruby_aem/resources/node.rb', line 56

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