Expresspigeon::Ruby
This is a Ruby library for convenince access to ExpressPigeon API.
Installation
Add this line to your application's Gemfile:
gem 'expresspigeon-ruby'
And then execute:
$ bundle
Or install it yourself as:
$ gem install expresspigeon-ruby
Sending a simple message
Sending a transactional message is easy:
MESSAGES = ExpressPigeon::API..auth_key 'XXX'
= MESSAGES. 115, # template ID
'[email protected]', # send to
'[email protected]', # reply to
"Jane Dow", # senders name
'Hi there!', # subject
# hash with custom content to merge
content: "hello, there!"
puts
# need to wait before message information is written to DB
sleep 5
# get a report for a specific message
puts MESSAGES.report .id
Sending a message with attachments
MESSAGES = ExpressPigeon::API..auth_key(ENV['AUTH_KEY'])
= %W{attachments/attachment1.txt attachments/smile.pdf attachments/example.ics}
puts MESSAGES.(
123, # template_id
'[email protected]', #to
'[email protected]', #reply_to
"Jane Doe", #from_name
"Want to get out for a dinner?", #subject
{first_name: 'Igor', eye_color: 'blue'}, #merge_fields
false, #view_online
true, #click_tracking
true, #suppress_address
#file paths to upload as attachments
)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request