Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
EmailDirect is now Campaigner.
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
.
A ruby library which implements the complete functionality of the REST Campaigner EmailDirect API.
gem install emaildirect
require 'emaildirect'
EmailDirect.api_key = 'your_api_key'
In your gemfile:
gem 'emaildirect'
In an initializer:
EmailDirect.api_key = 'your_api_key'
EmailDirect::Publication.all.Publications.each do |pub|
puts "#{pub.PublicationID}: #{pub.Name}"
end
Results in:
1: Publication One
2: Publication Two
response = EmailDirect::Publication.create('Test', Description: 'Test Publication')
sub = EmailDirect::Publication.new(response.publicationID)
sub.delete
A single attribute:
EmailDirect::Subscriber.new(email).update_custom_field(:FirstName, 'Pat')
Multiple attributes:
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' })
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 }
And in your ActionMailer class:
defaults delivery_method: :emaildirect
or for just a particular message:
def welcome(user) do
mail to: user.email,
delivery_method: :emaildirect
end
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:
begin
response = EmailDirect::Subscriber.create('bademail')
rescue EmailDirect::BadRequest => br
puts "Bad request error: #{br}"
puts "Error Code: #{br.data.ErrorCode}"
puts "Error Message: #{br.data.Message}"
rescue Exception => e
puts "Error: #{e}"
end
Results in:
Bad request error: The EmailDirect API responded with the following error - 101: Invalid Email Address
Error Code: 101
Error Message: Invalid Email Address
A helper method is provided to disable talking to the EmailDirect REST server (requires the Fakeweb gem)
EmailDirect.disable
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 and take a look at the code for that function.
FAQs
Unknown package
We found that emaildirect demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.