Class: MailUp::Console::List

Inherits:
Object
  • Object
show all
Defined in:
lib/mailup/console/list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, api) ⇒ List

Returns a new instance of List.



6
7
8
9
# File 'lib/mailup/console/list.rb', line 6

def initialize(id, api)
  @api = api
  @id = id
end

Instance Attribute Details

#apiObject

Returns the value of attribute api.



4
5
6
# File 'lib/mailup/console/list.rb', line 4

def api
  @api
end

Instance Method Details

#add_attachment(message_id, slot, attachment) ⇒ JSON

Add an attachment to the specified message.

Examples:


attachment = {
  Name: "PDF Attachment",
  Path: "https://abc123.mailup.com/attachments/..."
}
attach = mailup.console.list(2).add_attachment(24, 1, attachment)
attach.Name
=> "PDF Attachment"

Parameters:

  • message_id (Integer)

    The ID of the message.

  • slot (Integer)

    The slot for the attachment.

  • attachment (Hash)

    A hash of recipient attributes:

Options Hash (attachment):

  • :Name (String)

    of the attachment (required).

  • :Path (String)

    of the attachment (required).

Returns:

  • (JSON)

    The created Attachment with the following attributes:

    • Slot [Integer]

    • Name [String]

    • Path [String]

See Also:



474
475
476
# File 'lib/mailup/console/list.rb', line 474

def add_attachment(message_id, slot, attachment)
  @api.post("#{@api.path}/List/#{@id}/Email/#{message_id}/Attachment/#{slot}", body: attachment)
end

#add_group(group) ⇒ JSON

Create a new group for the specified list.

Examples:


group = {
  Name: "New Group",
  Notes: "Created with mailup-rest gem",
  Deletable: true
}
new_group = mailup.console.list(2).add_group(group)
new_group['idGroup']
=> 18

Parameters:

  • group (Hash)

    A hash of group attributes.

Options Hash (group):

  • :Name (String)

    of the group (required).

  • :Notes (String)

    to associate with the group (required).

  • :Deletable (Boolean)

    to flag whether the group can be deleted (required).

Returns:

  • (JSON)

    The new Group including:

    • idList [Integer]

    • idGroup [Integer]

    • Name [String]

    • Notes [String]

    • Deletable [Boolean]

See Also:



69
70
71
# File 'lib/mailup/console/list.rb', line 69

def add_group(group)
  @api.post("#{@api.path}/List/#{@id}/Group", body: group)
end

#add_image(image) ⇒ String

Add a new image to the specified mailing list.

Examples:


image = {
  Name: "New Image",
  Data: "..."
}
new_image = mailup.console.list(2).add_image(image)
=> "https://mailup.com/images/..."

Parameters:

  • image (Hash)

    A hash of Image attributes.

Options Hash (image):

  • Name (String)

    of the image (required).

  • Data (String)

    Base64 data for the image (required).

Returns:

  • (String)

    the created Image URL.

See Also:



537
538
539
# File 'lib/mailup/console/list.rb', line 537

def add_image(image)
  @api.post("#{@api.path}/List/#{@id}/Images", body: image)
end

#add_message(message) ⇒ JSON

Create an email message in the specified list id.

Examples:


new_message = mailup.console.list(2).add_message(message)
new_message['Subject']
=> "Message Subject"

Parameters:

  • message (Hash)

    A hash of Message attributes:

Options Hash (message):

  • :Subject (String)

    of the message (required).

  • :Content (String)

    of the message (required).

  • :Notes (String)

    of the message (required).

  • :IsConfirmation (Boolean)

    if it’s a confirmation (required).

  • :Embed (Boolean)

    this message (required).

  • :Fields (Array)

    to include (See Email#fields).

  • :Tags (Array)

    to include (See #enabled_tags).

Returns:

  • (JSON)

    The created Message with the following attributes:

    • idList [Integer]

    • idMessage [Integer]

    • Subject [String]

See Also:



586
587
588
# File 'lib/mailup/console/list.rb', line 586

def add_message(message)
  @api.post("#{@api.path}/List/#{@id}/Email", body: message)
end

#add_message_from_template(template_id) ⇒ JSON

Create an email message in the specified list id from template.

Examples:


new_message = mailup.console.list(2).add_message_from_template(5)
new_message['Subject']
=> "Subject From Template"

Parameters:

  • template_id (Integer)

    The ID of the template.

Returns:

  • (JSON)

    The created Message with the following attributes:

    • idList [Integer]

    • idMessage [Integer]

    • Subject [String]

See Also:



558
559
560
# File 'lib/mailup/console/list.rb', line 558

def add_message_from_template(template_id)
  @api.post("#{@api.path}/List/#{@id}/Email/Template/#{template_id}")
end

#add_tag(tag) ⇒ JSON

Add a new tag in the specified list.

Examples:


new_tag = mailup.console.list(2).add_tag("My New Tag")

Parameters:

  • name (String)

    The name of the tag to create.

Returns:

  • (JSON)

    The created Tag with the following attributes:

    • Id [Integer]

    • Name [String]

    • Enabled [Boolean]

See Also:



374
375
376
# File 'lib/mailup/console/list.rb', line 374

def add_tag(tag)
  @api.post("#{@api.path}/List/#{@id}/Tag", body: tag)
end

#archived_emails(params = {}) ⇒ JSON

Retrieve the archived email messages by the specified list id.

Examples:


emails = mailup.console.list(2).archived_emails
emails.size
=> 10
emails['Items'].first['Subject']
=> "Test Subject"
emails['Items'].first['idList']
=> 1

Parameters:

  • params (Hash) (defaults to: {})

    Optional params or filters:

Options Hash (params):

  • :pageNumber (Integer)

    The page number to return.

  • :pageSize (Integer)

    The number of results to per page.

  • :filterby (String)

    A filtering expression.

  • :orderby (String)

    The sorting condition for the results.

Returns:

  • (JSON)

    Results and data including:

    • IsPaginated [Boolean]

    • Items [Array<Hash>]

    • PageNumber [Integer]

    • PageSize [Integer]

    • Skipped [Integer]

    • TotalElementsCount [Integer]

See Also:



774
775
776
# File 'lib/mailup/console/list.rb', line 774

def archived_emails(params = {})
  @api.get("#{@api.path}/List/#{@id}/Archived/Emails", params: params)
end

#attachments(message_id, params = {}) ⇒ JSON

Get the attachment list for the specific message.

Examples:


attachments = mailup.console.list(2).attachments(34)
attachments.size
=> 3

Parameters:

  • message_id (Integer)

    The ID of the message.

  • params (Hash) (defaults to: {})

    Optional params or filters:

Options Hash (params):

  • :pageNumber (Integer)

    The page number to return.

  • :pageSize (Integer)

    The number of results to per page.

  • :filterby (String)

    A filtering expression.

  • :orderby (String)

    The sorting condition for the results.

Returns:

  • (JSON)

    An array of Attachments with the following attributes:

    • Slot [Integer]

    • Name [String]

    • Path [String]

See Also:



445
446
447
# File 'lib/mailup/console/list.rb', line 445

def attachments(message_id, params = {})
  @api.get("#{@api.path}/List/#{@id}/Email/#{message_id}/Attachment", params: params)
end

#delete_attachment(message_id, slot) ⇒ Boolean

Delete an attachment from the specified message.

Example:

delete = mailup.console.list(2).delete_attachment(49, 3)
=> true

Parameters:

  • message_id (Integer)

    The ID of the message.

  • slot (Integer)

    The slot of the attachment.

Returns:

  • (Boolean)

    ‘true` if successful.

See Also:



492
493
494
# File 'lib/mailup/console/list.rb', line 492

def delete_attachment(message_id, slot)
  @api.delete("#{@api.path}/List/#{@id}/Email/#{message_id}/#{slot}")
end

#delete_group(group_id) ⇒ Boolean

Delete a group from the specified list.

Example:

delete = mailup.console.list(2).delete_group(49)
=> true

Parameters:

  • group_id (Integer)

    The ID of the group to delete.

Returns:

  • (Boolean)

    ‘true` if successful

See Also:



117
118
119
# File 'lib/mailup/console/list.rb', line 117

def delete_group(group_id)
  @api.delete("#{@api.path}/List/#{@id}/Group/#{group_id}")
end

#delete_message(message_id) ⇒ Boolean

Delete an email message from the specified list id.

Example:

delete = mailup.console.list(2).delete_message(49)
=> true

Parameters:

  • message_id (Integer)

    The ID of the message.

Returns:

  • (Boolean)

    ‘true` if successful.

See Also:



650
651
652
# File 'lib/mailup/console/list.rb', line 650

def delete_message(message_id)
  @api.delete("#{@api.path}/List/#{@id}/Email/#{message_id}")
end

#delete_tag(tag_id) ⇒ Boolean

Delete a tag from the specified list.

Example:

delete = mailup.console.list(2).delete_tag(1)
=> true

Parameters:

  • idTag (Integer)

    The ID of the tag to delete.

Returns:

  • (Boolean)

    ‘true` if successful.

See Also:



419
420
421
# File 'lib/mailup/console/list.rb', line 419

def delete_tag(tag_id)
  @api.delete("#{@api.path}/List/#{@id}/Tag/#{tag_id}")
end

#emails(params = {}) ⇒ JSON

Retrieve email messages (cloned and uncloned) for this list.

Examples:


emails = mailup.console.list(2).emails
emails['TotalElementsCount']
=> 10
emails['Items'].first['Subject']
=> "Test Subject"
emails['Items'].first['idList']
=> 2

Parameters:

  • params (Hash) (defaults to: {})

    Optional params or filters:

Options Hash (params):

  • :pageNumber (Integer)

    The page number to return.

  • :pageSize (Integer)

    The number of results to per page.

  • :filterby (String)

    A filtering expression.

  • :orderby (String)

    The sorting condition for the results.

Returns:

  • (JSON)

    Results and data including:

    • IsPaginated [Boolean]

    • Items [Array<Hash>]

    • PageNumber [Integer]

    • PageSize [Integer]

    • Skipped [Integer]

    • TotalElementsCount [Integer]

See Also:



709
710
711
# File 'lib/mailup/console/list.rb', line 709

def emails(params = {})
  @api.get("#{@api.path}/List/#{@id}/Emails", params: params)
end

#groups(params = {}) ⇒ JSON

Retrieve groups for the specified list

Examples:


list = mailup.console.list(2)
groups = list.groups
groups['TotalElementsCount']
=> 10

groups = mailup.console.list(2).groups(pageNumber: 0, pageSize: 1)

Parameters:

  • params (Hash) (defaults to: {})

    Optional params or filters:

Options Hash (params):

  • :pageNumber (Integer)

    The page number to return.

  • :pageSize (Integer)

    The number of results to per page.

  • :filterby (String)

    A filtering expression.

  • :orderby (String)

    The sorting condition for the results.

Returns:

  • (JSON)

    Results and data including:

    • IsPaginated [Boolean]

    • Items [Array<Hash>]

    • PageNumber [Integer]

    • PageSize [Integer]

    • Skipped [Integer]

    • TotalElementsCount [Integer]

See Also:



38
39
40
# File 'lib/mailup/console/list.rb', line 38

def groups(params = {})
  @api.get("#{@api.path}/List/#{@id}/Groups", params: params)
end

#images(params = {}) ⇒ Array<String>

Get all the images for the specified list.

Examples:


images = mailup.console.list(2).images
images.size
=> 3

Parameters:

  • params (Hash) (defaults to: {})

    Optional params or filters:

Options Hash (params):

  • :pageNumber (Integer)

    The page number to return.

  • :pageSize (Integer)

    The number of results to per page.

  • :filterby (String)

    A filtering expression.

  • :orderby (String)

    The sorting condition for the results.

Returns:

  • (Array<String>)

    An array of Image strings.

See Also:



514
515
516
# File 'lib/mailup/console/list.rb', line 514

def images(params = {})
  @api.get("#{@api.path}/List/#{@id}/Images", params: params)
end

#import_recipient(recipient, params = {}) ⇒ Integer

Import a single recipient to a list(synchronous import).

Parameters:

  • recipients (Hash)

    An array of Recipients.

    • idRecipient [Integer] (optional)

    • Name [String]

    • Email [String]

    • MobilePrefix [String]

    • MobileNumber [String]

    • Fields [Array]

  • params (Hash) (defaults to: {})

    Optional params or filters:

Options Hash (params):

  • :ConfirmEmail (Boolean)

    Confirmed opt-in option. Default false.

  • :importType (String)

    By setting as ‘asOptout’ allows you to “import as unsubscribed” a list of specified recipients.

Returns:

  • (Integer)

    The number of imported recipients.

See Also:



268
269
270
# File 'lib/mailup/console/list.rb', line 268

def import_recipient(recipient, params = {})
  @api.post("#{@api.path}/List/#{@id}/Recipient", {params: params, body: recipient})
end

#import_recipients(recipients, params = {}) ⇒ Integer

Import multiple recipients to a list.

Parameters:

  • recipients (Array<Hash>)

    An array of Recipients.

    • idRecipient [Integer] (optional)

    • Name [String]

    • Email [String]

    • MobilePrefix [String]

    • MobileNumber [String]

    • Fields [Array]

  • params (Hash) (defaults to: {})

    Optional params or filters:

Options Hash (params):

  • :ConfirmEmail (Boolean)

    Confirmed opt-in option. Default false.

  • :importType (String)

    By setting as ‘asOptout’ allows you to “import as unsubscribed” a list of specified recipients.

Returns:

  • (Integer)

    The number of imported recipients.

See Also:



290
291
292
# File 'lib/mailup/console/list.rb', line 290

def import_recipients(recipients, params = {})
  @api.post("#{@api.path}/List/#{@id}/Recipients", {params: params, body: recipients})
end

#message_details(message_id) ⇒ JSON

Retrieve the email message details by specified id.

Example:

message = mailup.console.list(2).message_details(49)
message['Subject']
=> "Message Subject"

Parameters:

  • message_id (Integer)

    The ID of the message.

Returns:

  • (JSON)

    The Message with the following attributes:

    • Attachments [Array]

    • Notes [String]

    • Content [String]

    • Fields [Array]

    • Tags [Array]

    • Embed [Boolean]

    • IsConfirmation [Boolean]

    • idList [Integer]

    • idMessage [Integer]

    • Subject [String]

See Also:



677
678
679
# File 'lib/mailup/console/list.rb', line 677

def message_details(message_id)
  @api.get("#{@api.path}/List/#{@id}/Email/#{message_id}")
end

#online_emails(params = {}) ⇒ JSON Also known as: visible_emails

Retrieve the email messages visible online through the website by the specified list id.

Examples:


emails = mailup.console.list(2).online_emails
emails['TotalElementsCount']
=> 10
emails['Items'].first['Subject']
=> "Test Subject"
emails['Items'].first['idList']
=> 1

Parameters:

  • params (Hash) (defaults to: {})

    Optional params or filters:

Options Hash (params):

  • :pageNumber (Integer)

    The page number to return.

  • :pageSize (Integer)

    The number of results to per page.

  • :filterby (String)

    A filtering expression.

  • :orderby (String)

    The sorting condition for the results.

Returns:

  • (JSON)

    Results and data including:

    • IsPaginated [Boolean]

    • Items [Array<Hash>]

    • PageNumber [Integer]

    • PageSize [Integer]

    • Skipped [Integer]

    • TotalElementsCount [Integer]

See Also:



741
742
743
# File 'lib/mailup/console/list.rb', line 741

def online_emails(params = {})
  @api.get("#{@api.path}/List/#{@id}/Online/Emails", params: params)
end

#pending(params = {}) ⇒ JSON

Retrieve pending recipients in the specified list.

Examples:


pending = mailup.console.list(2).pending
pending['TotalElementsCount']
=> 3
pending['Items'].first['Name']
=> "Joe Public"

pending = mailup.console.list(2).pending(pageNumber: 0, pageSize: 1)

Parameters:

  • params (Hash) (defaults to: {})

    Optional params or filters:

Options Hash (params):

  • :pageNumber (Integer)

    The page number to return.

  • :pageSize (Integer)

    The number of results to per page.

  • :filterby (String)

    A filtering expression.

  • :orderby (String)

    The sorting condition for the results.

Returns:

  • (JSON)

    Results and data including:

    • IsPaginated [Boolean]

    • Items [Array<Hash>]

    • PageNumber [Integer]

    • PageSize [Integer]

    • Skipped [Integer]

    • TotalElementsCount [Integer]

See Also:



182
183
184
# File 'lib/mailup/console/list.rb', line 182

def pending(params = {})
  @api.get("#{@api.path}/List/#{@id}/Recipients/Pending", params: params)
end

#recipient_groups(recipient_id, params = {}) ⇒ JSON

Retrieve the groups subscribed by the recipient in the specified list.

Examples:


groups = mailup.console.list(2).recipient_groups(5)
groups['TotalElementsCount']
=> 3
groups['Items'].first['Name']
=> "Group Name"

groups = mailup.console.list(2).recipient_groups(5, pageNumber: 0, pageSize: 1)

Parameters:

  • recipient_id (Integer)

    The ID of the recipient.

  • params (Hash) (defaults to: {})

    Optional params or filters:

Options Hash (params):

  • :pageNumber (Integer)

    The page number to return.

  • :pageSize (Integer)

    The number of results to per page.

  • :filterby (String)

    A filtering expression.

  • :orderby (String)

    The sorting condition for the results.

Returns:

  • (JSON)

    Results and data including:

    • IsPaginated [Boolean]

    • Items [Array<Hash>]

    • PageNumber [Integer]

    • PageSize [Integer]

    • Skipped [Integer]

    • TotalElementsCount [Integer]

See Also:



150
151
152
# File 'lib/mailup/console/list.rb', line 150

def recipient_groups(recipient_id, params = {})
  @api.get("#{@api.path}/List/#{@id}/Recipient/#{recipient_id}/Groups", params: params)
end

#send_history(message_id, params = {}) ⇒ JSON

Get email message send history.

Examples:


history = mailup.console.list(2).send_history(5)
history['TotalElementsCount']
=> 10

Parameters:

  • message_id (Integer)

    The ID of the message.

  • params (Hash) (defaults to: {})

    Optional params or filters:

Options Hash (params):

  • :pageNumber (Integer)

    The page number to return.

  • :pageSize (Integer)

    The number of results to per page.

  • :filterby (String)

    A filtering expression.

  • :orderby (String)

    The sorting condition for the results.

Returns:

  • (JSON)

    Results and data including:

    • IsPaginated [Boolean]

    • Items [Array<Hash>]

    • PageNumber [Integer]

    • PageSize [Integer]

    • Skipped [Integer]

    • TotalElementsCount [Integer]

See Also:



803
804
805
# File 'lib/mailup/console/list.rb', line 803

def send_history(message_id, params = {})
  @api.get("#{@api.path}/List/#{@id}/Email/#{message_id}/SendHistory", params: params)
end

#send_message(message_id, params = {}) ⇒ JSON

Send an email message to the recipients in the specified list.

Examples:


send = mailup.console.list(2).send_message(5)
send['Sent']
=> 1794

Parameters:

  • message_id (Integer)

    The ID of the list.

  • params (Hash) (defaults to: {})

    Optional params or filters:

Options Hash (params):

  • :datetime (String)

    date/time for a deferred sending(should be UTC).

Returns:

  • (JSON)

    A Send object with the following attributes:

    • idMessage [Integer]

    • Sent [Integer]

    • UnprocessedRecipients [Array]

    • InvalidRecipients [Array]

See Also:



827
828
829
# File 'lib/mailup/console/list.rb', line 827

def send_message(message_id, params = {})
  @api.post("#{@api.path}/List/#{@id}/Email/#{message_id}/Send", params: params)
end

#subscribe(recipient_id) ⇒ Boolean

Subscribe a recipient from the specified list.

Examples:


susbcribe = mailup.console.list(2).subscribe(126)
=> true

Parameters:

  • recipient_id (Integer)

    The ID of the recipient.

Returns:

  • (Boolean)

    ‘true` if successful.

See Also:



307
308
309
# File 'lib/mailup/console/list.rb', line 307

def subscribe(recipient_id)
  @api.post("#{@api.path}/List/#{@id}/Subscribe/#{recipient_id}")
end

#subscribed(params = {}) ⇒ JSON

Retrieve subscribed recipients in the specified list.

Examples:


subscribed = mailup.console.list(2).subscribed
subscribed['TotalElementsCount']
=> 10
subscribed['Items'].first['Name']
=> "Joe Public"

subscribed = mailup.console.list(2).subscribed(pageNumber: 0, pageSize: 1)

Parameters:

  • params (Hash) (defaults to: {})

    Optional params or filters:

Options Hash (params):

  • :pageNumber (Integer)

    The page number to return.

  • :pageSize (Integer)

    The number of results to per page.

  • :filterby (String)

    A filtering expression.

  • :orderby (String)

    The sorting condition for the results.

Returns:

  • (JSON)

    Results and data including:

    • IsPaginated [Boolean]

    • Items [Array<Hash>]

    • PageNumber [Integer]

    • PageSize [Integer]

    • Skipped [Integer]

    • TotalElementsCount [Integer]

See Also:



214
215
216
# File 'lib/mailup/console/list.rb', line 214

def subscribed(params = {})
  @api.get("#{@api.path}/List/#{@id}/Recipients/Subscribed", params: params)
end

#tags(params = {}) ⇒ JSON Also known as: enabled_tags

Get the enabled tag list for the specified list id.

Examples:


tags = mailup.console.list(2).tags
tags['TotalElementsCount']
=> 10
tags['Items'].first['Enabled']
=> true

Parameters:

  • params (Hash) (defaults to: {})

    Optional params or filters:

Options Hash (params):

  • :pageNumber (Integer)

    The page number to return.

  • :pageSize (Integer)

    The number of results to per page.

  • :filterby (String)

    A filtering expression.

  • :orderby (String)

    The sorting condition for the results.

Returns:

  • (JSON)

    Results and data including:

    • IsPaginated [Boolean]

    • Items [Array<Hash>]

    • PageNumber [Integer]

    • PageSize [Integer]

    • Skipped [Integer]

    • TotalElementsCount [Integer]

See Also:



354
355
356
# File 'lib/mailup/console/list.rb', line 354

def tags(params = {})
  @api.get("#{@api.path}/List/#{@id}/Tags", params: params)
end

#template_details(template_id) ⇒ JSON

Retrieve the details for the specified message template in the specified list.

Examples:


template = mailup.console.list(2).template_details(15)
template.Id
=> 15

Parameters:

  • template_id (Integer)

    The ID of the template.

  • params (Hash)

    Optional params or filters:

Returns:

  • (JSON)

    ] A Template object with the following attributes:

    • Content [String]

    • Id [Integer]

    • Title [String]

    • Text [String]

    • Thumbnail [String]

See Also:



885
886
887
# File 'lib/mailup/console/list.rb', line 885

def template_details(template_id)
  @api.get("#{@api.path}/List/#{@id}/Templates/#{template_id}")
end

#templates(params = {}) ⇒ JSON

Retrieve the list of the current defined message templates in the specified list.

Examples:


templates = mailup.console.list(2).templates
templates['TotalElementsCount']
=> 10
templates['Items'].first['Id']
=> 278

Parameters:

  • params (Hash) (defaults to: {})

    Optional params or filters:

Options Hash (params):

  • :pageNumber (Integer)

    The page number to return.

  • :pageSize (Integer)

    The number of results to per page.

  • :filterby (String)

    A filtering expression.

  • :orderby (String)

    The sorting condition for the results.

Returns:

  • (JSON)

    Results and data including:

    • IsPaginated [Boolean]

    • Items [Array<Hash>]

    • PageNumber [Integer]

    • PageSize [Integer]

    • Skipped [Integer]

    • TotalElementsCount [Integer]

See Also:



857
858
859
# File 'lib/mailup/console/list.rb', line 857

def templates(params = {})
  @api.get("#{@api.path}/List/#{@id}/Templates", params: params)
end

#unsubscribe(recipient_id) ⇒ Boolean

Unsubscribe a recipient in the specified list.

Examples:


unsusbcribe = mailup.console.list(2).unsubscribe(126)
=> true

Parameters:

  • recipient_id (Integer)

    The ID of the recipient.

Returns:

  • (Boolean)

    ‘true` if successful.

See Also:



324
325
326
# File 'lib/mailup/console/list.rb', line 324

def unsubscribe(recipient_id)
  @api.delete("#{@api.path}/List/#{@id}/Unsubscribe/#{recipient_id}")
end

#unsubscribed(params = {}) ⇒ JSON

Retrieve unsubscribed recipients in the specified list.

Examples:


unsubscribed = mailup.console.list(2).unsusbcribed
unsubscribed['TotalElementsCount']
=> 10
unsubscribed['Items'].first['Name']
=> "Joe Public"

unsubscribed = mailup.console.list(2).unsusbcribed(pageNumber: 0, pageSize: 1)

Parameters:

  • params (Hash) (defaults to: {})

    Optional params or filters:

Options Hash (params):

  • :pageNumber (Integer)

    The page number to return.

  • :pageSize (Integer)

    The number of results to per page.

  • :filterby (String)

    A filtering expression.

  • :orderby (String)

    The sorting condition for the results.

Returns:

  • (JSON)

    Results and data including:

    • IsPaginated [Boolean]

    • Items [Array<Hash>]

    • PageNumber [Integer]

    • PageSize [Integer]

    • Skipped [Integer]

    • TotalElementsCount [Integer]

See Also:



246
247
248
# File 'lib/mailup/console/list.rb', line 246

def unsubscribed(params = {})
  @api.get("#{@api.path}/List/#{@id}/Recipients/Unsubscribed", params: params)
end

#update_group(group_id, group) ⇒ JSON

Update a group for the specified list.

Examples:


group = {
  Name: "Updated Group",
  Notes: "Updated with mailup-rest gem",
  Deletable: true
}
update = mailup.console.list(2).update_group(50, group)
update['idGroup']
=> "Updated Title"

Parameters:

  • group (Hash)

    A hash of group attributes.

Options Hash (group):

  • :Name (String)

    of the group (required).

  • :Notes (String)

    to associate with the group (required).

  • :Deletable (Boolean)

    to flag whether the group can be deleted (required).

Returns:

  • (JSON)

    The updated Group including:

    • idList [Integer]

    • idGroup [Integer]

    • Name [String]

    • Notes [String]

    • Deletable [Boolean]

See Also:



100
101
102
# File 'lib/mailup/console/list.rb', line 100

def update_group(group_id, group)
  @api.put("#{@api.path}/List/#{@id}/Group/#{group_id}", body: group)
end

#update_message(message_id, message) ⇒ JSON

Modify an email message in the specified list id.

Examples:


update = mailup.console.list(2).update_message(5, message)
update['Subject']
=> "Updated Subject"

Parameters:

  • message_id (Integer)

    The ID of the message.

  • message (Hash)

    A hash of message attributes:

Options Hash (message):

  • :Subject (String)

    of the message (required).

  • :Content (String)

    of the message (required).

  • :Notes (String)

    of the message (required).

  • :IsConfirmation (Boolean)

    if it’s a confirmation (required).

  • :Embed (Boolean)

    this message (required).

  • :Fields (Array)

    to include (See Email#fields).

  • :Tags (Array)

    to include (See #enabled_tags).

Returns:

  • (JSON)

    The updated Message with the following attributes:

    • idList [Integer]

    • idMessage [Integer]

    • Subject [String]

See Also:



615
616
617
# File 'lib/mailup/console/list.rb', line 615

def update_message(message_id, message)
  @api.put("#{@api.path}/List/#{@id}/Email/#{message_id}", body: message)
end

#update_message_visibility(message_id, visibility) ⇒ Boolean

Modify the email message online visibility.

Examples:


update = mailup.console.list(2).update_message_visibility(5, true)
=> true

Parameters:

  • message_id (Integer)

    The ID of the message.

  • visibility (Boolean)

    The visibility of the message.

Returns:

  • (Boolean)

    ‘true` if successful.

See Also:



633
634
635
# File 'lib/mailup/console/list.rb', line 633

def update_message_visibility(message_id, visibility)
  @api.put("#{@api.path}/List/#{@id}/Email/#{message_id}/Online/Visibility", body: visibility)
end

#update_tag(tag_id, tag) ⇒ JSON

Update a tag in the specified list.

Examples:


tag = {
  Id: 1,
  Name: "Updated Tag",
  Enabled: false
}
updated_tag = mailup.console.list(2).update_tag(1, tag)
updated_tag
=> false

Parameters:

  • tag (Hash)

    A hash of tag attributes:

Options Hash (tag):

  • :Name (String)

    of the tag (required).

  • :Enabled (Boolean)

    true if tag is enabled.

Returns:

  • (JSON)

    The updated Tag with the following attributes:

    • Id [Integer]

    • Name [String]

    • Enabled [Boolean]

See Also:



402
403
404
# File 'lib/mailup/console/list.rb', line 402

def update_tag(tag_id, tag)
  @api.put("#{@api.path}/List/#{@id}/Tag/#{tag_id}", body: tag)
end