Class: Samsara::Types::VehicleStatsNfcCardScan

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

Overview

Data for the nfc card and the time that it was scanned.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(card:, time:, additional_properties: nil) ⇒ Samsara::Types::VehicleStatsNfcCardScan

Parameters:



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

def initialize(card:, time:, additional_properties: nil)
  @card = card
  @time = time
  @additional_properties = additional_properties
  @_field_set = { "card": card, "time": time }
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



15
16
17
# File 'lib/samsara_api/types/vehicle_stats_nfc_card_scan.rb', line 15

def additional_properties
  @additional_properties
end

#card ⇒ Samsara::Types::VehicleStatsNfcCardScanCard (readonly)



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

def card
  @card
end

#time ⇒ String (readonly)

Returns:

  • (String)


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

def time
  @time
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/samsara_api/types/vehicle_stats_nfc_card_scan.rb', line 36

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  unless parsed_json["card"].nil?
    card = parsed_json["card"].to_json
    card = Samsara::Types::VehicleStatsNfcCardScanCard.from_json(json_object: card)
  else
    card = nil
  end
  time = parsed_json["time"]
  new(
    card: card,
    time: time,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


64
65
66
67
# File 'lib/samsara_api/types/vehicle_stats_nfc_card_scan.rb', line 64

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

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


55
56
57
# File 'lib/samsara_api/types/vehicle_stats_nfc_card_scan.rb', line 55

def to_json
  @_field_set&.to_json
end