Class: Samsara::Types::BarcodeValueObjectResponseBody

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(barcode_type: OMIT, barcode_value: OMIT, additional_properties: nil) ⇒ Samsara::Types::BarcodeValueObjectResponseBody

Parameters:

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

    The barcode type that was scanned.

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

    The captured barcode value.

  • 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/barcode_value_object_response_body.rb', line 24

def initialize(barcode_type: OMIT, barcode_value: OMIT, additional_properties: nil)
  @barcode_type = barcode_type if barcode_type != OMIT
  @barcode_value = barcode_value if barcode_value != OMIT
  @additional_properties = additional_properties
  @_field_set = { "barcodeType": barcode_type, "barcodeValue": barcode_value }.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/barcode_value_object_response_body.rb', line 13

def additional_properties
  @additional_properties
end

#barcode_type ⇒ String (readonly)

Returns The barcode type that was scanned.

Returns:

  • (String) —

    The barcode type that was scanned.



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

def barcode_type
  @barcode_type
end

#barcode_value ⇒ String (readonly)

Returns The captured barcode value.

Returns:

  • (String) —

    The captured barcode value.



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

def barcode_value
  @barcode_value
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



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

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  barcode_type = parsed_json["barcodeType"]
  barcode_value = parsed_json["barcodeValue"]
  new(
    barcode_type: barcode_type,
    barcode_value: barcode_value,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

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

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


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

def to_json
  @_field_set&.to_json
end