Class: Samsara::Types::TrainingCourseResponseObjectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::TrainingCourseResponseObjectResponseBody
- Defined in:
- lib/samsara_api/types/training_course_response_object_response_body.rb
Overview
Training Course response object.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #category ⇒ Samsara::Types::TrainingCategoryObjectResponseBody readonly
-
#description ⇒ String
readonly
Description of the course.
-
#estimated_time_to_complete_minutes ⇒ Long
readonly
Estimated time it takes to complete the course.
-
#id ⇒ String
readonly
ID of the training course.
-
#labels ⇒ Array<Samsara::Types::TrainingCourseLabelObjectResponseBody>
readonly
List of course labels.
-
#revision_id ⇒ String
readonly
ID of the course’s specific version.
-
#status ⇒ Object
readonly
values: ‘published`, `deleted`, `archived`, `unknown`.
-
#title ⇒ String
readonly
Title of the course.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::TrainingCourseResponseObjectResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(category:, description: OMIT, estimated_time_to_complete_minutes:, id:, labels: OMIT, revision_id:, status:, title:, additional_properties: nil) ⇒ Samsara::Types::TrainingCourseResponseObjectResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(category:, description: OMIT, estimated_time_to_complete_minutes:, id:, labels: OMIT, revision_id:, status:, title:, additional_properties: nil) ⇒ Samsara::Types::TrainingCourseResponseObjectResponseBody
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/samsara_api/types/training_course_response_object_response_body.rb', line 54 def initialize(category:, description: OMIT, estimated_time_to_complete_minutes:, id:, labels: OMIT, revision_id:, status:, title:, additional_properties: nil) @category = category @description = description if description != OMIT @estimated_time_to_complete_minutes = estimated_time_to_complete_minutes @id = id @labels = labels if labels != OMIT @revision_id = revision_id @status = status @title = title @additional_properties = additional_properties @_field_set = { "category": category, "description": description, "estimatedTimeToCompleteMinutes": estimated_time_to_complete_minutes, "id": id, "labels": labels, "revisionId": revision_id, "status": status, "title": title }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
33 34 35 |
# File 'lib/samsara_api/types/training_course_response_object_response_body.rb', line 33 def additional_properties @additional_properties end |
#category ⇒ Samsara::Types::TrainingCategoryObjectResponseBody (readonly)
13 14 15 |
# File 'lib/samsara_api/types/training_course_response_object_response_body.rb', line 13 def category @category end |
#description ⇒ String (readonly)
Returns Description of the course.
15 16 17 |
# File 'lib/samsara_api/types/training_course_response_object_response_body.rb', line 15 def description @description end |
#estimated_time_to_complete_minutes ⇒ Long (readonly)
Returns Estimated time it takes to complete the course.
17 18 19 |
# File 'lib/samsara_api/types/training_course_response_object_response_body.rb', line 17 def estimated_time_to_complete_minutes @estimated_time_to_complete_minutes end |
#id ⇒ String (readonly)
Returns ID of the training course.
19 20 21 |
# File 'lib/samsara_api/types/training_course_response_object_response_body.rb', line 19 def id @id end |
#labels ⇒ Array<Samsara::Types::TrainingCourseLabelObjectResponseBody> (readonly)
Returns List of course labels.
21 22 23 |
# File 'lib/samsara_api/types/training_course_response_object_response_body.rb', line 21 def labels @labels end |
#revision_id ⇒ String (readonly)
Returns ID of the course’s specific version.
23 24 25 |
# File 'lib/samsara_api/types/training_course_response_object_response_body.rb', line 23 def revision_id @revision_id end |
#status ⇒ Object (readonly)
values: ‘published`, `deleted`, `archived`, `unknown`
29 30 31 |
# File 'lib/samsara_api/types/training_course_response_object_response_body.rb', line 29 def status @status end |
#title ⇒ String (readonly)
Returns Title of the course.
31 32 33 |
# File 'lib/samsara_api/types/training_course_response_object_response_body.rb', line 31 def title @title end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::TrainingCourseResponseObjectResponseBody
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/samsara_api/types/training_course_response_object_response_body.rb', line 73 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) unless parsed_json["category"].nil? category = parsed_json["category"].to_json category = Samsara::Types::TrainingCategoryObjectResponseBody.from_json(json_object: category) else category = nil end description = parsed_json["description"] estimated_time_to_complete_minutes = parsed_json["estimatedTimeToCompleteMinutes"] id = parsed_json["id"] labels = parsed_json["labels"]&.map do | item | item = item.to_json Samsara::Types::TrainingCourseLabelObjectResponseBody.from_json(json_object: item) end revision_id = parsed_json["revisionId"] status = parsed_json["status"] title = parsed_json["title"] new( category: category, description: description, estimated_time_to_complete_minutes: estimated_time_to_complete_minutes, id: id, labels: labels, revision_id: revision_id, status: status, title: title, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
117 118 119 120 121 122 123 124 125 126 |
# File 'lib/samsara_api/types/training_course_response_object_response_body.rb', line 117 def self.validate_raw(obj:) Samsara::Types::TrainingCategoryObjectResponseBody.validate_raw(obj: obj.category) obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") obj.estimated_time_to_complete_minutes.is_a?(Long) != false || raise("Passed value for field obj.estimated_time_to_complete_minutes 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.labels&.is_a?(Array) != false || raise("Passed value for field obj.labels is not the expected type, validation failed.") obj.revision_id.is_a?(String) != false || raise("Passed value for field obj.revision_id is not the expected type, validation failed.") obj.status.is_a?(Samsara::Types::TrainingCourseResponseObjectResponseBodyStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") obj.title.is_a?(String) != false || raise("Passed value for field obj.title is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
108 109 110 |
# File 'lib/samsara_api/types/training_course_response_object_response_body.rb', line 108 def to_json @_field_set&.to_json end |