Class: Samsara::Types::FormsPolymorphicUserObjectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::FormsPolymorphicUserObjectResponseBody
- Defined in:
- lib/samsara_api/types/forms_polymorphic_user_object_response_body.rb
Overview
User or driver object.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#id ⇒ String
readonly
ID of the polymorphic user.
-
#type ⇒ Samsara::Types::FormsPolymorphicUserObjectResponseBodyType
readonly
The type of the polymorphic user.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::FormsPolymorphicUserObjectResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(id:, type:, additional_properties: nil) ⇒ Samsara::Types::FormsPolymorphicUserObjectResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(id:, type:, additional_properties: nil) ⇒ Samsara::Types::FormsPolymorphicUserObjectResponseBody
26 27 28 29 30 31 |
# File 'lib/samsara_api/types/forms_polymorphic_user_object_response_body.rb', line 26 def initialize(id:, type:, additional_properties: nil) @id = id @type = type @additional_properties = additional_properties @_field_set = { "id": id, "type": type } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
15 16 17 |
# File 'lib/samsara_api/types/forms_polymorphic_user_object_response_body.rb', line 15 def additional_properties @additional_properties end |
#id ⇒ String (readonly)
Returns ID of the polymorphic user.
11 12 13 |
# File 'lib/samsara_api/types/forms_polymorphic_user_object_response_body.rb', line 11 def id @id end |
#type ⇒ Samsara::Types::FormsPolymorphicUserObjectResponseBodyType (readonly)
Returns The type of the polymorphic user. Valid values: ‘driver`, `user`.
13 14 15 |
# File 'lib/samsara_api/types/forms_polymorphic_user_object_response_body.rb', line 13 def type @type end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::FormsPolymorphicUserObjectResponseBody
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/samsara_api/types/forms_polymorphic_user_object_response_body.rb', line 37 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] type = parsed_json["type"] new( id: id, type: type, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
60 61 62 63 |
# File 'lib/samsara_api/types/forms_polymorphic_user_object_response_body.rb', line 60 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.") obj.type.is_a?(Samsara::Types::FormsPolymorphicUserObjectResponseBodyType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
51 52 53 |
# File 'lib/samsara_api/types/forms_polymorphic_user_object_response_body.rb', line 51 def to_json @_field_set&.to_json end |