lib/mailup/console/email.rb in mailup-1.1.0 vs lib/mailup/console/email.rb in mailup-1.2.0

- old
+ new

@@ -2,15 +2,15 @@ module Console class Email attr_accessor :api def initialize(api) - @api = api + @api = api end # 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] @@ -28,8 +28,53 @@ # def send(message_id, email) @api.post("#{@api.path}/Email/Send", body: {:idMessage => message_id, :Email => email}) end + # Schedules a mailing for immediate sending + # + # @param [Integer] Id Sending. + # + def send_immediate_confirmation(sending_id) + @api.post("#{@api.path}/Email/Sendings/#{sending_id}/Immediate") + end + + # Retrieves the earliest date to schedule the given sending task. + # + # @param [Integer] Id Sending. + # + def get_deferred_confirmation_date(sending_id) + @api.get("#{@api.path}/Email/Sendings/#{sending_id}/Deferred") + end + + # Sets up a mailing for scheduled delivery + # + # @param [Integer] Id Sending. + # @param [String] :Date date/time for a deferred sending(should be UTC). + # + def send_deferred_confirmation(sending_id, date = nil) + @api.post("#{@api.path}/Email/Sendings/#{sending_id}/Deferred", body: {'Date' => date}) + end + + # Retrieves the list of email messages that are currently queued up for "immediate sending". + # + # + def get_immediate_confirmation_queque + @api.get("#{@api.path}/Email/Sendings/Immediate") + end + + # Retrieves the list of email messages that are currently queued up for "deferred sending". + # + # + def get_deferred_confirmation_queque + @api.get("#{@api.path}/Email/Sendings/Deferred") + end + + # Retrieves the list of email messages that are neither "scheduled" nor queued up for "immediate sending". + # + # + def get_undefined_confirmation_queque + @api.get("#{@api.path}/Email/Sendings/Undefined") + end end end end \ No newline at end of file