lib/mailup/console/group.rb in mailup-1.1.0 vs lib/mailup/console/group.rb in mailup-1.2.0
- old
+ new
@@ -2,28 +2,40 @@
module Console
class Group
attr_accessor :api
def initialize(id, api)
- @api = api
- @id = id
+ @api = api
+ @id = id
end
+ # Import a recipient to the specified group(synchronous import).
+ #
+ # @param [Hash] recipient data, see ConsoleRecipientItems (See http://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.
+ #
+ # @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-AsyncImportRecipientsToGroup
+ #
+ 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 http://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.
#
- # @return [Integer] Number of recipients added to the group.
- #
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-AsyncImportRecipientsToGroup
#
- def add_recipients(recipients)
- @api.post("#{@api.path}/Group/#{@id}/Recipients", body: recipients)
+ 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.
@@ -35,11 +47,11 @@
# * PageSize [Integer]
# * Skipped [Integer]
# * TotalElementsCount [Integer]
#
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-GetRecipientsByGroup
- #
+ #
# @example
#
# recipients = mailup.console.group(5).recipients
# recipients['TotalElementsCount']
# => 125
@@ -47,11 +59,11 @@
# => "Joe Public"
#
def recipients(params = {})
@api.get("#{@api.path}/Group/#{@id}/Recipients", params: params)
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.
@@ -64,11 +76,11 @@
# => true
#
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.
@@ -81,10 +93,10 @@
# => true
#
def unsubscribe(recipient_id)
@api.delete("#{@api.path}/Group/#{@id}/Unsubscribe/#{recipient_id}")
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:
\ No newline at end of file