Class: Courier::Profiles::GetListSubscriptionsList

Inherits:
Object
  • Object
show all
Defined in:
lib/trycourier/profiles/types/get_list_subscriptions_list.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, name:, created:, updated:, preferences: nil, additional_properties: nil) ⇒ Profiles::GetListSubscriptionsList

Parameters:

  • id (String)
  • name (String)

    List name

  • created (String)

    The date/time of when the list was created. Represented as a string in ISO format.

  • updated (String)

    The date/time of when the list was updated. Represented as a string in ISO format.

  • preferences (Commons::RecipientPreferences) (defaults to: nil)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesObject (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

#createdObject (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

#idObject (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

#nameObject (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

#preferencesObject (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

#updatedObject (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

Parameters:

  • json_object (JSON)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (JSON)


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