Class: Samsara::Types::DvirAuthorSignature
- Inherits:
-
Object
- Object
- Samsara::Types::DvirAuthorSignature
- Defined in:
- lib/samsara_api/types/dvir_author_signature.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #signatory_user ⇒ Samsara::Types::DvirSignatureSignatoryUser readonly
-
#signed_at_time ⇒ Object
readonly
‘2020-01-27T07:06:25Z`.
-
#type ⇒ Object
readonly
‘driver`, `mechanic`.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(signatory_user: OMIT, signed_at_time: OMIT, type: OMIT, additional_properties: nil) ⇒ Samsara::Types::DvirAuthorSignature constructor
- #to_json ⇒ String
Constructor Details
#initialize(signatory_user: OMIT, signed_at_time: OMIT, type: OMIT, additional_properties: nil) ⇒ Samsara::Types::DvirAuthorSignature
33 34 35 36 37 38 39 40 41 |
# File 'lib/samsara_api/types/dvir_author_signature.rb', line 33 def initialize(signatory_user: OMIT, signed_at_time: OMIT, type: OMIT, additional_properties: nil) @signatory_user = signatory_user if signatory_user != OMIT @signed_at_time = signed_at_time if signed_at_time != OMIT @type = type if type != OMIT @additional_properties = additional_properties @_field_set = { "signatoryUser": signatory_user, "signedAtTime": signed_at_time, "type": type }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
19 20 21 |
# File 'lib/samsara_api/types/dvir_author_signature.rb', line 19 def additional_properties @additional_properties end |
#signatory_user ⇒ Samsara::Types::DvirSignatureSignatoryUser (readonly)
11 12 13 |
# File 'lib/samsara_api/types/dvir_author_signature.rb', line 11 def signatory_user @signatory_user end |
#signed_at_time ⇒ Object (readonly)
‘2020-01-27T07:06:25Z`.
14 15 16 |
# File 'lib/samsara_api/types/dvir_author_signature.rb', line 14 def signed_at_time @signed_at_time end |
#type ⇒ Object (readonly)
‘driver`, `mechanic`.
17 18 19 |
# File 'lib/samsara_api/types/dvir_author_signature.rb', line 17 def type @type end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::DvirAuthorSignature
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/samsara_api/types/dvir_author_signature.rb', line 46 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::DvirSignatureSignatoryUser.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
76 77 78 79 80 |
# File 'lib/samsara_api/types/dvir_author_signature.rb', line 76 def self.validate_raw(obj:) obj.signatory_user.nil? || Samsara::Types::DvirSignatureSignatoryUser.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::DvirSignatureType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
67 68 69 |
# File 'lib/samsara_api/types/dvir_author_signature.rb', line 67 def to_json @_field_set&.to_json end |