Class: TrophyApiClient::NotificationPreferences
- Inherits:
-
Object
- Object
- TrophyApiClient::NotificationPreferences
- Defined in:
- lib/trophy_api_client/types/notification_preferences.rb
Overview
Notification preferences for each notification type.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#achievement_completed ⇒ Array<TrophyApiClient::NotificationChannel>
readonly
Channels to receive achievement completion notifications on.
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#reactivation ⇒ Array<TrophyApiClient::NotificationChannel>
readonly
Channels to receive reactivation notifications on.
-
#recap ⇒ Array<TrophyApiClient::NotificationChannel>
readonly
Channels to receive recap notifications on.
-
#streak_reminder ⇒ Array<TrophyApiClient::NotificationChannel>
readonly
Channels to receive streak reminder notifications on.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ TrophyApiClient::NotificationPreferences
Deserialize a JSON object to an instance of NotificationPreferences.
-
.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.
Instance Method Summary collapse
- #initialize(achievement_completed: OMIT, recap: OMIT, reactivation: OMIT, streak_reminder: OMIT, additional_properties: nil) ⇒ TrophyApiClient::NotificationPreferences constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of NotificationPreferences to a JSON object.
Constructor Details
#initialize(achievement_completed: OMIT, recap: OMIT, reactivation: OMIT, streak_reminder: OMIT, additional_properties: nil) ⇒ TrophyApiClient::NotificationPreferences
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/trophy_api_client/types/notification_preferences.rb', line 32 def initialize(achievement_completed: OMIT, recap: OMIT, reactivation: OMIT, streak_reminder: OMIT, additional_properties: nil) @achievement_completed = achievement_completed if achievement_completed != OMIT @recap = recap if recap != OMIT @reactivation = reactivation if reactivation != OMIT @streak_reminder = streak_reminder if streak_reminder != OMIT @additional_properties = additional_properties @_field_set = { "achievement_completed": achievement_completed, "recap": recap, "reactivation": reactivation, "streak_reminder": streak_reminder }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#achievement_completed ⇒ Array<TrophyApiClient::NotificationChannel> (readonly)
Returns Channels to receive achievement completion notifications on.
11 12 13 |
# File 'lib/trophy_api_client/types/notification_preferences.rb', line 11 def achievement_completed @achievement_completed end |
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
19 20 21 |
# File 'lib/trophy_api_client/types/notification_preferences.rb', line 19 def additional_properties @additional_properties end |
#reactivation ⇒ Array<TrophyApiClient::NotificationChannel> (readonly)
Returns Channels to receive reactivation notifications on.
15 16 17 |
# File 'lib/trophy_api_client/types/notification_preferences.rb', line 15 def reactivation @reactivation end |
#recap ⇒ Array<TrophyApiClient::NotificationChannel> (readonly)
Returns Channels to receive recap notifications on.
13 14 15 |
# File 'lib/trophy_api_client/types/notification_preferences.rb', line 13 def recap @recap end |
#streak_reminder ⇒ Array<TrophyApiClient::NotificationChannel> (readonly)
Returns Channels to receive streak reminder notifications on.
17 18 19 |
# File 'lib/trophy_api_client/types/notification_preferences.rb', line 17 def streak_reminder @streak_reminder end |
Class Method Details
.from_json(json_object:) ⇒ TrophyApiClient::NotificationPreferences
Deserialize a JSON object to an instance of NotificationPreferences
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/trophy_api_client/types/notification_preferences.rb', line 53 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) achievement_completed = parsed_json["achievement_completed"] recap = parsed_json["recap"] reactivation = parsed_json["reactivation"] streak_reminder = parsed_json["streak_reminder"] new( achievement_completed: achievement_completed, recap: recap, reactivation: reactivation, streak_reminder: streak_reminder, 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.
82 83 84 85 86 87 |
# File 'lib/trophy_api_client/types/notification_preferences.rb', line 82 def self.validate_raw(obj:) obj.achievement_completed&.is_a?(Array) != false || raise("Passed value for field obj.achievement_completed is not the expected type, validation failed.") obj.recap&.is_a?(Array) != false || raise("Passed value for field obj.recap is not the expected type, validation failed.") obj.reactivation&.is_a?(Array) != false || raise("Passed value for field obj.reactivation is not the expected type, validation failed.") obj.streak_reminder&.is_a?(Array) != false || raise("Passed value for field obj.streak_reminder is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of NotificationPreferences to a JSON object
72 73 74 |
# File 'lib/trophy_api_client/types/notification_preferences.rb', line 72 def to_json(*_args) @_field_set&.to_json end |