Class: Courier::Send::IProfilePreferences
- Inherits:
-
Object
- Object
- Courier::Send::IProfilePreferences
- Defined in:
- lib/trycourier/send/types/i_profile_preferences.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#notifications ⇒ Object
readonly
Returns the value of attribute notifications.
-
#template_id ⇒ Object
readonly
Returns the value of attribute template_id.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Send::IProfilePreferences
Deserialize a JSON object to an instance of IProfilePreferences.
-
.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(notifications:, categories: nil, template_id: nil, additional_properties: nil) ⇒ Send::IProfilePreferences constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of IProfilePreferences to a JSON object.
Constructor Details
#initialize(notifications:, categories: nil, template_id: nil, additional_properties: nil) ⇒ Send::IProfilePreferences
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/trycourier/send/types/i_profile_preferences.rb', line 16 def initialize(notifications:, categories: nil, template_id: nil, additional_properties: nil) # @type [Send::I_PREFERENCES] @categories = categories # @type [Send::I_PREFERENCES] @notifications = notifications # @type [String] @template_id = template_id # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end |
Instance Attribute Details
#additional_properties ⇒ Object (readonly)
Returns the value of attribute additional_properties.
9 10 11 |
# File 'lib/trycourier/send/types/i_profile_preferences.rb', line 9 def additional_properties @additional_properties end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
9 10 11 |
# File 'lib/trycourier/send/types/i_profile_preferences.rb', line 9 def categories @categories end |
#notifications ⇒ Object (readonly)
Returns the value of attribute notifications.
9 10 11 |
# File 'lib/trycourier/send/types/i_profile_preferences.rb', line 9 def notifications @notifications end |
#template_id ⇒ Object (readonly)
Returns the value of attribute template_id.
9 10 11 |
# File 'lib/trycourier/send/types/i_profile_preferences.rb', line 9 def template_id @template_id end |
Class Method Details
.from_json(json_object:) ⇒ Send::IProfilePreferences
Deserialize a JSON object to an instance of IProfilePreferences
31 32 33 34 35 36 37 38 39 |
# File 'lib/trycourier/send/types/i_profile_preferences.rb', line 31 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) JSON.parse(json_object) categories = struct.categories notifications = struct.notifications template_id = struct.templateId new(categories: categories, notifications: notifications, template_id: template_id, 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.
52 53 54 55 56 |
# File 'lib/trycourier/send/types/i_profile_preferences.rb', line 52 def self.validate_raw(obj:) obj.categories&.is_a?(Hash) != false || raise("Passed value for field obj.categories is not the expected type, validation failed.") obj.notifications.is_a?(Hash) != false || raise("Passed value for field obj.notifications is not the expected type, validation failed.") obj.template_id&.is_a?(String) != false || raise("Passed value for field obj.template_id is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of IProfilePreferences to a JSON object
44 45 46 |
# File 'lib/trycourier/send/types/i_profile_preferences.rb', line 44 def to_json(*_args) { "categories": @categories, "notifications": @notifications, "templateId": @template_id }.to_json end |