Class: Scim::Kit::V2::AttributeType
- Inherits:
-
Object
- Object
- Scim::Kit::V2::AttributeType
- Includes:
- Templatable
- Defined in:
- lib/scim/kit/v2/attribute_type.rb
Overview
Represents a scim Attribute type
Constant Summary collapse
- DATATYPES =
{ string: 'string', boolean: 'boolean', decimal: 'decimal', integer: 'integer', datetime: 'dateTime', binary: 'binary', reference: 'reference', complex: 'complex' }.freeze
Instance Attribute Summary collapse
-
#canonical_values ⇒ Object
Returns the value of attribute canonical_values.
-
#case_exact ⇒ Object
Returns the value of attribute case_exact.
-
#description ⇒ Object
Returns the value of attribute description.
-
#multi_valued ⇒ Object
Returns the value of attribute multi_valued.
-
#mutability ⇒ Object
Returns the value of attribute mutability.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#reference_types ⇒ Object
Returns the value of attribute reference_types.
-
#required ⇒ Object
Returns the value of attribute required.
-
#returned ⇒ Object
Returns the value of attribute returned.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#uniqueness ⇒ Object
Returns the value of attribute uniqueness.
Instance Method Summary collapse
- #add_attribute(name:, type: :string) {|attribute| ... } ⇒ Object
-
#initialize(name:, type: :string) ⇒ AttributeType
constructor
A new instance of AttributeType.
Methods included from Templatable
#as_json, #render, #to_h, #to_json
Constructor Details
#initialize(name:, type: :string) ⇒ AttributeType
Returns a new instance of AttributeType.
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/scim/kit/v2/attribute_type.rb', line 30 def initialize(name:, type: :string) @name = name @type = type @description = '' @multi_valued = false @required = false @case_exact = false @mutability = Mutability::READ_WRITE @returned = Returned::DEFAULT @uniqueness = Uniqueness::NONE raise ArgumentError, :type unless DATATYPES[type.to_sym] end |
Instance Attribute Details
#canonical_values ⇒ Object
Returns the value of attribute canonical_values.
19 20 21 |
# File 'lib/scim/kit/v2/attribute_type.rb', line 19 def canonical_values @canonical_values end |
#case_exact ⇒ Object
Returns the value of attribute case_exact.
20 21 22 |
# File 'lib/scim/kit/v2/attribute_type.rb', line 20 def case_exact @case_exact end |
#description ⇒ Object
Returns the value of attribute description.
21 22 23 |
# File 'lib/scim/kit/v2/attribute_type.rb', line 21 def description @description end |
#multi_valued ⇒ Object
Returns the value of attribute multi_valued.
22 23 24 |
# File 'lib/scim/kit/v2/attribute_type.rb', line 22 def multi_valued @multi_valued end |
#mutability ⇒ Object
Returns the value of attribute mutability.
24 25 26 |
# File 'lib/scim/kit/v2/attribute_type.rb', line 24 def mutability @mutability end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
25 26 27 |
# File 'lib/scim/kit/v2/attribute_type.rb', line 25 def name @name end |
#reference_types ⇒ Object
Returns the value of attribute reference_types.
26 27 28 |
# File 'lib/scim/kit/v2/attribute_type.rb', line 26 def reference_types @reference_types end |
#required ⇒ Object
Returns the value of attribute required.
23 24 25 |
# File 'lib/scim/kit/v2/attribute_type.rb', line 23 def required @required end |
#returned ⇒ Object
Returns the value of attribute returned.
27 28 29 |
# File 'lib/scim/kit/v2/attribute_type.rb', line 27 def returned @returned end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
25 26 27 |
# File 'lib/scim/kit/v2/attribute_type.rb', line 25 def type @type end |
#uniqueness ⇒ Object
Returns the value of attribute uniqueness.
28 29 30 |
# File 'lib/scim/kit/v2/attribute_type.rb', line 28 def uniqueness @uniqueness end |
Instance Method Details
#add_attribute(name:, type: :string) {|attribute| ... } ⇒ Object
55 56 57 58 59 60 |
# File 'lib/scim/kit/v2/attribute_type.rb', line 55 def add_attribute(name:, type: :string) @type = :complex attribute = AttributeType.new(name: name, type: type) yield attribute if block_given? attributes << attribute end |