Class: Samsara::Types::AttributeEntity
- Inherits:
-
Object
- Object
- Samsara::Types::AttributeEntity
- Defined in:
- lib/samsara_api/types/attribute_entity.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #entity_id ⇒ Long readonly
-
#external_ids ⇒ Object
readonly
given object.
- #name ⇒ String readonly
-
#number_values ⇒ Array<Float>
readonly
Number values that are associated with this attribute.
-
#string_values ⇒ Array<String>
readonly
String values that are associated with this attribute.
-
#values ⇒ Array<Samsara::Types::AttributeValueTiny>
readonly
Representation of values that includes ids.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(entity_id: OMIT, external_ids: OMIT, name: OMIT, number_values: OMIT, string_values: OMIT, values: OMIT, additional_properties: nil) ⇒ Samsara::Types::AttributeEntity constructor
- #to_json ⇒ String
Constructor Details
#initialize(entity_id: OMIT, external_ids: OMIT, name: OMIT, number_values: OMIT, string_values: OMIT, values: OMIT, additional_properties: nil) ⇒ Samsara::Types::AttributeEntity
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/samsara_api/types/attribute_entity.rb', line 40 def initialize(entity_id: OMIT, external_ids: OMIT, name: OMIT, number_values: OMIT, string_values: OMIT, values: OMIT, additional_properties: nil) @entity_id = entity_id if entity_id != OMIT @external_ids = external_ids if external_ids != OMIT @name = name if name != OMIT @number_values = number_values if number_values != OMIT @string_values = string_values if string_values != OMIT @values = values if values != OMIT @additional_properties = additional_properties @_field_set = { "entityId": entity_id, "externalIds": external_ids, "name": name, "numberValues": number_values, "stringValues": string_values, "values": values }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
24 25 26 |
# File 'lib/samsara_api/types/attribute_entity.rb', line 24 def additional_properties @additional_properties end |
#entity_id ⇒ Long (readonly)
11 12 13 |
# File 'lib/samsara_api/types/attribute_entity.rb', line 11 def entity_id @entity_id end |
#external_ids ⇒ Object (readonly)
given object.
14 15 16 |
# File 'lib/samsara_api/types/attribute_entity.rb', line 14 def external_ids @external_ids end |
#name ⇒ String (readonly)
16 17 18 |
# File 'lib/samsara_api/types/attribute_entity.rb', line 16 def name @name end |
#number_values ⇒ Array<Float> (readonly)
Returns Number values that are associated with this attribute.
18 19 20 |
# File 'lib/samsara_api/types/attribute_entity.rb', line 18 def number_values @number_values end |
#string_values ⇒ Array<String> (readonly)
Returns String values that are associated with this attribute.
20 21 22 |
# File 'lib/samsara_api/types/attribute_entity.rb', line 20 def string_values @string_values end |
#values ⇒ Array<Samsara::Types::AttributeValueTiny> (readonly)
Returns Representation of values that includes ids.
22 23 24 |
# File 'lib/samsara_api/types/attribute_entity.rb', line 22 def values @values end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::AttributeEntity
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/samsara_api/types/attribute_entity.rb', line 56 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) entity_id = parsed_json["entityId"] unless parsed_json["externalIds"].nil? external_ids = parsed_json["externalIds"].to_json external_ids = Samsara::Types::AttributeEntityExternalIds.from_json(json_object: external_ids) else external_ids = nil end name = parsed_json["name"] number_values = parsed_json["numberValues"] string_values = parsed_json["stringValues"] values = parsed_json["values"]&.map do | item | item = item.to_json Samsara::Types::AttributeValueTiny.from_json(json_object: item) end new( entity_id: entity_id, external_ids: external_ids, name: name, number_values: number_values, string_values: string_values, values: values, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
95 96 97 98 99 100 101 102 |
# File 'lib/samsara_api/types/attribute_entity.rb', line 95 def self.validate_raw(obj:) obj.entity_id&.is_a?(Long) != false || raise("Passed value for field obj.entity_id is not the expected type, validation failed.") obj.external_ids.nil? || Samsara::Types::AttributeEntityExternalIds.validate_raw(obj: obj.external_ids) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.number_values&.is_a?(Array) != false || raise("Passed value for field obj.number_values is not the expected type, validation failed.") obj.string_values&.is_a?(Array) != false || raise("Passed value for field obj.string_values is not the expected type, validation failed.") obj.values&.is_a?(Array) != false || raise("Passed value for field obj.values is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
86 87 88 |
# File 'lib/samsara_api/types/attribute_entity.rb', line 86 def to_json @_field_set&.to_json end |