Class: Samsara::Types::FormsFieldInputObjectResponseBody

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

Overview

Forms input field object.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(asset_value: OMIT, check_boxes_value: OMIT, date_time_value: OMIT, geofence_value: OMIT, id:, issue: OMIT, label: OMIT, media_list: OMIT, media_value: OMIT, multiple_choice_value: OMIT, note: OMIT, number_value: OMIT, person_value: OMIT, signature_value: OMIT, table_value: OMIT, text_value: OMIT, type:, additional_properties: nil) ⇒ Samsara::Types::FormsFieldInputObjectResponseBody

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/samsara_api/types/forms_field_input_object_response_body.rb', line 88

def initialize(asset_value: OMIT, check_boxes_value: OMIT, date_time_value: OMIT, geofence_value: OMIT, id:, issue: OMIT, label: OMIT, media_list: OMIT, media_value: OMIT, multiple_choice_value: OMIT, note: OMIT, number_value: OMIT, person_value: OMIT, signature_value: OMIT, table_value: OMIT, text_value: OMIT, type:, additional_properties: nil)
  @asset_value = asset_value if asset_value != OMIT
  @check_boxes_value = check_boxes_value if check_boxes_value != OMIT
  @date_time_value = date_time_value if date_time_value != OMIT
  @geofence_value = geofence_value if geofence_value != OMIT
  @id = id
  @issue = issue if issue != OMIT
  @label = label if label != OMIT
  @media_list = media_list if media_list != OMIT
  @media_value = media_value if media_value != OMIT
  @multiple_choice_value = multiple_choice_value if multiple_choice_value != OMIT
  @note = note if note != OMIT
  @number_value = number_value if number_value != OMIT
  @person_value = person_value if person_value != OMIT
  @signature_value = signature_value if signature_value != OMIT
  @table_value = table_value if table_value != OMIT
  @text_value = text_value if text_value != OMIT
  @type = type
  @additional_properties = additional_properties
  @_field_set = { "assetValue": asset_value, "checkBoxesValue": check_boxes_value, "dateTimeValue": date_time_value, "geofenceValue": geofence_value, "id": id, "issue": issue, "label": label, "mediaList": media_list, "mediaValue": media_value, "multipleChoiceValue": multiple_choice_value, "note": note, "numberValue": number_value, "personValue": person_value, "signatureValue": signature_value, "tableValue": table_value, "textValue": text_value, "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



60
61
62
# File 'lib/samsara_api/types/forms_field_input_object_response_body.rb', line 60

def additional_properties
  @additional_properties
end

#asset_valueSamsara::Types::FormsAssetValueObjectResponseBody (readonly)



24
25
26
# File 'lib/samsara_api/types/forms_field_input_object_response_body.rb', line 24

def asset_value
  @asset_value
end

#check_boxes_valueSamsara::Types::FormsCheckBoxesValueObjectResponseBody (readonly)



26
27
28
# File 'lib/samsara_api/types/forms_field_input_object_response_body.rb', line 26

def check_boxes_value
  @check_boxes_value
end

#date_time_valueSamsara::Types::FormsDateTimeValueObjectResponseBody (readonly)



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

def date_time_value
  @date_time_value
end

#geofence_valueSamsara::Types::FormsGeofenceValueObjectResponseBody (readonly)



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

def geofence_value
  @geofence_value
end

#idString (readonly)

Returns ID of the forms input field object.

Returns:

  • (String)

    ID of the forms input field object.



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

def id
  @id
end

#issueSamsara::Types::FormsIssueCreatedByFieldObjectResponseBody (readonly)



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

def issue
  @issue
end

#labelString (readonly)

Returns Forms input field label.

Returns:

  • (String)

    Forms input field label.



36
37
38
# File 'lib/samsara_api/types/forms_field_input_object_response_body.rb', line 36

def label
  @label
end

#media_listArray<Samsara::Types::FormsMediaRecordObjectResponseBody> (readonly)

Returns List of forms media record objects.

Returns:



38
39
40
# File 'lib/samsara_api/types/forms_field_input_object_response_body.rb', line 38

def media_list
  @media_list
end

#media_valueSamsara::Types::FormsMediaValueObjectResponseBody (readonly)



40
41
42
# File 'lib/samsara_api/types/forms_field_input_object_response_body.rb', line 40

def media_value
  @media_value
end

#multiple_choice_valueSamsara::Types::FormsMultipleChoiceValueObjectResponseBody (readonly)



42
43
44
# File 'lib/samsara_api/types/forms_field_input_object_response_body.rb', line 42

def multiple_choice_value
  @multiple_choice_value
end

#noteString (readonly)

Returns A note attached to the field input.

Returns:

  • (String)

    A note attached to the field input.



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

def note
  @note
end

#number_valueSamsara::Types::FormsNumberValueObjectResponseBody (readonly)



46
47
48
# File 'lib/samsara_api/types/forms_field_input_object_response_body.rb', line 46

def number_value
  @number_value
end

#person_valueSamsara::Types::FormsPersonValueObjectResponseBody (readonly)



48
49
50
# File 'lib/samsara_api/types/forms_field_input_object_response_body.rb', line 48

def person_value
  @person_value
end

#signature_valueSamsara::Types::FormsSignatureValueObjectResponseBody (readonly)



50
51
52
# File 'lib/samsara_api/types/forms_field_input_object_response_body.rb', line 50

def signature_value
  @signature_value
end

#table_valueSamsara::Types::FormsTableValueObjectResponseBody (readonly)



52
53
54
# File 'lib/samsara_api/types/forms_field_input_object_response_body.rb', line 52

def table_value
  @table_value
end

#text_valueSamsara::Types::FormsTextValueObjectResponseBody (readonly)



54
55
56
# File 'lib/samsara_api/types/forms_field_input_object_response_body.rb', line 54

def text_value
  @text_value
end

#typeObject (readonly)

‘geofence`



58
59
60
# File 'lib/samsara_api/types/forms_field_input_object_response_body.rb', line 58

def type
  @type
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/samsara_api/types/forms_field_input_object_response_body.rb', line 115

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  unless parsed_json["assetValue"].nil?
    asset_value = parsed_json["assetValue"].to_json
    asset_value = Samsara::Types::FormsAssetValueObjectResponseBody.from_json(json_object: asset_value)
  else
    asset_value = nil
  end
  unless parsed_json["checkBoxesValue"].nil?
    check_boxes_value = parsed_json["checkBoxesValue"].to_json
    check_boxes_value = Samsara::Types::FormsCheckBoxesValueObjectResponseBody.from_json(json_object: check_boxes_value)
  else
    check_boxes_value = nil
  end
  unless parsed_json["dateTimeValue"].nil?
    date_time_value = parsed_json["dateTimeValue"].to_json
    date_time_value = Samsara::Types::FormsDateTimeValueObjectResponseBody.from_json(json_object: date_time_value)
  else
    date_time_value = nil
  end
  unless parsed_json["geofenceValue"].nil?
    geofence_value = parsed_json["geofenceValue"].to_json
    geofence_value = Samsara::Types::FormsGeofenceValueObjectResponseBody.from_json(json_object: geofence_value)
  else
    geofence_value = nil
  end
  id = parsed_json["id"]
  unless parsed_json["issue"].nil?
    issue = parsed_json["issue"].to_json
    issue = Samsara::Types::FormsIssueCreatedByFieldObjectResponseBody.from_json(json_object: issue)
  else
    issue = nil
  end
  label = parsed_json["label"]
  media_list = parsed_json["mediaList"]&.map do | item |
  item = item.to_json
  Samsara::Types::FormsMediaRecordObjectResponseBody.from_json(json_object: item)
end
  unless parsed_json["mediaValue"].nil?
    media_value = parsed_json["mediaValue"].to_json
    media_value = Samsara::Types::FormsMediaValueObjectResponseBody.from_json(json_object: media_value)
  else
    media_value = nil
  end
  unless parsed_json["multipleChoiceValue"].nil?
    multiple_choice_value = parsed_json["multipleChoiceValue"].to_json
    multiple_choice_value = Samsara::Types::FormsMultipleChoiceValueObjectResponseBody.from_json(json_object: multiple_choice_value)
  else
    multiple_choice_value = nil
  end
  note = parsed_json["note"]
  unless parsed_json["numberValue"].nil?
    number_value = parsed_json["numberValue"].to_json
    number_value = Samsara::Types::FormsNumberValueObjectResponseBody.from_json(json_object: number_value)
  else
    number_value = nil
  end
  unless parsed_json["personValue"].nil?
    person_value = parsed_json["personValue"].to_json
    person_value = Samsara::Types::FormsPersonValueObjectResponseBody.from_json(json_object: person_value)
  else
    person_value = nil
  end
  unless parsed_json["signatureValue"].nil?
    signature_value = parsed_json["signatureValue"].to_json
    signature_value = Samsara::Types::FormsSignatureValueObjectResponseBody.from_json(json_object: signature_value)
  else
    signature_value = nil
  end
  unless parsed_json["tableValue"].nil?
    table_value = parsed_json["tableValue"].to_json
    table_value = Samsara::Types::FormsTableValueObjectResponseBody.from_json(json_object: table_value)
  else
    table_value = nil
  end
  unless parsed_json["textValue"].nil?
    text_value = parsed_json["textValue"].to_json
    text_value = Samsara::Types::FormsTextValueObjectResponseBody.from_json(json_object: text_value)
  else
    text_value = nil
  end
  type = parsed_json["type"]
  new(
    asset_value: asset_value,
    check_boxes_value: check_boxes_value,
    date_time_value: date_time_value,
    geofence_value: geofence_value,
    id: id,
    issue: issue,
    label: label,
    media_list: media_list,
    media_value: media_value,
    multiple_choice_value: multiple_choice_value,
    note: note,
    number_value: number_value,
    person_value: person_value,
    signature_value: signature_value,
    table_value: table_value,
    text_value: text_value,
    type: type,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/samsara_api/types/forms_field_input_object_response_body.rb', line 231

def self.validate_raw(obj:)
  obj.asset_value.nil? || Samsara::Types::FormsAssetValueObjectResponseBody.validate_raw(obj: obj.asset_value)
  obj.check_boxes_value.nil? || Samsara::Types::FormsCheckBoxesValueObjectResponseBody.validate_raw(obj: obj.check_boxes_value)
  obj.date_time_value.nil? || Samsara::Types::FormsDateTimeValueObjectResponseBody.validate_raw(obj: obj.date_time_value)
  obj.geofence_value.nil? || Samsara::Types::FormsGeofenceValueObjectResponseBody.validate_raw(obj: obj.geofence_value)
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.issue.nil? || Samsara::Types::FormsIssueCreatedByFieldObjectResponseBody.validate_raw(obj: obj.issue)
  obj.label&.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.")
  obj.media_list&.is_a?(Array) != false || raise("Passed value for field obj.media_list is not the expected type, validation failed.")
  obj.media_value.nil? || Samsara::Types::FormsMediaValueObjectResponseBody.validate_raw(obj: obj.media_value)
  obj.multiple_choice_value.nil? || Samsara::Types::FormsMultipleChoiceValueObjectResponseBody.validate_raw(obj: obj.multiple_choice_value)
  obj.note&.is_a?(String) != false || raise("Passed value for field obj.note is not the expected type, validation failed.")
  obj.number_value.nil? || Samsara::Types::FormsNumberValueObjectResponseBody.validate_raw(obj: obj.number_value)
  obj.person_value.nil? || Samsara::Types::FormsPersonValueObjectResponseBody.validate_raw(obj: obj.person_value)
  obj.signature_value.nil? || Samsara::Types::FormsSignatureValueObjectResponseBody.validate_raw(obj: obj.signature_value)
  obj.table_value.nil? || Samsara::Types::FormsTableValueObjectResponseBody.validate_raw(obj: obj.table_value)
  obj.text_value.nil? || Samsara::Types::FormsTextValueObjectResponseBody.validate_raw(obj: obj.text_value)
  obj.type.is_a?(Samsara::Types::FormsFieldInputObjectResponseBodyType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


222
223
224
# File 'lib/samsara_api/types/forms_field_input_object_response_body.rb', line 222

def to_json
  @_field_set&.to_json
end