Module: Conjur::HasAttributes

Included in:
Deputy, Resource
Defined in:
lib/conjur/has_attributes.rb

Instance Method Summary collapse

Instance Method Details

#attributesObject



28
29
30
31
# File 'lib/conjur/has_attributes.rb', line 28

def attributes
  return @attributes if @attributes
  fetch
end

#attributes=(a) ⇒ Object



27
# File 'lib/conjur/has_attributes.rb', line 27

def attributes=(a); @attributes = a; end

#invalidate(&block) ⇒ Object



43
44
45
46
47
# File 'lib/conjur/has_attributes.rb', line 43

def invalidate(&block)
  yield
ensure
  @attributes = nil
end

#refreshObject

Reload the attributes. This action can be used to guarantee a current view of the entity in the case that it has been modified by an update method or by an external party.



39
40
41
# File 'lib/conjur/has_attributes.rb', line 39

def refresh
  fetch
end

#saveObject



33
34
35
# File 'lib/conjur/has_attributes.rb', line 33

def save
  self.put(attributes.to_json)
end

#to_json(options = {}) ⇒ Object



23
24
25
# File 'lib/conjur/has_attributes.rb', line 23

def to_json(options = {})
  attributes
end