MessageBuilder.md in mailgun-ruby-1.1.1 vs MessageBuilder.md in mailgun-ruby-1.1.2
- old
+ new
@@ -21,33 +21,33 @@
# First, instantiate the Mailgun Client with your API key
mg_client = Mailgun::Client.new("your-api-key")
mb_obj = Mailgun::MessageBuilder.new()
# Define the from address.
-mb_obj.set_from_address("me@example.com", {"first"=>"Ruby", "last" => "SDK"});
+mb_obj.from("me@example.com", {"first"=>"Ruby", "last" => "SDK"});
# Define a to recipient.
mb_obj.add_recipient(:to, "john.doe@example.com", {"first" => "John", "last" => "Doe"});
# Define a cc recipient.
mb_obj.add_recipient(:cc, "sally.doe@example.com", {"first" => "Sally", "last" => "Doe"});
# Define the subject.
-mb_obj.set_subject("A message from the Ruby SDK using Message Builder!");
+mb_obj.subject("A message from the Ruby SDK using Message Builder!");
# Define the body of the message.
-mb_obj.set_text_body("This is the text body of the message!");
+mb_obj.body_text("This is the text body of the message!");
# Set the Message-Id header, provide a valid Message-Id.
-mb_obj.set_message_id("<20141014000000.11111.11111@example.com>")
+mb_obj.message_id("<20141014000000.11111.11111@example.com>")
# Or clear the Message-Id header, provide nil or empty string.
-mb_obj.set_message_id(nil)
-mb_obj.set_message_id('')
+mb_obj.message_id(nil)
+mb_obj.message_id('')
# Campaign and other headers.
mb_obj.add_campaign_id("My-Awesome-Campaign");
mb_obj.add_custom_parameter("h:Customer-Id", "12345");
# Attach a file and rename it.
mb_obj.add_attachment("/path/to/file/receipt_123491820.pdf", "Receipt.pdf");
# Schedule message in the future
-mb_obj.set_delivery_time("tomorrow 8:00AM PST");
+mb_obj.delivery_at("tomorrow 8:00AM PST");
# Finally, send your message using the client
result = mg_client.send_message("sending_domain.com", mb_obj)
puts result.body.to_s
@@ -62,14 +62,14 @@
mg_client = Mailgun::Client.new("your-api-key")
# Create a Batch Message object, pass in the client and your domain.
mb_obj = Mailgun::BatchMessage.new(mg_client, "example.com")
# Define the from address.
-mb_obj.set_from_address("me@example.com", {"first"=>"Ruby", "last" => "SDK"});
+mb_obj.from("me@example.com", {"first"=>"Ruby", "last" => "SDK"});
# Define the subject.
-mb_obj.set_subject("A message from the Ruby SDK using Message Builder!");
+mb_obj.subject("A message from the Ruby SDK using Message Builder!");
# Define the body of the message.
-mb_obj.set_text_body("This is the text body of the message!");
+mb_obj.body_text("This is the text body of the message!");
# Loop through all of your recipients
mb_obj.add_recipient(:to, "john.doe@example.com", {"first" => "John", "last" => "Doe"});
mb_obj.add_recipient(:to, "jane.doe@example.com", {"first" => "Jane", "last" => "Doe"});