Class: MailUp::Console::Group
- Inherits:
-
Object
- Object
- MailUp::Console::Group
- Defined in:
- lib/mailup/console/group.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
Instance Method Summary collapse
-
#add_recipient(recipient, params = {}) ⇒ Object
Import a recipient to the specified group(synchronous import).
-
#add_recipients(recipients, params = {}) ⇒ Object
Async Import recipients to the specified group.
-
#initialize(id, api) ⇒ Group
constructor
A new instance of Group.
-
#recipients(params = {}) ⇒ JSON
Retrieve the recipients in the specified group.
-
#send_message(message_id) ⇒ JSON
Send email message to all recipient in group.
-
#subscribe(recipient_id) ⇒ Boolean
Subscribe the recipient with the related id to the specified group.
-
#unsubscribe(recipient_id) ⇒ Boolean
Unsubscribe the recipient with the related id from the specified group.
Constructor Details
#initialize(id, api) ⇒ Group
Returns a new instance of Group.
6 7 8 9 |
# File 'lib/mailup/console/group.rb', line 6 def initialize(id, api) @api = api @id = id end |
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
4 5 6 |
# File 'lib/mailup/console/group.rb', line 4 def api @api end |
Instance Method Details
#add_recipient(recipient, params = {}) ⇒ Object
Import a recipient to the specified group(synchronous import).
19 20 21 |
# 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 |
#add_recipients(recipients, params = {}) ⇒ Object
Async Import recipients to the specified group.
31 32 33 |
# 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 |
#recipients(params = {}) ⇒ JSON
Retrieve the recipients in the specified group.
61 62 63 |
# File 'lib/mailup/console/group.rb', line 61 def recipients(params = {}) @api.get("#{@api.path}/Group/#{@id}/Recipients", params: params) end |
#send_message(message_id) ⇒ JSON
Send email message to all recipient in group.
117 118 119 |
# File 'lib/mailup/console/group.rb', line 117 def () @api.post("#{@api.path}/Group/#{@id}/Email/#{}/Send") end |
#subscribe(recipient_id) ⇒ Boolean
Subscribe the recipient with the related id to the specified group.
78 79 80 |
# File 'lib/mailup/console/group.rb', line 78 def subscribe(recipient_id) @api.post("#{@api.path}/Group/#{@id}/Subscribe/#{recipient_id}") end |
#unsubscribe(recipient_id) ⇒ Boolean
Unsubscribe the recipient with the related id from the specified group.
95 96 97 |
# File 'lib/mailup/console/group.rb', line 95 def unsubscribe(recipient_id) @api.delete("#{@api.path}/Group/#{@id}/Unsubscribe/#{recipient_id}") end |