Class: Samsara::Types::VehicleStatsNfcCardScanCard

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

Overview

The card that was scanned.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Parameters:

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

    The id code of the card that was scanned.

  • 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/vehicle_stats_nfc_card_scan_card.rb', line 22

def initialize(id: OMIT, additional_properties: nil)
  @id = id if id != OMIT
  @additional_properties = additional_properties
  @_field_set = { "id": id }.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/vehicle_stats_nfc_card_scan_card.rb', line 12

def additional_properties
  @additional_properties
end

#id ⇒ String (readonly)

Returns The id code of the card that was scanned.

Returns:

  • (String) —

    The id code of the card that was scanned.



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

def id
  @id
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



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

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

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

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

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


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

def to_json
  @_field_set&.to_json
end