Class: Samsara::Types::NumberFieldTypeMetaDataObjectResponseBody

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

Overview

The number field metadata.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(number_of_decimal_places: OMIT, additional_properties: nil) ⇒ Samsara::Types::NumberFieldTypeMetaDataObjectResponseBody

Parameters:

  • number_of_decimal_places (Long) (defaults to: OMIT) —

    The number of decimal places allowed for the field.

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

    Additional properties unmapped to the current class definition



22
23
24
25
26
27
28
# File 'lib/samsara_api/types/number_field_type_meta_data_object_response_body.rb', line 22

def initialize(number_of_decimal_places: OMIT, additional_properties: nil)
  @number_of_decimal_places = number_of_decimal_places if number_of_decimal_places != OMIT
  @additional_properties = additional_properties
  @_field_set = { "numberOfDecimalPlaces": number_of_decimal_places }.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



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

def additional_properties
  @additional_properties
end

#number_of_decimal_places ⇒ Long (readonly)

Returns The number of decimal places allowed for the field.

Returns:

  • (Long) —

    The number of decimal places allowed for the field.



10
11
12
# File 'lib/samsara_api/types/number_field_type_meta_data_object_response_body.rb', line 10

def number_of_decimal_places
  @number_of_decimal_places
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



34
35
36
37
38
39
# File 'lib/samsara_api/types/number_field_type_meta_data_object_response_body.rb', line 34

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  number_of_decimal_places = parsed_json["numberOfDecimalPlaces"]
  new(number_of_decimal_places: number_of_decimal_places, additional_properties: struct)
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


53
54
55
# File 'lib/samsara_api/types/number_field_type_meta_data_object_response_body.rb', line 53

def self.validate_raw(obj:)
  obj.number_of_decimal_places&.is_a?(Long) != false || raise("Passed value for field obj.number_of_decimal_places is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


44
45
46
# File 'lib/samsara_api/types/number_field_type_meta_data_object_response_body.rb', line 44

def to_json
  @_field_set&.to_json
end