Class: Samsara::Types::FormsTableFieldDefinitionObjectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::FormsTableFieldDefinitionObjectResponseBody
- 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
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#allow_manual_entry ⇒ Object
readonly
person fields.
-
#allowed_date_time_value_type ⇒ Object
readonly
fields.
-
#filter_by_role_ids ⇒ Object
readonly
people for this field.
-
#id ⇒ String
readonly
Identifier of the field.
-
#include_drivers ⇒ Object
readonly
for person fields.
-
#include_users ⇒ Object
readonly
for person fields.
-
#label ⇒ String
readonly
Label of the field.
-
#num_decimal_places ⇒ Long
readonly
Number of decimal places allowed.
-
#options ⇒ Array<Samsara::Types::FormsSelectOptionObjectResponseBody>
readonly
List of select options for check boxes or multiple choice fields.
-
#type ⇒ Object
readonly
‘check_boxes`, `media`, `datetime`, `signature`, `person`.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::FormsTableFieldDefinitionObjectResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #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 constructor
- #to_json ⇒ String
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
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 = if != 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": , "type": type }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns 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_entry ⇒ Object (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_type ⇒ Object (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_ids ⇒ Object (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 |
#id ⇒ String (readonly)
Returns 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_drivers ⇒ Object (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_users ⇒ Object (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 |
#label ⇒ String (readonly)
Returns 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_places ⇒ Long (readonly)
Returns 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 |
#options ⇒ Array<Samsara::Types::FormsSelectOptionObjectResponseBody> (readonly)
Returns List of select options for check boxes or multiple choice fields.
34 35 36 |
# File 'lib/samsara_api/types/forms_table_field_definition_object_response_body.rb', line 34 def @options end |
#type ⇒ Object (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
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"] = 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: , type: type, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ 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.&.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_json ⇒ 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 |