Class: Samsara::Types::PostFuelPurchaseRequestBodyPriceRequestBody
- Inherits:
-
Object
- Object
- Samsara::Types::PostFuelPurchaseRequestBodyPriceRequestBody
- Defined in:
- lib/samsara_api/types/post_fuel_purchase_request_body_price_request_body.rb
Overview
transaction occurred.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#amount ⇒ String
readonly
The money amount.
-
#currency ⇒ Object
readonly
‘usd`, `gbp`, `cad`, `eur`, `chf`, `mxn`.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::PostFuelPurchaseRequestBodyPriceRequestBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(amount:, currency:, additional_properties: nil) ⇒ Samsara::Types::PostFuelPurchaseRequestBodyPriceRequestBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(amount:, currency:, additional_properties: nil) ⇒ Samsara::Types::PostFuelPurchaseRequestBodyPriceRequestBody
29 30 31 32 33 34 |
# File 'lib/samsara_api/types/post_fuel_purchase_request_body_price_request_body.rb', line 29 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_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
17 18 19 |
# File 'lib/samsara_api/types/post_fuel_purchase_request_body_price_request_body.rb', line 17 def additional_properties @additional_properties end |
#amount ⇒ String (readonly)
Returns The money amount.
12 13 14 |
# File 'lib/samsara_api/types/post_fuel_purchase_request_body_price_request_body.rb', line 12 def amount @amount end |
#currency ⇒ Object (readonly)
‘usd`, `gbp`, `cad`, `eur`, `chf`, `mxn`
15 16 17 |
# File 'lib/samsara_api/types/post_fuel_purchase_request_body_price_request_body.rb', line 15 def currency @currency end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::PostFuelPurchaseRequestBodyPriceRequestBody
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/samsara_api/types/post_fuel_purchase_request_body_price_request_body.rb', line 40 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
64 65 66 67 |
# File 'lib/samsara_api/types/post_fuel_purchase_request_body_price_request_body.rb', line 64 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::PostFuelPurchaseRequestBodyPriceRequestBodyCurrency) != false || raise("Passed value for field obj.currency is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
55 56 57 |
# File 'lib/samsara_api/types/post_fuel_purchase_request_body_price_request_body.rb', line 55 def to_json @_field_set&.to_json end |