class MailUp::Console::Email

Attributes

api[RW]

Public Class Methods

new(api) click to toggle source
# File lib/mailup/console/email.rb, line 6
def initialize(api)
  @api = api
end

Public Instance Methods

get_deferred_confirmation_date(sending_id) click to toggle source

Retrieves the earliest date to schedule the given sending task.

@param [Integer] Id Sending.

# File lib/mailup/console/email.rb, line 45
def get_deferred_confirmation_date(sending_id)
  @api.get("#{@api.path}/Email/Sendings/#{sending_id}/Deferred")
end
get_deferred_confirmation_queque() click to toggle source

Retrieves the list of email messages that are currently queued up for “deferred sending”.

# File lib/mailup/console/email.rb, line 68
def get_deferred_confirmation_queque
  @api.get("#{@api.path}/Email/Sendings/Deferred")
end
get_immediate_confirmation_queque() click to toggle source

Retrieves the list of email messages that are currently queued up for “immediate sending”.

# File lib/mailup/console/email.rb, line 61
def get_immediate_confirmation_queque
  @api.get("#{@api.path}/Email/Sendings/Immediate")
end
get_undefined_confirmation_queque() click to toggle source

Retrieves the list of email messages that are neither “scheduled” nor queued up for “immediate sending”.

# File lib/mailup/console/email.rb, line 75
def get_undefined_confirmation_queque
  @api.get("#{@api.path}/Email/Sendings/Undefined")
end
send(message_id, email) click to toggle source

Send single email message to specified recipient.

@param [Integer] message_id The ID of the message to send. @param [String] email The email address of the recipient.

@return [JSON] A Send object with the following attributes:

* idMessage [Integer]
* Sent [Integer]
* UnprocessedRecipients [Array]
* InvalidRecipients [Array]

@see help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-SendMailMessageToRecipient

@example

send = mailup.console.email.send(5, 'joe@public.com')
send['Sent']
=> 1
# File lib/mailup/console/email.rb, line 29
def send(message_id, email)
  @api.post("#{@api.path}/Email/Send", body: {:idMessage => message_id, :Email => email})
end
send_deferred_confirmation(sending_id, date = nil) click to toggle source

Sets up a mailing for scheduled delivery

@param [Integer] Id Sending. @param [String] :Date date/time for a deferred sending(should be UTC).

# File lib/mailup/console/email.rb, line 54
def send_deferred_confirmation(sending_id, date = nil)
  @api.post("#{@api.path}/Email/Sendings/#{sending_id}/Deferred", body: {'Date' => date})
end
send_immediate_confirmation(sending_id) click to toggle source

Schedules a mailing for immediate sending

@param [Integer] Id Sending.

# File lib/mailup/console/email.rb, line 37
 def send_immediate_confirmation(sending_id)
  @api.post("#{@api.path}/Email/Sendings/#{sending_id}/Immediate")
end