Class: Samsara::Types::AlertObjectProductResponseBody

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

Overview

The product associated with the alert

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(short_name: OMIT, additional_properties: nil) ⇒ Samsara::Types::AlertObjectProductResponseBody

Parameters:

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

    The short name associated with the product.

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

    Additional properties unmapped to the current class definition



22
23
24
25
26
27
28
# File 'lib/samsara_api/types/alert_object_product_response_body.rb', line 22

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



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

def additional_properties
  @additional_properties
end

#short_name ⇒ String (readonly)

Returns The short name associated with the product.

Returns:

  • (String) —

    The short name associated with the product.



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

def short_name
  @short_name
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



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

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

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

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

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


42
43
44
# File 'lib/samsara_api/types/alert_object_product_response_body.rb', line 42

def to_json
  @_field_set&.to_json
end