Class: Samsara::Types::FormSubmissionPdfExportResponseObjectResponseBody

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

Overview

Form Submission PDF export response object.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(completed_at_time: OMIT, error_message: OMIT, expires_at_time:, id:, job_status:, pdf_id:, pdf_url: OMIT, pdf_url_expires_at_time: OMIT, requested_at_time:, additional_properties: nil) ⇒ Samsara::Types::FormSubmissionPdfExportResponseObjectResponseBody

Parameters:

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

    Additional properties unmapped to the current class definition



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/samsara_api/types/form_submission_pdf_export_response_object_response_body.rb', line 67

def initialize(completed_at_time: OMIT, error_message: OMIT, expires_at_time:, id:, job_status:, pdf_id:, pdf_url: OMIT, pdf_url_expires_at_time: OMIT, requested_at_time:, additional_properties: nil)
  @completed_at_time = completed_at_time if completed_at_time != OMIT
  @error_message = error_message if error_message != OMIT
  @expires_at_time = expires_at_time
  @id = id
  @job_status = job_status
  @pdf_id = pdf_id
  @pdf_url = pdf_url if pdf_url != OMIT
  @pdf_url_expires_at_time = pdf_url_expires_at_time if pdf_url_expires_at_time != OMIT
  @requested_at_time = requested_at_time
  @additional_properties = additional_properties
  @_field_set = { "completedAtTime": completed_at_time, "errorMessage": error_message, "expiresAtTime": expires_at_time, "id": id, "jobStatus": job_status, "pdfId": pdf_id, "pdfUrl": pdf_url, "pdfUrlExpiresAtTime": pdf_url_expires_at_time, "requestedAtTime": requested_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



41
42
43
# File 'lib/samsara_api/types/form_submission_pdf_export_response_object_response_body.rb', line 41

def additional_properties
  @additional_properties
end

#completed_at_time ⇒ Object (readonly)

UTC timestamp in RFC 3339 format.



16
17
18
# File 'lib/samsara_api/types/form_submission_pdf_export_response_object_response_body.rb', line 16

def completed_at_time
  @completed_at_time
end

#error_message ⇒ Object (readonly)

'failed'.



19
20
21
# File 'lib/samsara_api/types/form_submission_pdf_export_response_object_response_body.rb', line 19

def error_message
  @error_message
end

#expires_at_time ⇒ Object (readonly)

timestamp in RFC 3339 format.



23
24
25
# File 'lib/samsara_api/types/form_submission_pdf_export_response_object_response_body.rb', line 23

def expires_at_time
  @expires_at_time
end

#id ⇒ String (readonly)

Returns ID of the form submission being exported.

Returns:

  • (String) —

    ID of the form submission being exported.



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

def id
  @id
end

#job_status ⇒ Object (readonly)

failed



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

def job_status
  @job_status
end

#pdf_id ⇒ String (readonly)

Returns Unique ID for the PDF export that is created.

Returns:

  • (String) —

    Unique ID for the PDF export that is created.



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

def pdf_id
  @pdf_id
end

#pdf_url ⇒ Object (readonly)

'pdfUrlExpiresAtTime'. Included if 'jobStatus' is 'done'.



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

def pdf_url
  @pdf_url
end

#pdf_url_expires_at_time ⇒ Object (readonly)

retrieve a fresh url with another GET request. UTC timestamp in RFC 3339 format.



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

def pdf_url_expires_at_time
  @pdf_url_expires_at_time
end

#requested_at_time ⇒ Object (readonly)

format.



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

def requested_at_time
  @requested_at_time
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



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
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/samsara_api/types/form_submission_pdf_export_response_object_response_body.rb', line 87

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  completed_at_time = unless parsed_json["completedAtTime"].nil?
  DateTime.parse(parsed_json["completedAtTime"])
else
  nil
end
  error_message = parsed_json["errorMessage"]
  expires_at_time = unless parsed_json["expiresAtTime"].nil?
  DateTime.parse(parsed_json["expiresAtTime"])
else
  nil
end
  id = parsed_json["id"]
  job_status = parsed_json["jobStatus"]
  pdf_id = parsed_json["pdfId"]
  pdf_url = parsed_json["pdfUrl"]
  pdf_url_expires_at_time = unless parsed_json["pdfUrlExpiresAtTime"].nil?
  DateTime.parse(parsed_json["pdfUrlExpiresAtTime"])
else
  nil
end
  requested_at_time = unless parsed_json["requestedAtTime"].nil?
  DateTime.parse(parsed_json["requestedAtTime"])
else
  nil
end
  new(
    completed_at_time: completed_at_time,
    error_message: error_message,
    expires_at_time: expires_at_time,
    id: id,
    job_status: job_status,
    pdf_id: pdf_id,
    pdf_url: pdf_url,
    pdf_url_expires_at_time: pdf_url_expires_at_time,
    requested_at_time: requested_at_time,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


141
142
143
144
145
146
147
148
149
150
151
# File 'lib/samsara_api/types/form_submission_pdf_export_response_object_response_body.rb', line 141

def self.validate_raw(obj:)
  obj.completed_at_time&.is_a?(DateTime) != false || raise("Passed value for field obj.completed_at_time is not the expected type, validation failed.")
  obj.error_message&.is_a?(String) != false || raise("Passed value for field obj.error_message is not the expected type, validation failed.")
  obj.expires_at_time.is_a?(DateTime) != false || raise("Passed value for field obj.expires_at_time 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.job_status.is_a?(Samsara::Types::FormSubmissionPdfExportResponseObjectResponseBodyJobStatus) != false || raise("Passed value for field obj.job_status is not the expected type, validation failed.")
  obj.pdf_id.is_a?(String) != false || raise("Passed value for field obj.pdf_id is not the expected type, validation failed.")
  obj.pdf_url&.is_a?(String) != false || raise("Passed value for field obj.pdf_url is not the expected type, validation failed.")
  obj.pdf_url_expires_at_time&.is_a?(DateTime) != false || raise("Passed value for field obj.pdf_url_expires_at_time is not the expected type, validation failed.")
  obj.requested_at_time.is_a?(DateTime) != false || raise("Passed value for field obj.requested_at_time is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


132
133
134
# File 'lib/samsara_api/types/form_submission_pdf_export_response_object_response_body.rb', line 132

def to_json
  @_field_set&.to_json
end