README.md in emaildirect-1.3.4 vs README.md in emaildirect-2.0.0
- old
+ new
@@ -1,12 +1,14 @@
# Note
-EmailDirect is now [Campaigner](http://campaigner.com/). `v2.0.0` will address all these changes.
+
+EmailDirect is now [Campaigner](http://campaigner.com/).
+The API endpoint, https://edapi.campaigner.com/v1/, was created by Campaigner to handle old EmailDirect API.
Use `v1.3.4` if you use `Hashie >= 3.0.0`.
# emaildirect
-A ruby library which implements the complete functionality of the REST (v5) [Email Direct API](https://docs.emaildirect.com).
+A ruby library which implements the complete functionality of the REST [Campaigner EmailDirect API](https://media.campaigner.com/apidocs/edapi/#overview).
## Installation
### Plain ruby
gem install emaildirect
@@ -35,44 +37,44 @@
1: Publication One
2: Publication Two
### Create, then remove a Publication
- response = EmailDirect::Publication.create('Test', :Description => 'Test Publication')
+ response = EmailDirect::Publication.create('Test', Description: 'Test Publication')
sub = EmailDirect::Publication.new(response.publicationID)
sub.delete
### Updating a subscriber's custom fields
A single attribute:
- EmailDirect::Subscriber.new(email).update_custom_field :FirstName, 'Pat'
+ EmailDirect::Subscriber.new(email).update_custom_field(:FirstName, 'Pat')
Multiple attributes:
- EmailDirect::Subscriber.new(email).update_custom_fields :FirstName => 'Pam', :LastName => 'Sinivas'
+ EmailDirect::Subscriber.new(email).update_custom_fields(FirstName: 'Pam', LastName: 'Sinivas')
When creating a subscriber
- EmailDirect::Subscriber.create(email, :Publications => [1], :CustomFields => { :FirstName => 'Pam', :LastName => 'Sinivas' }
+ EmailDirect::Subscriber.create(email, Publications: [1], CustomFields: { FirstName: 'Pam', LastName: 'Sinivas' })
### ActionMailer integration
You can use send your ActionMailer email through Email Direct using their Relay Send functionality by setting up a new delivery method in an initalizer:
ActionMailer::Base.add_delivery_method :emaildirect, EmailDirect::Mailer,
- :category_id => 1,
- :options => { :Force => true }
+ category_id: 1,
+ options: { Force: true }
And in your ActionMailer class:
- defaults :delivery_method => :emaildirect
+ defaults delivery_method: :emaildirect
or for just a particular message:
def welcome(user) do
- mail :to => user.email,
- :delivery_method => :emaildirect
+ mail to: user.email,
+ delivery_method: :emaildirect
end
### Handling errors
If the emaildirect API returns an error, an exception will be thrown. For example, if you attempt to create a subscriber with an invalid email address:
@@ -96,11 +98,10 @@
A helper method is provided to disable talking to the EmailDirect REST server (requires the [Fakeweb gem](http://fakeweb.rubyforge.org/))
EmailDirect.disable
### Expected input and output
-The best way of finding out the expected input and output of a particular method in a particular class is to read the [API docs](https://docs.emaildirect.com)
-and take a look at the code for that function.
+The best way of finding out the expected input and output of a particular method in a particular class is to read the [API docs](https://media.campaigner.com/apidocs/edapi/#overview) and take a look at the code for that function.
## Credits
- Jason Rust
- [createsend-ruby](https://github.com/campaignmonitor/createsend-ruby) library for inspiration on how to write a decent REST API wrapper.