Class: Samsara::Types::FormsTableFieldDefinitionObjectResponseBody

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

Overview

Forms table field definition object.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(allow_manual_entry: OMIT, allowed_date_time_value_type: OMIT, filter_by_role_ids: OMIT, id:, include_drivers: OMIT, include_users: OMIT, label:, num_decimal_places: OMIT, options: OMIT, type:, additional_properties: nil) ⇒ Samsara::Types::FormsTableFieldDefinitionObjectResponseBody

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/samsara_api/types/forms_table_field_definition_object_response_body.rb', line 64

def initialize(allow_manual_entry: OMIT, allowed_date_time_value_type: OMIT, filter_by_role_ids: OMIT, id:, include_drivers: OMIT, include_users: OMIT, label:, num_decimal_places: OMIT, options: OMIT, type:, additional_properties: nil)
  @allow_manual_entry = allow_manual_entry if allow_manual_entry != OMIT
  @allowed_date_time_value_type = allowed_date_time_value_type if allowed_date_time_value_type != OMIT
  @filter_by_role_ids = filter_by_role_ids if filter_by_role_ids != OMIT
  @id = id
  @include_drivers = include_drivers if include_drivers != OMIT
  @include_users = include_users if include_users != OMIT
  @label = label
  @num_decimal_places = num_decimal_places if num_decimal_places != OMIT
  @options = options if options != OMIT
  @type = type
  @additional_properties = additional_properties
  @_field_set = { "allowManualEntry": allow_manual_entry, "allowedDateTimeValueType": allowed_date_time_value_type, "filterByRoleIds": filter_by_role_ids, "id": id, "includeDrivers": include_drivers, "includeUsers": include_users, "label": label, "numDecimalPlaces": num_decimal_places, "options": options, "type": type }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



39
40
41
# File 'lib/samsara_api/types/forms_table_field_definition_object_response_body.rb', line 39

def additional_properties
  @additional_properties
end

#allow_manual_entryObject (readonly)

person fields.



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

def allow_manual_entry
  @allow_manual_entry
end

#allowed_date_time_value_typeObject (readonly)

fields. Valid values: ‘datetime`, `date`, `time`



17
18
19
# File 'lib/samsara_api/types/forms_table_field_definition_object_response_body.rb', line 17

def allowed_date_time_value_type
  @allowed_date_time_value_type
end

#filter_by_role_idsObject (readonly)

people for this field. Only present for person fields.



20
21
22
# File 'lib/samsara_api/types/forms_table_field_definition_object_response_body.rb', line 20

def filter_by_role_ids
  @filter_by_role_ids
end

#idString (readonly)

Returns Identifier of the field.

Returns:

  • (String)

    Identifier of the field.



22
23
24
# File 'lib/samsara_api/types/forms_table_field_definition_object_response_body.rb', line 22

def id
  @id
end

#include_driversObject (readonly)

for person fields.



25
26
27
# File 'lib/samsara_api/types/forms_table_field_definition_object_response_body.rb', line 25

def include_drivers
  @include_drivers
end

#include_usersObject (readonly)

for person fields.



28
29
30
# File 'lib/samsara_api/types/forms_table_field_definition_object_response_body.rb', line 28

def include_users
  @include_users
end

#labelString (readonly)

Returns Label of the field.

Returns:

  • (String)

    Label of the field.



30
31
32
# File 'lib/samsara_api/types/forms_table_field_definition_object_response_body.rb', line 30

def label
  @label
end

#num_decimal_placesLong (readonly)

Returns Number of decimal places allowed. Only present for number fields.

Returns:

  • (Long)

    Number of decimal places allowed. Only present for number fields.



32
33
34
# File 'lib/samsara_api/types/forms_table_field_definition_object_response_body.rb', line 32

def num_decimal_places
  @num_decimal_places
end

#optionsArray<Samsara::Types::FormsSelectOptionObjectResponseBody> (readonly)

Returns List of select options for check boxes or multiple choice fields.

Returns:



34
35
36
# File 'lib/samsara_api/types/forms_table_field_definition_object_response_body.rb', line 34

def options
  @options
end

#typeObject (readonly)

‘check_boxes`, `media`, `datetime`, `signature`, `person`



37
38
39
# File 'lib/samsara_api/types/forms_table_field_definition_object_response_body.rb', line 37

def type
  @type
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



85
86
87
88
89
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
# File 'lib/samsara_api/types/forms_table_field_definition_object_response_body.rb', line 85

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  allow_manual_entry = parsed_json["allowManualEntry"]
  allowed_date_time_value_type = parsed_json["allowedDateTimeValueType"]
  filter_by_role_ids = parsed_json["filterByRoleIds"]
  id = parsed_json["id"]
  include_drivers = parsed_json["includeDrivers"]
  include_users = parsed_json["includeUsers"]
  label = parsed_json["label"]
  num_decimal_places = parsed_json["numDecimalPlaces"]
  options = parsed_json["options"]&.map do | item |
  item = item.to_json
  Samsara::Types::FormsSelectOptionObjectResponseBody.from_json(json_object: item)
end
  type = parsed_json["type"]
  new(
    allow_manual_entry: allow_manual_entry,
    allowed_date_time_value_type: allowed_date_time_value_type,
    filter_by_role_ids: filter_by_role_ids,
    id: id,
    include_drivers: include_drivers,
    include_users: include_users,
    label: label,
    num_decimal_places: num_decimal_places,
    options: options,
    type: type,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/samsara_api/types/forms_table_field_definition_object_response_body.rb', line 128

def self.validate_raw(obj:)
  obj.allow_manual_entry&.is_a?(Boolean) != false || raise("Passed value for field obj.allow_manual_entry is not the expected type, validation failed.")
  obj.allowed_date_time_value_type&.is_a?(Samsara::Types::FormsTableFieldDefinitionObjectResponseBodyAllowedDateTimeValueType) != false || raise("Passed value for field obj.allowed_date_time_value_type is not the expected type, validation failed.")
  obj.filter_by_role_ids&.is_a?(Array) != false || raise("Passed value for field obj.filter_by_role_ids is not the expected type, validation failed.")
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.include_drivers&.is_a?(Boolean) != false || raise("Passed value for field obj.include_drivers is not the expected type, validation failed.")
  obj.include_users&.is_a?(Boolean) != false || raise("Passed value for field obj.include_users is not the expected type, validation failed.")
  obj.label.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.")
  obj.num_decimal_places&.is_a?(Long) != false || raise("Passed value for field obj.num_decimal_places is not the expected type, validation failed.")
  obj.options&.is_a?(Array) != false || raise("Passed value for field obj.options is not the expected type, validation failed.")
  obj.type.is_a?(Samsara::Types::FormsTableFieldDefinitionObjectResponseBodyType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


119
120
121
# File 'lib/samsara_api/types/forms_table_field_definition_object_response_body.rb', line 119

def to_json
  @_field_set&.to_json
end