Class: Samsara::Types::PhotoValueObjectRequestBody

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: OMIT, url: OMIT, additional_properties: nil) ⇒ Samsara::Types::PhotoValueObjectRequestBody

Parameters:

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

    Id of the photo.

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

    Url of the photo.

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

    Additional properties unmapped to the current class definition



24
25
26
27
28
29
30
31
# File 'lib/samsara_api/types/photo_value_object_request_body.rb', line 24

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



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

def additional_properties
  @additional_properties
end

#id ⇒ String (readonly)

Returns Id of the photo.

Returns:

  • (String) —

    Id of the photo.



9
10
11
# File 'lib/samsara_api/types/photo_value_object_request_body.rb', line 9

def id
  @id
end

#url ⇒ String (readonly)

Returns Url of the photo.

Returns:

  • (String) —

    Url of the photo.



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

def url
  @url
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



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

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  url = parsed_json["url"]
  new(
    id: id,
    url: url,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


59
60
61
62
# File 'lib/samsara_api/types/photo_value_object_request_body.rb', line 59

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.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)


50
51
52
# File 'lib/samsara_api/types/photo_value_object_request_body.rb', line 50

def to_json
  @_field_set&.to_json
end