Module: Springcm::Mixins::Attributes

Included in:
Document, Folder
Defined in:
lib/springcm-sdk/mixins/attributes.rb

Overview

Mixin for objects that have attributes.

Instance Method Summary collapse

Instance Method Details

#apply_attribute_group(group_name) ⇒ Object

Apply a skeleton attribute group to the Document object. Calling #patch or #put before actually applying any data will have no effect on the document within SpringCM.



28
29
30
31
32
33
# File 'lib/springcm-sdk/mixins/attributes.rb', line 28

def apply_attribute_group(group_name)
  return if !attribute_group(group_name).nil?
  group_config = @client..attribute_group(name: group_name)
  @data["AttributeGroups"] ||= {}
  @data["AttributeGroups"].merge!({ "#{group_name}" => group_config.template })
end

#attribute_group(group_name) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/springcm-sdk/mixins/attributes.rb', line 15

def attribute_group(group_name)
  groups = @data["AttributeGroups"] || get.attribute_groups || {}
  group_data = groups[group_name]
  if group_data.nil?
    nil
  else
    AppliedAttributeGroup.new(group_data, group_name, self, @client)
  end
end

#attribute_groups=(value) ⇒ Object



11
12
13
# File 'lib/springcm-sdk/mixins/attributes.rb', line 11

def attribute_groups=(value)
  @data["AttributeGroups"] = value
end