class Springcm::AppliedAttributeSet

Attributes

group[R]
name[R]
subject[R]

Public Class Methods

new(data, set_name, subject, group, client) click to toggle source
Calls superclass method
# File lib/springcm-sdk/applied_attribute_set.rb, line 11
def initialize(data, set_name, subject, group, client)
  @subject = subject
  @group = group
  @name = set_name
  super(data, client)
end

Public Instance Methods

[](*args) click to toggle source
# File lib/springcm-sdk/applied_attribute_set.rb, line 30
def [](*args)
  if repeating_attribute == true
    item = @data["Items"].send(:[], *args)
    AppliedAttributeSetItem.new(item, subject, group, self, @client)
  else
    raise NonRepeatableAttributeSetUsageError.new(group.name, name)
  end
end
[]=(key, data) click to toggle source
# File lib/springcm-sdk/applied_attribute_set.rb, line 39
def []=(key, data)
  if repeating_attribute == true
    raise NonRepeatableAttributeSetUsageError.new(group.name, name)
  end
  group_config = @client.account.attribute_group(name: group.name)
  set = group_config.set(name)
  item = @data["Items"][key]
  item.clear
  data.each { |key, value|
    field_config = group_config.field(key)
    item[key] = Helpers.serialize_field(field_config, value)
  }
  item
end
field(field_name) click to toggle source
# File lib/springcm-sdk/applied_attribute_set.rb, line 18
def field(field_name)
  # Validate name not one of the restricted attribute names:
  # RepeatingAttribute, AttributeType
  field_data = raw[field_name]
  # puts field_data
  if repeating_attribute == true
    raise RepeatableAttributeSetUsageError.new(group.name, name)
  else
    AppliedAttributeField.new(field_data, field_name, subject, group, self, @client)
  end
end