Class: Samsara::Types::CreateAttributeRequestEntities

Inherits:
Object
  • Object
show all
Defined in:
lib/samsara_api/types/create_attribute_request_entities.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entity_id: OMIT, external_ids: OMIT, number_values: OMIT, string_values: OMIT, additional_properties: nil) ⇒ Samsara::Types::CreateAttributeRequestEntities

Parameters:

  • number_values (Array<Float>) (defaults to: OMIT) —

    Number values that can be associated with this attribute

  • string_values (Array<String>) (defaults to: OMIT) —

    String values that can be associated with this attribute

  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



32
33
34
35
36
37
38
39
40
41
# File 'lib/samsara_api/types/create_attribute_request_entities.rb', line 32

def initialize(entity_id: OMIT, external_ids: OMIT, number_values: OMIT, string_values: OMIT, additional_properties: nil)
  @entity_id = entity_id if entity_id != OMIT
  @external_ids = external_ids if external_ids != OMIT
  @number_values = number_values if number_values != OMIT
  @string_values = string_values if string_values != OMIT
  @additional_properties = additional_properties
  @_field_set = { "entityId": entity_id, "externalIds": external_ids, "numberValues": number_values, "stringValues": string_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.

Returns:

  • (OpenStruct) —

    Additional properties unmapped to the current class definition



18
19
20
# File 'lib/samsara_api/types/create_attribute_request_entities.rb', line 18

def additional_properties
  @additional_properties
end

#entity_id ⇒ String (readonly)

Returns Entity id, based on the entity type.

Returns:

  • (String) —

    Entity id, based on the entity type.



9
10
11
# File 'lib/samsara_api/types/create_attribute_request_entities.rb', line 9

def entity_id
  @entity_id
end

#external_ids ⇒ Object (readonly)

given object.



12
13
14
# File 'lib/samsara_api/types/create_attribute_request_entities.rb', line 12

def external_ids
  @external_ids
end

#number_values ⇒ Array<Float> (readonly)

Returns Number values that can be associated with this attribute.

Returns:

  • (Array<Float>) —

    Number values that can be associated with this attribute



14
15
16
# File 'lib/samsara_api/types/create_attribute_request_entities.rb', line 14

def number_values
  @number_values
end

#string_values ⇒ Array<String> (readonly)

Returns String values that can be associated with this attribute.

Returns:

  • (Array<String>) —

    String values that can be associated with this attribute



16
17
18
# File 'lib/samsara_api/types/create_attribute_request_entities.rb', line 16

def string_values
  @string_values
end

Class Method Details

.from_json(json_object:) ⇒ Samsara::Types::CreateAttributeRequestEntities

Parameters:

  • json_object (String)

Returns:



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/samsara_api/types/create_attribute_request_entities.rb', line 46

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"]
  external_ids = parsed_json["externalIds"]
  number_values = parsed_json["numberValues"]
  string_values = parsed_json["stringValues"]
  new(
    entity_id: entity_id,
    external_ids: external_ids,
    number_values: number_values,
    string_values: string_values,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


73
74
75
76
77
78
# File 'lib/samsara_api/types/create_attribute_request_entities.rb', line 73

def self.validate_raw(obj:)
  obj.entity_id&.is_a?(String) != false || raise("Passed value for field obj.entity_id is not the expected type, validation failed.")
  obj.external_ids&.is_a?(Hash) != false || raise("Passed value for field obj.external_ids 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.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


64
65
66
# File 'lib/samsara_api/types/create_attribute_request_entities.rb', line 64

def to_json
  @_field_set&.to_json
end