class MailUp::Console::Group
Attributes
Public Class Methods
# File lib/mailup/console/group.rb, line 6 def initialize(id, api) @api = api @id = id end
Public Instance Methods
Import
a recipient to the specified group(synchronous import).
@param [Hash] recipient data, see ConsoleRecipientItems (See help.mailup.com/display/mailupapi/Models+v1.1#Modelsv1.1-ConsoleRecipientItem). @param [Hash] params Optional params or filters: @option params [Boolean] :ConfirmEmail Confirmed opt-in option. Default false.
# File lib/mailup/console/group.rb, line 19 def add_recipient(recipient, params = {}) @api.post("#{@api.path}/Group/#{@id}/Recipient", body: recipient, params: params) end
Async Import
recipients to the specified group.
@param [Array] recipients an array ConsoleRecipientItems (See help.mailup.com/display/mailupapi/Models+v1.1#Modelsv1.1-ConsoleRecipientItem). @param [Hash] params Optional params or filters: @option params [Boolean] :ConfirmEmail Confirmed opt-in option. Default false.
# File lib/mailup/console/group.rb, line 31 def add_recipients(recipients, params = {}) @api.post("#{@api.path}/Group/#{@id}/Recipients", body: recipients, params: params) end
Retrieve the recipients in the specified group.
@param [Hash] params Optional params or filters: @option params [Integer] :pageNumber The page number to return. @option params [Integer] :pageSize The number of results to per page. @option params [String] :filterby A filtering expression. @option params [String] :orderby The sorting condition for the results.
@return [JSON] Results and data including:
* IsPaginated [Boolean] * Items [Array<Hash>] * PageNumber [Integer] * PageSize [Integer] * Skipped [Integer] * TotalElementsCount [Integer]
@see help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-GetRecipientsByGroup
@example
recipients = mailup.console.group(5).recipients recipients['TotalElementsCount'] => 125 recipients['Items'].first['Name'] => "Joe Public"
# File lib/mailup/console/group.rb, line 61 def recipients(params = {}) @api.get("#{@api.path}/Group/#{@id}/Recipients", params: params) end
Send email message to all recipient in group.
@param [Integer] message_id of the message.
@return [JSON] A Send object with the following attributes:
* idMessage [Integer] * Sent [Integer] * UnprocessedRecipients [Array] * InvalidRecipients [Array]
@example
send = mailup.console.group(5).send_message(1340) send['Sent'] => 1794
# File lib/mailup/console/group.rb, line 117 def send_message(message_id) @api.post("#{@api.path}/Group/#{@id}/Email/#{message_id}/Send") end
Subscribe the recipient with the related id to the specified group.
@param [Integer] recipient_id The ID of the recipient.
@return [Boolean] ‘true` if successful.
@see help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-SubscribeRecipientToGroup
@example
susbcribe = mailup.console.group(5).subscribe(126) => true
# File lib/mailup/console/group.rb, line 78 def subscribe(recipient_id) @api.post("#{@api.path}/Group/#{@id}/Subscribe/#{recipient_id}") end
Unsubscribe the recipient with the related id from the specified group.
@param [Integer] recipient_id The ID of the recipient.
@return [Boolean] ‘true` if successful.
@example
unsusbcribe = mailup.console.group(5).unsubscribe(126) => true
# File lib/mailup/console/group.rb, line 95 def unsubscribe(recipient_id) @api.delete("#{@api.path}/Group/#{@id}/Unsubscribe/#{recipient_id}") end