Class: Samsara::Types::UploadedMediaObjectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::UploadedMediaObjectResponseBody
- Defined in:
- lib/samsara_api/types/uploaded_media_object_response_body.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#available_at_time ⇒ Object
readonly
2015-09-15T14:00:12-04:00.
-
#end_time ⇒ Object
readonly
2015-09-15T14:00:12-04:00).
-
#input ⇒ Object
readonly
dashcamInwardFacing,analog1. -
#media_type ⇒ Samsara::Types::UploadedMediaObjectResponseBodyMediaType
readonly
Type of media.
-
#start_time ⇒ Object
readonly
2015-09-15T14:00:12-04:00).
-
#trigger_reason ⇒ Object
readonly
videoRetrieval. - #url_info ⇒ Samsara::Types::UrlInfoObjectResponseBody readonly
-
#vehicle_id ⇒ String
readonly
Vehicle ID for which this media was captured.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::UploadedMediaObjectResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(available_at_time:, end_time:, input:, media_type:, start_time:, trigger_reason:, url_info: OMIT, vehicle_id:, additional_properties: nil) ⇒ Samsara::Types::UploadedMediaObjectResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(available_at_time:, end_time:, input:, media_type:, start_time:, trigger_reason:, url_info: OMIT, vehicle_id:, additional_properties: nil) ⇒ Samsara::Types::UploadedMediaObjectResponseBody
64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/samsara_api/types/uploaded_media_object_response_body.rb', line 64 def initialize(available_at_time:, end_time:, input:, media_type:, start_time:, trigger_reason:, url_info: OMIT, vehicle_id:, additional_properties: nil) @available_at_time = available_at_time @end_time = end_time @input = input @media_type = media_type @start_time = start_time @trigger_reason = trigger_reason @url_info = url_info if url_info != OMIT @vehicle_id = vehicle_id @additional_properties = additional_properties @_field_set = { "availableAtTime": available_at_time, "endTime": end_time, "input": input, "mediaType": media_type, "startTime": start_time, "triggerReason": trigger_reason, "urlInfo": url_info, "vehicleId": vehicle_id }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
38 39 40 |
# File 'lib/samsara_api/types/uploaded_media_object_response_body.rb', line 38 def additional_properties @additional_properties end |
#available_at_time ⇒ Object (readonly)
2015-09-15T14:00:12-04:00
15 16 17 |
# File 'lib/samsara_api/types/uploaded_media_object_response_body.rb', line 15 def available_at_time @available_at_time end |
#end_time ⇒ Object (readonly)
2015-09-15T14:00:12-04:00).
19 20 21 |
# File 'lib/samsara_api/types/uploaded_media_object_response_body.rb', line 19 def end_time @end_time end |
#input ⇒ Object (readonly)
dashcamInwardFacing, analog1
22 23 24 |
# File 'lib/samsara_api/types/uploaded_media_object_response_body.rb', line 22 def input @input end |
#media_type ⇒ Samsara::Types::UploadedMediaObjectResponseBodyMediaType (readonly)
Returns Type of media. Valid values: image, video.
24 25 26 |
# File 'lib/samsara_api/types/uploaded_media_object_response_body.rb', line 24 def media_type @media_type end |
#start_time ⇒ Object (readonly)
2015-09-15T14:00:12-04:00).
28 29 30 |
# File 'lib/samsara_api/types/uploaded_media_object_response_body.rb', line 28 def start_time @start_time end |
#trigger_reason ⇒ Object (readonly)
videoRetrieval
32 33 34 |
# File 'lib/samsara_api/types/uploaded_media_object_response_body.rb', line 32 def trigger_reason @trigger_reason end |
#url_info ⇒ Samsara::Types::UrlInfoObjectResponseBody (readonly)
34 35 36 |
# File 'lib/samsara_api/types/uploaded_media_object_response_body.rb', line 34 def url_info @url_info end |
#vehicle_id ⇒ String (readonly)
Returns Vehicle ID for which this media was captured. Examples: 1234.
36 37 38 |
# File 'lib/samsara_api/types/uploaded_media_object_response_body.rb', line 36 def vehicle_id @vehicle_id end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::UploadedMediaObjectResponseBody
82 83 84 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 |
# File 'lib/samsara_api/types/uploaded_media_object_response_body.rb', line 82 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) available_at_time = parsed_json["availableAtTime"] end_time = parsed_json["endTime"] input = parsed_json["input"] media_type = parsed_json["mediaType"] start_time = parsed_json["startTime"] trigger_reason = parsed_json["triggerReason"] unless parsed_json["urlInfo"].nil? url_info = parsed_json["urlInfo"].to_json url_info = Samsara::Types::UrlInfoObjectResponseBody.from_json(json_object: url_info) else url_info = nil end vehicle_id = parsed_json["vehicleId"] new( available_at_time: available_at_time, end_time: end_time, input: input, media_type: media_type, start_time: start_time, trigger_reason: trigger_reason, url_info: url_info, vehicle_id: vehicle_id, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
122 123 124 125 126 127 128 129 130 131 |
# File 'lib/samsara_api/types/uploaded_media_object_response_body.rb', line 122 def self.validate_raw(obj:) obj.available_at_time.is_a?(String) != false || raise("Passed value for field obj.available_at_time is not the expected type, validation failed.") obj.end_time.is_a?(String) != false || raise("Passed value for field obj.end_time is not the expected type, validation failed.") obj.input.is_a?(Samsara::Types::UploadedMediaObjectResponseBodyInput) != false || raise("Passed value for field obj.input is not the expected type, validation failed.") obj.media_type.is_a?(Samsara::Types::UploadedMediaObjectResponseBodyMediaType) != false || raise("Passed value for field obj.media_type is not the expected type, validation failed.") obj.start_time.is_a?(String) != false || raise("Passed value for field obj.start_time is not the expected type, validation failed.") obj.trigger_reason.is_a?(Samsara::Types::UploadedMediaObjectResponseBodyTriggerReason) != false || raise("Passed value for field obj.trigger_reason is not the expected type, validation failed.") obj.url_info.nil? || Samsara::Types::UrlInfoObjectResponseBody.validate_raw(obj: obj.url_info) obj.vehicle_id.is_a?(String) != false || raise("Passed value for field obj.vehicle_id is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
113 114 115 |
# File 'lib/samsara_api/types/uploaded_media_object_response_body.rb', line 113 def to_json @_field_set&.to_json end |