Class: Samsara::Types::WorkflowAuthorSignatureObjectResponseBody

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

Overview

An author signature for DVIRs with a signed time.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(signatory_user:, signed_at_time:, type:, additional_properties: nil) ⇒ Samsara::Types::WorkflowAuthorSignatureObjectResponseBody

Parameters:

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

    Additional properties unmapped to the current class definition



32
33
34
35
36
37
38
# File 'lib/samsara_api/types/workflow_author_signature_object_response_body.rb', line 32

def initialize(signatory_user:, signed_at_time:, type:, additional_properties: nil)
  @signatory_user = signatory_user
  @signed_at_time = signed_at_time
  @type = type
  @additional_properties = additional_properties
  @_field_set = { "signatoryUser": signatory_user, "signedAtTime": signed_at_time, "type": type }
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



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

def additional_properties
  @additional_properties
end

#signatory_user ⇒ Samsara::Types::WorkflowSignatoryUserObjectResponseBody (readonly)



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

def signatory_user
  @signatory_user
end

#signed_at_time ⇒ String (readonly)

Returns The time when the DVIR was signed. UTC timestamp in RFC 3339 format.

Returns:

  • (String) —

    The time when the DVIR was signed. UTC timestamp in RFC 3339 format.



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

def signed_at_time
  @signed_at_time
end

#type ⇒ Object (readonly)

mechanic



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

def type
  @type
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/samsara_api/types/workflow_author_signature_object_response_body.rb', line 44

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  unless parsed_json["signatoryUser"].nil?
    signatory_user = parsed_json["signatoryUser"].to_json
    signatory_user = Samsara::Types::WorkflowSignatoryUserObjectResponseBody.from_json(json_object: signatory_user)
  else
    signatory_user = nil
  end
  signed_at_time = parsed_json["signedAtTime"]
  type = parsed_json["type"]
  new(
    signatory_user: signatory_user,
    signed_at_time: signed_at_time,
    type: type,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


75
76
77
78
79
# File 'lib/samsara_api/types/workflow_author_signature_object_response_body.rb', line 75

def self.validate_raw(obj:)
  Samsara::Types::WorkflowSignatoryUserObjectResponseBody.validate_raw(obj: obj.signatory_user)
  obj.signed_at_time.is_a?(String) != false || raise("Passed value for field obj.signed_at_time is not the expected type, validation failed.")
  obj.type.is_a?(Samsara::Types::WorkflowAuthorSignatureObjectResponseBodyType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


66
67
68
# File 'lib/samsara_api/types/workflow_author_signature_object_response_body.rb', line 66

def to_json
  @_field_set&.to_json
end