Class: Samsara::Types::UserResponse
- Inherits:
-
Object
- Object
- Samsara::Types::UserResponse
- Defined in:
- lib/samsara_api/types/user_response.rb
Overview
A single user.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #data ⇒ Samsara::Types::User readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(data: OMIT, additional_properties: nil) ⇒ Samsara::Types::UserResponse constructor
- #to_json ⇒ String
Constructor Details
#initialize(data: OMIT, additional_properties: nil) ⇒ Samsara::Types::UserResponse
23 24 25 26 27 28 29 |
# File 'lib/samsara_api/types/user_response.rb', line 23 def initialize(data: OMIT, additional_properties: nil) @data = data if data != OMIT @additional_properties = additional_properties @_field_set = { "data": data }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
13 14 15 |
# File 'lib/samsara_api/types/user_response.rb', line 13 def additional_properties @additional_properties end |
#data ⇒ Samsara::Types::User (readonly)
11 12 13 |
# File 'lib/samsara_api/types/user_response.rb', line 11 def data @data end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::UserResponse
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/samsara_api/types/user_response.rb', line 34 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) unless parsed_json["data"].nil? data = parsed_json["data"].to_json data = Samsara::Types::User.from_json(json_object: data) else data = nil end new(data: data, additional_properties: struct) end |
.validate_raw(obj:) ⇒ Void
57 58 59 |
# File 'lib/samsara_api/types/user_response.rb', line 57 def self.validate_raw(obj:) obj.data.nil? || Samsara::Types::User.validate_raw(obj: obj.data) end |
Instance Method Details
#to_json ⇒ String
48 49 50 |
# File 'lib/samsara_api/types/user_response.rb', line 48 def to_json @_field_set&.to_json end |