Class: PureCloud::ScimV2SchemaAttribute
- Inherits:
-
Object
- Object
- PureCloud::ScimV2SchemaAttribute
- Defined in:
- lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb
Overview
A complex type that defines service provider attributes, or sub-attributes and their qualities.
Instance Attribute Summary collapse
-
#canonical_values ⇒ Object
A collection of suggested canonical values that MAY be used (e.g., "work" and "home").
-
#case_exact ⇒ Object
A Boolean value that specifies whether or not a string attribute is case sensitive.
-
#description ⇒ Object
The attribute’s human-readable description.
-
#multi_valued ⇒ Object
A Boolean value indicating the attribute’s plurality.
-
#mutability ⇒ Object
A single keyword indicating the circumstances under which the value of the attribute can be (re)defined.
-
#name ⇒ Object
The attribute’s name.
-
#reference_types ⇒ Object
A multi-valued array of JSON strings that indicate the SCIM resource types that may be referenced.
-
#required ⇒ Object
A Boolean value that specifies whether or not the attribute is required.
-
#returned ⇒ Object
A single keyword that indicates when an attribute and associated values are returned in response to a GET request, or in response to a PUT, POST, or PATCH request.
-
#sub_attributes ⇒ Object
When an attribute is of type "complex", "subAttributes" defines a set of sub-attributes.
-
#type ⇒ Object
The attribute’s data type.
-
#uniqueness ⇒ Object
A single keyword value that specifies how the service provider enforces uniqueness of attribute values.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #_deserialize(type, value) ⇒ Object
-
#_to_hash(value) ⇒ Object
Method to output non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
build the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ ScimV2SchemaAttribute
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Object
to_body is an alias to to_body (backward compatibility)).
-
#to_hash ⇒ Object
return the object in the form of hash.
- #to_s ⇒ Object
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ ScimV2SchemaAttribute
Initializes the object
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 122 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} if attributes.has_key?(:'name') self.name = attributes[:'name'] end if attributes.has_key?(:'type') self.type = attributes[:'type'] end if attributes.has_key?(:'subAttributes') if (value = attributes[:'subAttributes']).is_a?(Array) self.sub_attributes = value end end if attributes.has_key?(:'multiValued') self.multi_valued = attributes[:'multiValued'] end if attributes.has_key?(:'description') self.description = attributes[:'description'] end if attributes.has_key?(:'required') self.required = attributes[:'required'] end if attributes.has_key?(:'canonicalValues') if (value = attributes[:'canonicalValues']).is_a?(Array) self.canonical_values = value end end if attributes.has_key?(:'caseExact') self.case_exact = attributes[:'caseExact'] end if attributes.has_key?(:'mutability') self.mutability = attributes[:'mutability'] end if attributes.has_key?(:'returned') self.returned = attributes[:'returned'] end if attributes.has_key?(:'uniqueness') self.uniqueness = attributes[:'uniqueness'] end if attributes.has_key?(:'referenceTypes') if (value = attributes[:'referenceTypes']).is_a?(Array) self.reference_types = value end end end |
Instance Attribute Details
#canonical_values ⇒ Object
A collection of suggested canonical values that MAY be used (e.g., "work" and "home"). In some cases, service providers MAY choose to ignore unsupported values. OPTIONAL.
41 42 43 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 41 def canonical_values @canonical_values end |
#case_exact ⇒ Object
A Boolean value that specifies whether or not a string attribute is case sensitive. The server SHALL use case sensitivity when evaluating filters. For attributes that are case exact, the server SHALL preserve case for any value submitted. If the attribute is case insensitive, the server MAY alter case for a submitted value. Case sensitivity also impacts how attribute values MAY be compared against filter values (see Section 3.4.2.2 of [RFC7644])
44 45 46 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 44 def case_exact @case_exact end |
#description ⇒ Object
The attribute’s human-readable description.
35 36 37 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 35 def description @description end |
#multi_valued ⇒ Object
A Boolean value indicating the attribute’s plurality.
32 33 34 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 32 def multi_valued @multi_valued end |
#mutability ⇒ Object
A single keyword indicating the circumstances under which the value of the attribute can be (re)defined. Value are readOnly, readWrite, immutable, writeOnly
47 48 49 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 47 def mutability @mutability end |
#name ⇒ Object
The attribute’s name
23 24 25 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 23 def name @name end |
#reference_types ⇒ Object
A multi-valued array of JSON strings that indicate the SCIM resource types that may be referenced. Values include User, Group, external and uri.
56 57 58 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 56 def reference_types @reference_types end |
#required ⇒ Object
A Boolean value that specifies whether or not the attribute is required.
38 39 40 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 38 def required @required end |
#returned ⇒ Object
A single keyword that indicates when an attribute and associated values are returned in response to a GET request, or in response to a PUT, POST, or PATCH request. Valid keywords are as follows: always, never, default, request
50 51 52 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 50 def returned @returned end |
#sub_attributes ⇒ Object
When an attribute is of type "complex", "subAttributes" defines a set of sub-attributes. "subAttributes" has the same schema sub-attributes as "attributes"
29 30 31 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 29 def sub_attributes @sub_attributes end |
#type ⇒ Object
The attribute’s data type. Valid values are "string", "boolean", "decimal", "integer", "dateTime", "reference", and "complex".
26 27 28 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 26 def type @type end |
#uniqueness ⇒ Object
A single keyword value that specifies how the service provider enforces uniqueness of attribute values. A server MAY reject an invalid value based on uniqueness by returning HTTP response code 400 (Bad Request). A client MAY enforce uniqueness on the client side to a greater degree than the service provider enforces. For example, a client could make a value unique while the server has uniqueness of "none". Valid keywords are as follows: none, server, global
53 54 55 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 53 def uniqueness @uniqueness end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 59 def self.attribute_map { :'name' => :'name', :'type' => :'type', :'sub_attributes' => :'subAttributes', :'multi_valued' => :'multiValued', :'description' => :'description', :'required' => :'required', :'canonical_values' => :'canonicalValues', :'case_exact' => :'caseExact', :'mutability' => :'mutability', :'returned' => :'returned', :'uniqueness' => :'uniqueness', :'reference_types' => :'referenceTypes' } end |
.swagger_types ⇒ Object
Attribute type mapping.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 90 def self.swagger_types { :'name' => :'String', :'type' => :'String', :'sub_attributes' => :'Array<ScimV2SchemaAttribute>', :'multi_valued' => :'BOOLEAN', :'description' => :'String', :'required' => :'BOOLEAN', :'canonical_values' => :'Array<String>', :'case_exact' => :'BOOLEAN', :'mutability' => :'String', :'returned' => :'String', :'uniqueness' => :'String', :'reference_types' => :'Array<String>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 427 def ==(o) return true if self.equal?(o) self.class == o.class && name == o.name && type == o.type && sub_attributes == o.sub_attributes && multi_valued == o.multi_valued && description == o.description && required == o.required && canonical_values == o.canonical_values && case_exact == o.case_exact && mutability == o.mutability && returned == o.returned && uniqueness == o.uniqueness && reference_types == o.reference_types end |
#_deserialize(type, value) ⇒ Object
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 476 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /^(true|t|yes|y|1)$/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model _model = Object.const_get("PureCloud").const_get(type).new _model.build_from_hash(value) end end |
#_to_hash(value) ⇒ Object
Method to output non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
536 537 538 539 540 541 542 543 544 545 546 547 548 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 536 def _to_hash(value) if value.is_a?(Array) value.compact.map{ |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
build the object from hash
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 457 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) else #TODO show warning in debug mode end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) else # data not found in attributes(hash), not an issue as the data can be optional end end self end |
#eql?(o) ⇒ Boolean
446 447 448 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 446 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
452 453 454 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 452 def hash [name, type, sub_attributes, multi_valued, description, required, canonical_values, case_exact, mutability, returned, uniqueness, reference_types].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
247 248 249 250 251 252 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 247 def list_invalid_properties invalid_properties = Array.new return invalid_properties end |
#to_body ⇒ Object
to_body is an alias to to_body (backward compatibility))
519 520 521 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 519 def to_body to_hash end |
#to_hash ⇒ Object
return the object in the form of hash
524 525 526 527 528 529 530 531 532 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 524 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ Object
514 515 516 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 514 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb', line 256 def valid? allowed_values = ["STRING", "BOOLEAN", "DECIMAL", "INTEGER", "DATE_TIME", "REFERENCE", "COMPLEX"] if @type && !allowed_values.include?(@type) return false end allowed_values = ["readWrite", "readOnly", "immutable", "writeOnly"] if @mutability && !allowed_values.include?(@mutability) return false end allowed_values = ["ALWAYS", "NEVER", "DEFAULT", "REQUEST"] if @returned && !allowed_values.include?(@returned) return false end allowed_values = ["NONE", "SERVER", "GLOBAL"] if @uniqueness && !allowed_values.include?(@uniqueness) return false end end |