Class: Samsara::Types::WorkOrderAttachmentObjectResponseBody

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

Overview

Work Order Attachment object.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, processing_status:, url: OMIT, url_expires_at: OMIT, additional_properties: nil) ⇒ Samsara::Types::WorkOrderAttachmentObjectResponseBody

Parameters:

  • url_expires_at (DateTime) (defaults to: OMIT) —

    Expiration time of the media record 'url'. UTC timestamp in RFC 3339 format.

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

    Additional properties unmapped to the current class definition



35
36
37
38
39
40
41
42
43
44
# File 'lib/samsara_api/types/work_order_attachment_object_response_body.rb', line 35

def initialize(id:, processing_status:, url: OMIT, url_expires_at: OMIT, additional_properties: nil)
  @id = id
  @processing_status = processing_status
  @url = url if url != OMIT
  @url_expires_at = url_expires_at if url_expires_at != OMIT
  @additional_properties = additional_properties
  @_field_set = { "id": id, "processingStatus": processing_status, "url": url, "urlExpiresAt": url_expires_at }.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



21
22
23
# File 'lib/samsara_api/types/work_order_attachment_object_response_body.rb', line 21

def additional_properties
  @additional_properties
end

#id ⇒ String (readonly)

Returns ID of the media record.

Returns:

  • (String) —

    ID of the media record.



12
13
14
# File 'lib/samsara_api/types/work_order_attachment_object_response_body.rb', line 12

def id
  @id
end

#processing_status ⇒ Samsara::Types::WorkOrderAttachmentObjectResponseBodyProcessingStatus (readonly)

Returns Status of the media record. Valid values: unknown, processing, finished.

Returns:



14
15
16
# File 'lib/samsara_api/types/work_order_attachment_object_response_body.rb', line 14

def processing_status
  @processing_status
end

#url ⇒ Object (readonly)

'processingStatus' is 'finished'.



17
18
19
# File 'lib/samsara_api/types/work_order_attachment_object_response_body.rb', line 17

def url
  @url
end

#url_expires_at ⇒ DateTime (readonly)

Returns Expiration time of the media record 'url'. UTC timestamp in RFC 3339 format.

Returns:

  • (DateTime) —

    Expiration time of the media record 'url'. UTC timestamp in RFC 3339 format.



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

def url_expires_at
  @url_expires_at
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/samsara_api/types/work_order_attachment_object_response_body.rb', line 50

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  processing_status = parsed_json["processingStatus"]
  url = parsed_json["url"]
  url_expires_at = unless parsed_json["urlExpiresAt"].nil?
  DateTime.parse(parsed_json["urlExpiresAt"])
else
  nil
end
  new(
    id: id,
    processing_status: processing_status,
    url: url,
    url_expires_at: url_expires_at,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


81
82
83
84
85
86
# File 'lib/samsara_api/types/work_order_attachment_object_response_body.rb', line 81

def self.validate_raw(obj:)
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.processing_status.is_a?(Samsara::Types::WorkOrderAttachmentObjectResponseBodyProcessingStatus) != false || raise("Passed value for field obj.processing_status is not the expected type, validation failed.")
  obj.url&.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.")
  obj.url_expires_at&.is_a?(DateTime) != false || raise("Passed value for field obj.url_expires_at is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


72
73
74
# File 'lib/samsara_api/types/work_order_attachment_object_response_body.rb', line 72

def to_json
  @_field_set&.to_json
end