Class: Samsara::Types::UserTinyResponse
- Inherits:
-
Object
- Object
- Samsara::Types::UserTinyResponse
- Defined in:
- lib/samsara_api/types/user_tiny_response.rb
Overview
A minified user 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 user.
-
#name ⇒ String
readonly
Name of the user.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(id: OMIT, name: OMIT, additional_properties: nil) ⇒ Samsara::Types::UserTinyResponse constructor
- #to_json ⇒ String
Constructor Details
#initialize(id: OMIT, name: OMIT, additional_properties: nil) ⇒ Samsara::Types::UserTinyResponse
25 26 27 28 29 30 31 32 |
# File 'lib/samsara_api/types/user_tiny_response.rb', line 25 def initialize(id: OMIT, name: OMIT, additional_properties: nil) @id = id if id != OMIT @name = name if name != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "name": name }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
14 15 16 |
# File 'lib/samsara_api/types/user_tiny_response.rb', line 14 def additional_properties @additional_properties end |
#id ⇒ String (readonly)
Returns ID of the user.
10 11 12 |
# File 'lib/samsara_api/types/user_tiny_response.rb', line 10 def id @id end |
#name ⇒ String (readonly)
Returns Name of the user.
12 13 14 |
# File 'lib/samsara_api/types/user_tiny_response.rb', line 12 def name @name end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::UserTinyResponse
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/samsara_api/types/user_tiny_response.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"] name = parsed_json["name"] new( id: id, name: name, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
60 61 62 63 |
# File 'lib/samsara_api/types/user_tiny_response.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.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
51 52 53 |
# File 'lib/samsara_api/types/user_tiny_response.rb', line 51 def to_json @_field_set&.to_json end |