Class: Samsara::Types::SignatureValueObjectResponseBody

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

Overview

The value of a signature field. Only present for signature fields.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: OMIT, name: OMIT, signed_at_time: OMIT, url: OMIT, additional_properties: nil) ⇒ Samsara::Types::SignatureValueObjectResponseBody

Parameters:

  • id (String) (defaults to: OMIT) —

    Id of the signature field.

  • name (String) (defaults to: OMIT) —

    Name of the signee for a signature field.

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

    Time the signature was captured in RFC 3339 format.

  • url (String) (defaults to: OMIT) —

    Url of a signature field's PNG signature image.

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

    Additional properties unmapped to the current class definition



32
33
34
35
36
37
38
39
40
41
# File 'lib/samsara_api/types/signature_value_object_response_body.rb', line 32

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



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

def additional_properties
  @additional_properties
end

#id ⇒ String (readonly)

Returns Id of the signature field.

Returns:

  • (String) —

    Id of the signature field.



11
12
13
# File 'lib/samsara_api/types/signature_value_object_response_body.rb', line 11

def id
  @id
end

#name ⇒ String (readonly)

Returns Name of the signee for a signature field.

Returns:

  • (String) —

    Name of the signee for a signature field.



13
14
15
# File 'lib/samsara_api/types/signature_value_object_response_body.rb', line 13

def name
  @name
end

#signed_at_time ⇒ DateTime (readonly)

Returns Time the signature was captured in RFC 3339 format.

Returns:

  • (DateTime) —

    Time the signature was captured in RFC 3339 format.



15
16
17
# File 'lib/samsara_api/types/signature_value_object_response_body.rb', line 15

def signed_at_time
  @signed_at_time
end

#url ⇒ String (readonly)

Returns Url of a signature field's PNG signature image.

Returns:

  • (String) —

    Url of a signature field's PNG signature image.



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

def url
  @url
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/samsara_api/types/signature_value_object_response_body.rb', line 46

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

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


77
78
79
80
81
82
# File 'lib/samsara_api/types/signature_value_object_response_body.rb', line 77

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.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.signed_at_time&.is_a?(DateTime) != false || raise("Passed value for field obj.signed_at_time 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.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


68
69
70
# File 'lib/samsara_api/types/signature_value_object_response_body.rb', line 68

def to_json
  @_field_set&.to_json
end