mandrill-api 1.0.33 → 1.0.34

Sign up to get free protection for your applications and to get access to all the features.
@@ -54,8 +54,10 @@ module Mandrill
54
54
  error_map = {
55
55
  'ValidationError' => ValidationError,
56
56
  'Invalid_Key' => InvalidKeyError,
57
+ 'PaymentRequired' => PaymentRequiredError,
57
58
  'Unknown_Template' => UnknownTemplateError,
58
59
  'ServiceUnavailable' => ServiceUnavailableError,
60
+ 'Unknown_Message' => UnknownMessageError,
59
61
  'Invalid_Tag_Name' => InvalidTagNameError,
60
62
  'Invalid_Reject' => InvalidRejectError,
61
63
  'Unknown_Sender' => UnknownSenderError,
@@ -394,6 +394,8 @@ module Mandrill
394
394
  # - [Integer] unsubs the total number of unsubscribe requests received for messages by this sender
395
395
  # - [Integer] opens the total number of times messages by this sender have been opened
396
396
  # - [Integer] clicks the total number of times tracked URLs in messages by this sender have been clicked
397
+ # - [Integer] unique_opens the number of unique opens for emails sent for this sender
398
+ # - [Integer] unique_clicks the number of unique clicks for emails sent for this sender
397
399
  def senders()
398
400
  _params = {}
399
401
  return @master.call 'users/senders', _params
@@ -440,6 +442,8 @@ module Mandrill
440
442
  # - [Integer] unsubs the total number of unsubscribe requests received for messages by this sender
441
443
  # - [Integer] opens the total number of times messages by this sender have been opened
442
444
  # - [Integer] clicks the total number of times tracked URLs in messages by this sender have been clicked
445
+ # - [Integer] unique_opens the number of unique opens for emails sent for this sender
446
+ # - [Integer] unique_clicks the number of unique clicks for emails sent for this sender
443
447
  def list(email=nil, include_expired=false)
444
448
  _params = {:email => email, :include_expired => include_expired}
445
449
  return @master.call 'rejects/list', _params
@@ -522,6 +526,8 @@ module Mandrill
522
526
  # - [Integer] unsubs the total number of unsubscribe requests received for messages with this tag
523
527
  # - [Integer] opens the total number of times messages with this tag have been opened
524
528
  # - [Integer] clicks the total number of times tracked URLs in messages with this tag have been clicked
529
+ # - [Integer] unique_opens the number of unique opens for emails sent with this tag
530
+ # - [Integer] unique_clicks the number of unique clicks for emails sent with this tag
525
531
  def list()
526
532
  _params = {}
527
533
  return @master.call 'tags/list', _params
@@ -539,6 +545,8 @@ module Mandrill
539
545
  # - [Integer] unsubs the total number of unsubscribe requests received for messages with this tag
540
546
  # - [Integer] opens the total number of times messages with this tag have been opened
541
547
  # - [Integer] clicks the total number of times tracked URLs in messages with this tag have been clicked
548
+ # - [Integer] unique_opens the number of unique opens for emails sent with this tag
549
+ # - [Integer] unique_clicks the number of unique clicks for emails sent with this tag
542
550
  def delete(tag)
543
551
  _params = {:tag => tag}
544
552
  return @master.call 'tags/delete', _params
@@ -720,14 +728,15 @@ module Mandrill
720
728
  # - [String] content the content of the image as a base64-encoded string
721
729
  # @param [Boolean] async enable a background sending mode that is optimized for bulk sending. In async mode, messages/send will immediately return a status of "queued" for every recipient. To handle rejections when sending in async mode, set up a webhook for the 'reject' event. Defaults to false for messages with no more than 10 recipients; messages with more than 10 recipients are always sent asynchronously, regardless of the value of async.
722
730
  # @param [String] ip_pool the name of the dedicated ip pool that should be used to send the message. If you do not have any dedicated IPs, this parameter has no effect. If you specify a pool that does not exist, your default pool will be used instead.
731
+ # @param [String] send_at when this message should be sent as a UTC timestamp in YYYY-MM-DD HH:MM:SS format. If you specify a time in the past, the message will be sent immediately.
723
732
  # @return [Array] of structs for each recipient containing the key "email" with the email address and "status" as either "sent", "queued", or "rejected"
724
733
  # - [Hash] return[] the sending results for a single recipient
725
734
  # - [String] email the email address of the recipient
726
- # - [String] status the sending status of the recipient - either "sent", "queued", "rejected", or "invalid"
735
+ # - [String] status the sending status of the recipient - either "sent", "queued", "scheduled", "rejected", or "invalid"
727
736
  # - [String] reject_reason the reason for the rejection if the recipient status is "rejected"
728
737
  # - [String] _id the message's unique id
729
- def send(message, async=false, ip_pool=nil)
730
- _params = {:message => message, :async => async, :ip_pool => ip_pool}
738
+ def send(message, async=false, ip_pool=nil, send_at=nil)
739
+ _params = {:message => message, :async => async, :ip_pool => ip_pool, :send_at => send_at}
731
740
  return @master.call 'messages/send', _params
732
741
  end
733
742
 
@@ -792,14 +801,15 @@ module Mandrill
792
801
  # - [String] content the content of the image as a base64-encoded string
793
802
  # @param [Boolean] async enable a background sending mode that is optimized for bulk sending. In async mode, messages/send will immediately return a status of "queued" for every recipient. To handle rejections when sending in async mode, set up a webhook for the 'reject' event. Defaults to false for messages with no more than 10 recipients; messages with more than 10 recipients are always sent asynchronously, regardless of the value of async.
794
803
  # @param [String] ip_pool the name of the dedicated ip pool that should be used to send the message. If you do not have any dedicated IPs, this parameter has no effect. If you specify a pool that does not exist, your default pool will be used instead.
795
- # @return [Array] of structs for each recipient containing the key "email" with the email address and "status" as either "sent", "queued", or "rejected"
804
+ # @param [String] send_at when this message should be sent as a UTC timestamp in YYYY-MM-DD HH:MM:SS format. If you specify a time in the past, the message will be sent immediately.
805
+ # @return [Array] of structs for each recipient containing the key "email" with the email address and "status" as either "sent", "queued", "scheduled", or "rejected"
796
806
  # - [Hash] return[] the sending results for a single recipient
797
807
  # - [String] email the email address of the recipient
798
808
  # - [String] status the sending status of the recipient - either "sent", "queued", "rejected", or "invalid"
799
809
  # - [String] reject_reason the reason for the rejection if the recipient status is "rejected"
800
810
  # - [String] _id the message's unique id
801
- def send_template(template_name, template_content, message, async=false, ip_pool=nil)
802
- _params = {:template_name => template_name, :template_content => template_content, :message => message, :async => async, :ip_pool => ip_pool}
811
+ def send_template(template_name, template_content, message, async=false, ip_pool=nil, send_at=nil)
812
+ _params = {:template_name => template_name, :template_content => template_content, :message => message, :async => async, :ip_pool => ip_pool, :send_at => send_at}
803
813
  return @master.call 'messages/send-template', _params
804
814
  end
805
815
 
@@ -865,17 +875,62 @@ module Mandrill
865
875
  # - [String] to[] the email address of the recipint
866
876
  # @param [Boolean] async enable a background sending mode that is optimized for bulk sending. In async mode, messages/sendRaw will immediately return a status of "queued" for every recipient. To handle rejections when sending in async mode, set up a webhook for the 'reject' event. Defaults to false for messages with no more than 10 recipients; messages with more than 10 recipients are always sent asynchronously, regardless of the value of async.
867
877
  # @param [String] ip_pool the name of the dedicated ip pool that should be used to send the message. If you do not have any dedicated IPs, this parameter has no effect. If you specify a pool that does not exist, your default pool will be used instead.
878
+ # @param [String] send_at when this message should be sent as a UTC timestamp in YYYY-MM-DD HH:MM:SS format. If you specify a time in the past, the message will be sent immediately.
868
879
  # @return [Array] of structs for each recipient containing the key "email" with the email address and "status" as either "sent", "queued", or "rejected"
869
880
  # - [Hash] return[] the sending results for a single recipient
870
881
  # - [String] email the email address of the recipient
871
- # - [String] status the sending status of the recipient - either "sent", "queued", "rejected", or "invalid"
882
+ # - [String] status the sending status of the recipient - either "sent", "queued", "scheduled", "rejected", or "invalid"
872
883
  # - [String] reject_reason the reason for the rejection if the recipient status is "rejected"
873
884
  # - [String] _id the message's unique id
874
- def send_raw(raw_message, from_email=nil, from_name=nil, to=nil, async=false, ip_pool=nil)
875
- _params = {:raw_message => raw_message, :from_email => from_email, :from_name => from_name, :to => to, :async => async, :ip_pool => ip_pool}
885
+ def send_raw(raw_message, from_email=nil, from_name=nil, to=nil, async=false, ip_pool=nil, send_at=nil)
886
+ _params = {:raw_message => raw_message, :from_email => from_email, :from_name => from_name, :to => to, :async => async, :ip_pool => ip_pool, :send_at => send_at}
876
887
  return @master.call 'messages/send-raw', _params
877
888
  end
878
889
 
890
+ # Queries your scheduled emails by sender or recipient, or both.
891
+ # @param [String] to an optional recipient address to restrict results to
892
+ # @return [Array] a list of up to 1000 scheduled emails
893
+ # - [Hash] return[] a scheduled email
894
+ # - [String] _id the scheduled message id
895
+ # - [String] created_at the UTC timestamp when the message was created, in YYYY-MM-DD HH:MM:SS format
896
+ # - [String] send_at the UTC timestamp when the message will be sent, in YYYY-MM-DD HH:MM:SS format
897
+ # - [String] from_email the email's sender address
898
+ # - [String] to the email's recipient
899
+ # - [String] subject the email's subject
900
+ def list_scheduled(to=nil)
901
+ _params = {:to => to}
902
+ return @master.call 'messages/list-scheduled', _params
903
+ end
904
+
905
+ # Cancels a scheduled email.
906
+ # @param [String] id a scheduled email id, as returned by any of the messages/send calls or messages/list-scheduled
907
+ # @return [Hash] information about the scheduled email that was cancelled.
908
+ # - [String] _id the scheduled message id
909
+ # - [String] created_at the UTC timestamp when the message was created, in YYYY-MM-DD HH:MM:SS format
910
+ # - [String] send_at the UTC timestamp when the message will be sent, in YYYY-MM-DD HH:MM:SS format
911
+ # - [String] from_email the email's sender address
912
+ # - [String] to the email's recipient
913
+ # - [String] subject the email's subject
914
+ def cancel_scheduled(id)
915
+ _params = {:id => id}
916
+ return @master.call 'messages/cancel-scheduled', _params
917
+ end
918
+
919
+ # Reschedules a scheduled email.
920
+ # @param [String] id a scheduled email id, as returned by any of the messages/send calls or messages/list-scheduled
921
+ # @param [String] send_at the new UTC timestamp when the message should sent. Mandrill can't time travel, so if you specify a time in past the message will be sent immediately
922
+ # @return [Hash] information about the scheduled email that was rescheduled.
923
+ # - [String] _id the scheduled message id
924
+ # - [String] created_at the UTC timestamp when the message was created, in YYYY-MM-DD HH:MM:SS format
925
+ # - [String] send_at the UTC timestamp when the message will be sent, in YYYY-MM-DD HH:MM:SS format
926
+ # - [String] from_email the email's sender address
927
+ # - [String] to the email's recipient
928
+ # - [String] subject the email's subject
929
+ def reschedule(id, send_at)
930
+ _params = {:id => id, :send_at => send_at}
931
+ return @master.call 'messages/reschedule', _params
932
+ end
933
+
879
934
  end
880
935
  class Whitelists
881
936
  attr_accessor :master
@@ -1101,6 +1156,8 @@ module Mandrill
1101
1156
  # - [Integer] unsubs the total number of unsubscribe requests received for messages by this sender
1102
1157
  # - [Integer] opens the total number of times messages by this sender have been opened
1103
1158
  # - [Integer] clicks the total number of times tracked URLs in messages by this sender have been clicked
1159
+ # - [Integer] unique_opens the number of unique opens for emails sent for this sender
1160
+ # - [Integer] unique_clicks the number of unique clicks for emails sent for this sender
1104
1161
  def list()
1105
1162
  _params = {}
1106
1163
  return @master.call 'senders/list', _params
@@ -5,10 +5,14 @@ module Mandrill
5
5
  end
6
6
  class InvalidKeyError < Error
7
7
  end
8
+ class PaymentRequiredError < Error
9
+ end
8
10
  class UnknownTemplateError < Error
9
11
  end
10
12
  class ServiceUnavailableError < Error
11
13
  end
14
+ class UnknownMessageError < Error
15
+ end
12
16
  class InvalidTagNameError < Error
13
17
  end
14
18
  class InvalidRejectError < Error
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mandrill-api
3
3
  version: !ruby/object:Gem::Version
4
- hash: 85
4
+ hash: 83
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 33
10
- version: 1.0.33
9
+ - 34
10
+ version: 1.0.34
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mandrill Devs
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-06-07 00:00:00 Z
18
+ date: 2013-06-21 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: json