Class: Samsara::Types::AccessoryResponseObjectResponseBody

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

Overview

An object containing information about an accessory connected to the VG.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model: OMIT, serial: OMIT, additional_properties: nil) ⇒ Samsara::Types::AccessoryResponseObjectResponseBody

Parameters:

  • model (String) (defaults to: OMIT)

    Product model name of the device

  • serial (String) (defaults to: OMIT)

    The serial number of the accessory device.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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

def initialize(model: OMIT, serial: OMIT, additional_properties: nil)
  @model = model if model != OMIT
  @serial = serial if serial != OMIT
  @additional_properties = additional_properties
  @_field_set = { "model": model, "serial": serial }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



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

def additional_properties
  @additional_properties
end

#modelString (readonly)

Returns Product model name of the device.

Returns:

  • (String)

    Product model name of the device



10
11
12
# File 'lib/samsara_api/types/accessory_response_object_response_body.rb', line 10

def model
  @model
end

#serialString (readonly)

Returns The serial number of the accessory device.

Returns:

  • (String)

    The serial number of the accessory device.



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

def serial
  @serial
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



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

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

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


60
61
62
63
# File 'lib/samsara_api/types/accessory_response_object_response_body.rb', line 60

def self.validate_raw(obj:)
  obj.model&.is_a?(String) != false || raise("Passed value for field obj.model is not the expected type, validation failed.")
  obj.serial&.is_a?(String) != false || raise("Passed value for field obj.serial is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


51
52
53
# File 'lib/samsara_api/types/accessory_response_object_response_body.rb', line 51

def to_json
  @_field_set&.to_json
end