Class: Conjur::DSL2::Executor::Update

Inherits:
Base show all
Includes:
Annotate
Defined in:
lib/conjur/dsl2/executor/update.rb

Instance Attribute Summary

Attributes inherited from Base

#actions, #statement

Instance Method Summary collapse

Methods included from Annotate

#annotate, #update_annotation_path

Methods inherited from Base

#action, #initialize, #resource_path, #role_path

Methods included from Logger

included

Constructor Details

This class inherits a constructor from Conjur::DSL2::Executor::Base

Instance Method Details

#annotate_recordObject



27
28
29
# File 'lib/conjur/dsl2/executor/update.rb', line 27

def annotate_record
  statement.record
end

#executeObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/conjur/dsl2/executor/update.rb', line 5

def execute
  statement.record.custom_attribute_names.each do |attr|
    value = statement.record.send(attr)
    action({ 
      'method' => 'put',
      'path' => update_path,
      'parameters' => { attr.to_s => value }
    })
  end
  
  annotate
end

#kind_pathObject



18
19
20
# File 'lib/conjur/dsl2/executor/update.rb', line 18

def kind_path
  statement.record.resource_kind.pluralize
end

#update_pathObject



22
23
24
25
# File 'lib/conjur/dsl2/executor/update.rb', line 22

def update_path
  require 'cgi'
  [ kind_path, CGI.escape(statement.record.id) ].join('/')
end