Class: Samsara::Types::FormSubmissionResponseObjectResponseBody

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

Overview

Form Submission response object.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(approval_details: OMIT, asset: OMIT, assigned_at_time: OMIT, assigned_to: OMIT, created_at_time:, due_at_time: OMIT, external_ids: OMIT, fields:, form_template:, geofence: OMIT, id:, is_required:, location: OMIT, route_id: OMIT, route_stop_id: OMIT, score: OMIT, status:, submitted_at_time:, submitted_by:, title: OMIT, updated_at_time:, additional_properties: nil) ⇒ Samsara::Types::FormSubmissionResponseObjectResponseBody

Parameters:

  • submitted_at_time (DateTime) —

    Submission time of the form submission. UTC timestamp in RFC 3339 format.

  • submitted_by (Samsara::Types::FormsPolymorphicUserObjectResponseBody)
  • title (String) (defaults to: OMIT) —

    Title of the form submission. Sometimes returned if the submission has a title.

  • updated_at_time (DateTime) —

    Update time of the form submission. UTC timestamp in RFC 3339 format.

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

    Additional properties unmapped to the current class definition



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/samsara_api/types/form_submission_response_object_response_body.rb', line 110

def initialize(approval_details: OMIT, asset: OMIT, assigned_at_time: OMIT, assigned_to: OMIT, created_at_time:, due_at_time: OMIT, external_ids: OMIT, fields:, form_template:, geofence: OMIT, id:, is_required:, location: OMIT, route_id: OMIT, route_stop_id: OMIT, score: OMIT, status:, submitted_at_time:, submitted_by:, title: OMIT, updated_at_time:, additional_properties: nil)
  @approval_details = approval_details if approval_details != OMIT
  @asset = asset if asset != OMIT
  @assigned_at_time = assigned_at_time if assigned_at_time != OMIT
  @assigned_to = assigned_to if assigned_to != OMIT
  @created_at_time = created_at_time
  @due_at_time = due_at_time if due_at_time != OMIT
  @external_ids = external_ids if external_ids != OMIT
  @fields = fields
  @form_template = form_template
  @geofence = geofence if geofence != OMIT
  @id = id
  @is_required = is_required
  @location = location if location != OMIT
  @route_id = route_id if route_id != OMIT
  @route_stop_id = route_stop_id if route_stop_id != OMIT
  @score = score if score != OMIT
  @status = status
  @submitted_at_time = 
  @submitted_by = 
  @title = title if title != OMIT
  @updated_at_time = updated_at_time
  @additional_properties = additional_properties
  @_field_set = { "approvalDetails": approval_details, "asset": asset, "assignedAtTime": assigned_at_time, "assignedTo": assigned_to, "createdAtTime": created_at_time, "dueAtTime": due_at_time, "externalIds": external_ids, "fields": fields, "formTemplate": form_template, "geofence": geofence, "id": id, "isRequired": is_required, "location": location, "routeId": route_id, "routeStopId": route_stop_id, "score": score, "status": status, "submittedAtTime": , "submittedBy": , "title": title, "updatedAtTime": updated_at_time }.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



73
74
75
# File 'lib/samsara_api/types/form_submission_response_object_response_body.rb', line 73

def additional_properties
  @additional_properties
end

#approval_details ⇒ Samsara::Types::FormsProductSubmissionApprovalDetailsObjectResponseBody (readonly)



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

def approval_details
  @approval_details
end

#asset ⇒ Samsara::Types::FormsAssetObjectResponseBody (readonly)



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

def asset
  @asset
end

#assigned_at_time ⇒ Object (readonly)

assigned to a user or driver. UTC timestamp in RFC 3339 format.



29
30
31
# File 'lib/samsara_api/types/form_submission_response_object_response_body.rb', line 29

def assigned_at_time
  @assigned_at_time
end

#assigned_to ⇒ Samsara::Types::FormsPolymorphicUserObjectResponseBody (readonly)



31
32
33
# File 'lib/samsara_api/types/form_submission_response_object_response_body.rb', line 31

def assigned_to
  @assigned_to
end

#created_at_time ⇒ DateTime (readonly)

Returns Creation time of the form submission. UTC timestamp in RFC 3339 format.

Returns:

  • (DateTime) —

    Creation time of the form submission. UTC timestamp in RFC 3339 format.



33
34
35
# File 'lib/samsara_api/types/form_submission_response_object_response_body.rb', line 33

def created_at_time
  @created_at_time
end

#due_at_time ⇒ Object (readonly)

due date. UTC timestamp in RFC 3339 format.



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

def due_at_time
  @due_at_time
end

#external_ids ⇒ Hash{String => String} (readonly)

Returns A map of external ids.

Returns:

  • (Hash{String => String}) —

    A map of external ids



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

def external_ids
  @external_ids
end

#fields ⇒ Array<Samsara::Types::FormsFieldInputObjectResponseBody> (readonly)

Returns List of field inputs in a form submission.

Returns:



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

def fields
  @fields
end

#form_template ⇒ Samsara::Types::FormTemplateReferenceObjectResponseBody (readonly)



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

def form_template
  @form_template
end

#geofence ⇒ Samsara::Types::FormsGeofenceObjectResponseBody (readonly)



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

def geofence
  @geofence
end

#id ⇒ String (readonly)

Returns ID of the form submission.

Returns:

  • (String) —

    ID of the form submission.



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

def id
  @id
end

#is_required ⇒ Object (readonly)

returned.



49
50
51
# File 'lib/samsara_api/types/form_submission_response_object_response_body.rb', line 49

def is_required
  @is_required
end

#location ⇒ Samsara::Types::FormsLocationObjectResponseBody (readonly)



51
52
53
# File 'lib/samsara_api/types/form_submission_response_object_response_body.rb', line 51

def location
  @location
end

#route_id ⇒ Object (readonly)

stop.



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

def route_id
  @route_id
end

#route_stop_id ⇒ Object (readonly)

route stop.



57
58
59
# File 'lib/samsara_api/types/form_submission_response_object_response_body.rb', line 57

def route_stop_id
  @route_stop_id
end

#score ⇒ Samsara::Types::FormsScoreObjectResponseBody (readonly)



59
60
61
# File 'lib/samsara_api/types/form_submission_response_object_response_body.rb', line 59

def score
  @score
end

#status ⇒ Object (readonly)

approved



63
64
65
# File 'lib/samsara_api/types/form_submission_response_object_response_body.rb', line 63

def status
  @status
end

#submitted_at_time ⇒ DateTime (readonly)

Returns Submission time of the form submission. UTC timestamp in RFC 3339 format.

Returns:

  • (DateTime) —

    Submission time of the form submission. UTC timestamp in RFC 3339 format.



65
66
67
# File 'lib/samsara_api/types/form_submission_response_object_response_body.rb', line 65

def 
  @submitted_at_time
end

#submitted_by ⇒ Samsara::Types::FormsPolymorphicUserObjectResponseBody (readonly)



67
68
69
# File 'lib/samsara_api/types/form_submission_response_object_response_body.rb', line 67

def 
  @submitted_by
end

#title ⇒ String (readonly)

Returns Title of the form submission. Sometimes returned if the submission has a title.

Returns:

  • (String) —

    Title of the form submission. Sometimes returned if the submission has a title.



69
70
71
# File 'lib/samsara_api/types/form_submission_response_object_response_body.rb', line 69

def title
  @title
end

#updated_at_time ⇒ DateTime (readonly)

Returns Update time of the form submission. UTC timestamp in RFC 3339 format.

Returns:

  • (DateTime) —

    Update time of the form submission. UTC timestamp in RFC 3339 format.



71
72
73
# File 'lib/samsara_api/types/form_submission_response_object_response_body.rb', line 71

def updated_at_time
  @updated_at_time
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/samsara_api/types/form_submission_response_object_response_body.rb', line 142

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  unless parsed_json["approvalDetails"].nil?
    approval_details = parsed_json["approvalDetails"].to_json
    approval_details = Samsara::Types::FormsProductSubmissionApprovalDetailsObjectResponseBody.from_json(json_object: approval_details)
  else
    approval_details = nil
  end
  unless parsed_json["asset"].nil?
    asset = parsed_json["asset"].to_json
    asset = Samsara::Types::FormsAssetObjectResponseBody.from_json(json_object: asset)
  else
    asset = nil
  end
  assigned_at_time = unless parsed_json["assignedAtTime"].nil?
  DateTime.parse(parsed_json["assignedAtTime"])
else
  nil
end
  unless parsed_json["assignedTo"].nil?
    assigned_to = parsed_json["assignedTo"].to_json
    assigned_to = Samsara::Types::FormsPolymorphicUserObjectResponseBody.from_json(json_object: assigned_to)
  else
    assigned_to = nil
  end
  created_at_time = unless parsed_json["createdAtTime"].nil?
  DateTime.parse(parsed_json["createdAtTime"])
else
  nil
end
  due_at_time = unless parsed_json["dueAtTime"].nil?
  DateTime.parse(parsed_json["dueAtTime"])
else
  nil
end
  external_ids = parsed_json["externalIds"]
  fields = parsed_json["fields"]&.map do | item |
  item = item.to_json
  Samsara::Types::FormsFieldInputObjectResponseBody.from_json(json_object: item)
end
  unless parsed_json["formTemplate"].nil?
    form_template = parsed_json["formTemplate"].to_json
    form_template = Samsara::Types::FormTemplateReferenceObjectResponseBody.from_json(json_object: form_template)
  else
    form_template = nil
  end
  unless parsed_json["geofence"].nil?
    geofence = parsed_json["geofence"].to_json
    geofence = Samsara::Types::FormsGeofenceObjectResponseBody.from_json(json_object: geofence)
  else
    geofence = nil
  end
  id = parsed_json["id"]
  is_required = parsed_json["isRequired"]
  unless parsed_json["location"].nil?
    location = parsed_json["location"].to_json
    location = Samsara::Types::FormsLocationObjectResponseBody.from_json(json_object: location)
  else
    location = nil
  end
  route_id = parsed_json["routeId"]
  route_stop_id = parsed_json["routeStopId"]
  unless parsed_json["score"].nil?
    score = parsed_json["score"].to_json
    score = Samsara::Types::FormsScoreObjectResponseBody.from_json(json_object: score)
  else
    score = nil
  end
  status = parsed_json["status"]
   = unless parsed_json["submittedAtTime"].nil?
  DateTime.parse(parsed_json["submittedAtTime"])
else
  nil
end
  unless parsed_json["submittedBy"].nil?
     = parsed_json["submittedBy"].to_json
     = Samsara::Types::FormsPolymorphicUserObjectResponseBody.from_json(json_object: )
  else
     = nil
  end
  title = parsed_json["title"]
  updated_at_time = unless parsed_json["updatedAtTime"].nil?
  DateTime.parse(parsed_json["updatedAtTime"])
else
  nil
end
  new(
    approval_details: approval_details,
    asset: asset,
    assigned_at_time: assigned_at_time,
    assigned_to: assigned_to,
    created_at_time: created_at_time,
    due_at_time: due_at_time,
    external_ids: external_ids,
    fields: fields,
    form_template: form_template,
    geofence: geofence,
    id: id,
    is_required: is_required,
    location: location,
    route_id: route_id,
    route_stop_id: route_stop_id,
    score: score,
    status: status,
    submitted_at_time: ,
    submitted_by: ,
    title: title,
    updated_at_time: updated_at_time,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/samsara_api/types/form_submission_response_object_response_body.rb', line 267

def self.validate_raw(obj:)
  obj.approval_details.nil? || Samsara::Types::FormsProductSubmissionApprovalDetailsObjectResponseBody.validate_raw(obj: obj.approval_details)
  obj.asset.nil? || Samsara::Types::FormsAssetObjectResponseBody.validate_raw(obj: obj.asset)
  obj.assigned_at_time&.is_a?(DateTime) != false || raise("Passed value for field obj.assigned_at_time is not the expected type, validation failed.")
  obj.assigned_to.nil? || Samsara::Types::FormsPolymorphicUserObjectResponseBody.validate_raw(obj: obj.assigned_to)
  obj.created_at_time.is_a?(DateTime) != false || raise("Passed value for field obj.created_at_time is not the expected type, validation failed.")
  obj.due_at_time&.is_a?(DateTime) != false || raise("Passed value for field obj.due_at_time 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.fields.is_a?(Array) != false || raise("Passed value for field obj.fields is not the expected type, validation failed.")
  Samsara::Types::FormTemplateReferenceObjectResponseBody.validate_raw(obj: obj.form_template)
  obj.geofence.nil? || Samsara::Types::FormsGeofenceObjectResponseBody.validate_raw(obj: obj.geofence)
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.is_required.is_a?(Boolean) != false || raise("Passed value for field obj.is_required is not the expected type, validation failed.")
  obj.location.nil? || Samsara::Types::FormsLocationObjectResponseBody.validate_raw(obj: obj.location)
  obj.route_id&.is_a?(String) != false || raise("Passed value for field obj.route_id is not the expected type, validation failed.")
  obj.route_stop_id&.is_a?(String) != false || raise("Passed value for field obj.route_stop_id is not the expected type, validation failed.")
  obj.score.nil? || Samsara::Types::FormsScoreObjectResponseBody.validate_raw(obj: obj.score)
  obj.status.is_a?(Samsara::Types::FormSubmissionResponseObjectResponseBodyStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
  obj..is_a?(DateTime) != false || raise("Passed value for field obj.submitted_at_time is not the expected type, validation failed.")
  Samsara::Types::FormsPolymorphicUserObjectResponseBody.validate_raw(obj: obj.)
  obj.title&.is_a?(String) != false || raise("Passed value for field obj.title is not the expected type, validation failed.")
  obj.updated_at_time.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at_time is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


258
259
260
# File 'lib/samsara_api/types/form_submission_response_object_response_body.rb', line 258

def to_json
  @_field_set&.to_json
end