Class: TrophyApiClient::UserPreferencesResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/trophy_api_client/types/user_preferences_response.rb

Overview

A user’s preferences.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(notifications:, additional_properties: nil) ⇒ TrophyApiClient::UserPreferencesResponse

Parameters:



23
24
25
26
27
# File 'lib/trophy_api_client/types/user_preferences_response.rb', line 23

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



13
14
15
# File 'lib/trophy_api_client/types/user_preferences_response.rb', line 13

def additional_properties
  @additional_properties
end

#notificationsTrophyApiClient::NotificationPreferences (readonly)



11
12
13
# File 'lib/trophy_api_client/types/user_preferences_response.rb', line 11

def notifications
  @notifications
end

Class Method Details

.from_json(json_object:) ⇒ TrophyApiClient::UserPreferencesResponse

Deserialize a JSON object to an instance of UserPreferencesResponse

Parameters:

  • json_object (String)

Returns:



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/trophy_api_client/types/user_preferences_response.rb', line 33

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  if parsed_json["notifications"].nil?
    notifications = nil
  else
    notifications = parsed_json["notifications"].to_json
    notifications = TrophyApiClient::NotificationPreferences.from_json(json_object: notifications)
  end
  new(notifications: notifications, additional_properties: struct)
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


58
59
60
# File 'lib/trophy_api_client/types/user_preferences_response.rb', line 58

def self.validate_raw(obj:)
  TrophyApiClient::NotificationPreferences.validate_raw(obj: obj.notifications)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of UserPreferencesResponse to a JSON object

Returns:

  • (String)


48
49
50
# File 'lib/trophy_api_client/types/user_preferences_response.rb', line 48

def to_json(*_args)
  @_field_set&.to_json
end