Class: Samsara::Types::GaseousFuelCostObjectResponseBody

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

Overview

The cost incurred based on the gaseous fuel consumed during the idling event.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(amount:, currency:, additional_properties: nil) ⇒ Samsara::Types::GaseousFuelCostObjectResponseBody

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



28
29
30
31
32
33
# File 'lib/samsara_api/types/gaseous_fuel_cost_object_response_body.rb', line 28

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



16
17
18
# File 'lib/samsara_api/types/gaseous_fuel_cost_object_response_body.rb', line 16

def additional_properties
  @additional_properties
end

#amountString (readonly)

Returns The money amount.

Returns:

  • (String)

    The money amount.



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

def amount
  @amount
end

#currencyObject (readonly)

‘usd`, `gbp`, `cad`, `eur`, `chf`, `mxn`



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

def currency
  @currency
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



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

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

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


61
62
63
64
# File 'lib/samsara_api/types/gaseous_fuel_cost_object_response_body.rb', line 61

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

Instance Method Details

#to_jsonString

Returns:

  • (String)


52
53
54
# File 'lib/samsara_api/types/gaseous_fuel_cost_object_response_body.rb', line 52

def to_json
  @_field_set&.to_json
end