Class: Springcm::AppliedAttributeField

Inherits:
Object
  • Object
show all
Defined in:
lib/springcm-sdk/applied_attribute_field.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Object

#method_missing, #raw

Constructor Details

#initialize(data, field_name, subject, group, set, client) ⇒ AppliedAttributeField

Returns a new instance of AppliedAttributeField.



10
11
12
13
14
15
16
# File 'lib/springcm-sdk/applied_attribute_field.rb', line 10

def initialize(data, field_name, subject, group, set, client)
  @subject = subject
  @group = group
  @set = set
  @name = field_name
  super(data, client)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Springcm::Object

Instance Attribute Details

#groupObject (readonly)

Returns the value of attribute group.



6
7
8
# File 'lib/springcm-sdk/applied_attribute_field.rb', line 6

def group
  @group
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/springcm-sdk/applied_attribute_field.rb', line 8

def name
  @name
end

#setObject (readonly)

Returns the value of attribute set.



7
8
9
# File 'lib/springcm-sdk/applied_attribute_field.rb', line 7

def set
  @set
end

#subjectObject (readonly)

Returns the value of attribute subject.



5
6
7
# File 'lib/springcm-sdk/applied_attribute_field.rb', line 5

def subject
  @subject
end

Instance Method Details

#[](*args) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/springcm-sdk/applied_attribute_field.rb', line 34

def [](*args)
  if repeating_attribute == true
    Helpers.deserialize_value(@data["AttributeType"], @data["Value"].send(:[], *args))
  else
    raise NonRepeatableAttributeFieldUsageError.new(group.name, name)
  end
end

#[]=(key, val) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/springcm-sdk/applied_attribute_field.rb', line 42

def []=(key, val)
  if repeating_attribute == true
    @data["Value"].send(:[]=, key, val)
  else
    raise NonRepeatableAttributeFieldUsageError.new(group.name, name)
  end
end

#valueObject



18
19
20
21
22
23
24
# File 'lib/springcm-sdk/applied_attribute_field.rb', line 18

def value
  if repeating_attribute == true
    raise RepeatableAttributeFieldUsageError.new(group.name, name)
  else
    Helpers.deserialize_field(raw)
  end
end

#value=(val) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/springcm-sdk/applied_attribute_field.rb', line 26

def value=(val)
  if repeating_attribute == true
    raise RepeatableAttributeFieldUsageError.new(group.name, name)
  else
    @data["Value"] = Helpers.serialize_value(@data["AttributeType"], val)
  end
end