README.rdoc in messagebus_ruby_api-0.4.0 vs README.rdoc in messagebus_ruby_api-0.4.4

- old
+ new

@@ -1,67 +1,49 @@ = Messagebus Ruby API - -== Installation - +=Installation gem install messagebus_ruby_api - - -== Examples - += Examples Start by requiring MessagebusRubyApi: - require 'messagebus_ruby_api' - -=== Create the Api Client with your API key - +== Create the Api Client with your API key client = MessagebusRubyApi::Client.new("<INSERT_YOUR_API_KEY>") - +==Sending Emails === Setting common fields for your emails client.common_info={:fromEmail="from@example.com"} - ==== When not using an API template -===== Required common_info field +=====Required common_info fields :fromEmail -===== Optional common_info fields - :fromName, :replayTo, :tags +=====Optional common_info fields + :fromName, :tags, :customHeaders ==== When using an API template -===== Required common_info field +=====Required common_info fields :templateKey -===== No Optional Fields - +=====Optional common_info field + None === Adding messages to the send buffer result=client.add_message({:toEmail=>"to@example.com"}) - - If you get a result >0 you get back the number of messages waiting to get sent - If you get a result = 0 that means the buffer was flushed and you can get results from client.return_status - Note: you should read from client.return_status before adding more messages since client.return_status will get cleared during the next auto-flush - +If you get a result >0 you get back the number of messages waiting to get sent +If you get a result = 0 that means the buffer was flushed and you can get results from client.return_status +Note: you should read from client.return_status before adding more messages since client.return_status will get cleared during the next auto-flush ==== When not using an API template -===== Required message fields +=====Required message fields :toEmail, :subject, :plaintextBody or :htmlBody -===== Optional message fields +=====Optional message fields :tag, :toName, ==== When using an API template -===== Required common_info field +=====Required message fields :mergeFields={"%EMAIL"=>"to@example.com", "%KEY1%"="testing"} - Note: the merge fields entries chould contain the keys used in the template, but only the %EMAIL% is required - -===== No Optional Fields - +=====Optional message fields + None === Flushing the send buffer client.flush - - Note: Flushing returns the status of the messages that were sent (see bellow). It also clears old values to client.return_status - - Warning: You always need to flush your buffer when you are done adding messages to be sent or if you want to send messages with a different common_info (failure to do so could result in unsent messages getting lost or old messages getting sent with your new common_info - +Note: Flushing returns the status of the messages that were sent (see bellow). It also clears old values to client.return_status +Warning: You always need to flush your buffer when you are done adding messages to be sent or if you want to send messages with a different common_info (failure to do so could result in unsent messages getting lost or old messages getting sent with your new common_info === Checking on message ids sent client.return_status - - Status messages will be in the following form: - +Status messages will be in the following form: { "statusMessage" => "OK", "successCount" => 2, "failureCount" => 0, "results" => [ @@ -73,17 +55,25 @@ "status" => 200, "messageId" => "e460d7f0-908e-012e-80b4-58b035f30fd2" } ] } - - If there are failures you will get 400 or 500 status codes as well as error messages - -== Older Versions - - If you are using the old api with the text OK:<UUID> responses, please be sure to get the 'v1' branch - - If you are using the old api with the 'body' parameter (instead of the new 'plaintextBody' and 'htmlBody' parameters), please be sure to get the 'v0' branch - -== More info - +If there are failures you will get 400 or 500 status codes as well as error messages +==Viewing Error Reports + client.error_report +results will be in the following form: + [ + {:date=>"2011-08-16T21:19:20+00:00", :address=>"someguy@example.com", :errorCode=>"4.2.1"}, + {:date=>"2011-08-17T21:19:20+00:00", :address=>"someguy@example.com", :errorCode=>"5.0.0"} + ] +==Viewing Unsubscribes By Date + client.blocked_emails +results will be in the following form: + [ + {:email=>"test558_7283@example.com",:unsubscribe_time=>"2011-08-31T19:24:00+00:00","message_send_time"=>"2011-08-31T17:29:16+00:00","message_id"=>"testid"}, + {:email=>"test558_7283@example.com",:unsubscribe_time=>"2011-08-31T19:24:00+00:00","message_send_time"=>"2011-08-31T17:29:16+00:00","message_id"=>"testid2"} + ] += Older Versions +If you are using the old api with the text OK:<UUID> responses, please be sure to get the 'v1' branch +If you are using the old api with the 'body' parameter (instead of the new 'plaintextBody' and 'htmlBody' parameters), please be sure to get the 'v0' branch += More info Contact MessageBus if you have questions or problems (https://www.messagebus.com/contact)