Class: Courier::Profiles::GetListSubscriptionsList
- Inherits:
-
Object
- Object
- Courier::Profiles::GetListSubscriptionsList
- Defined in:
- lib/trycourier/profiles/types/get_list_subscriptions_list.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#preferences ⇒ Object
readonly
Returns the value of attribute preferences.
-
#updated ⇒ Object
readonly
Returns the value of attribute updated.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Profiles::GetListSubscriptionsList
Deserialize a JSON object to an instance of GetListSubscriptionsList.
-
.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(id:, name:, created:, updated:, preferences: nil, additional_properties: nil) ⇒ Profiles::GetListSubscriptionsList constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of GetListSubscriptionsList to a JSON object.
Constructor Details
#initialize(id:, name:, created:, updated:, preferences: nil, additional_properties: nil) ⇒ Profiles::GetListSubscriptionsList
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/trycourier/profiles/types/get_list_subscriptions_list.rb', line 18 def initialize(id:, name:, created:, updated:, preferences: nil, additional_properties: nil) # @type [String] @id = id # @type [String] List name @name = name # @type [String] The date/time of when the list was created. Represented as a string in ISO format. @created = created # @type [String] The date/time of when the list was updated. Represented as a string in ISO format. @updated = updated # @type [Commons::RecipientPreferences] @preferences = preferences # @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/profiles/types/get_list_subscriptions_list.rb', line 9 def additional_properties @additional_properties end |
#created ⇒ Object (readonly)
Returns the value of attribute created.
9 10 11 |
# File 'lib/trycourier/profiles/types/get_list_subscriptions_list.rb', line 9 def created @created end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/trycourier/profiles/types/get_list_subscriptions_list.rb', line 9 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/trycourier/profiles/types/get_list_subscriptions_list.rb', line 9 def name @name end |
#preferences ⇒ Object (readonly)
Returns the value of attribute preferences.
9 10 11 |
# File 'lib/trycourier/profiles/types/get_list_subscriptions_list.rb', line 9 def preferences @preferences end |
#updated ⇒ Object (readonly)
Returns the value of attribute updated.
9 10 11 |
# File 'lib/trycourier/profiles/types/get_list_subscriptions_list.rb', line 9 def updated @updated end |
Class Method Details
.from_json(json_object:) ⇒ Profiles::GetListSubscriptionsList
Deserialize a JSON object to an instance of GetListSubscriptionsList
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/trycourier/profiles/types/get_list_subscriptions_list.rb', line 37 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = struct.id name = struct.name created = struct.created updated = struct.updated if parsed_json["preferences"].nil? preferences = nil else preferences = parsed_json["preferences"].to_json preferences = Commons::RecipientPreferences.from_json(json_object: preferences) end new(id: id, name: name, created: created, updated: updated, preferences: preferences, 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.
65 66 67 68 69 70 71 |
# File 'lib/trycourier/profiles/types/get_list_subscriptions_list.rb', line 65 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.") obj.created.is_a?(String) != false || raise("Passed value for field obj.created is not the expected type, validation failed.") obj.updated.is_a?(String) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.") obj.preferences.nil? || Commons::RecipientPreferences.validate_raw(obj: obj.preferences) end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of GetListSubscriptionsList to a JSON object
57 58 59 |
# File 'lib/trycourier/profiles/types/get_list_subscriptions_list.rb', line 57 def to_json(*_args) { "id": @id, "name": @name, "created": @created, "updated": @updated, "preferences": @preferences }.to_json end |