A wrapper for the SendWithUs API. Use at your own risk.
Add this line to your application's Gemfile:
gem'swoon'And then execute:
$ bundle
Or install it yourself as:
$ gem install swoon
api=Swoon::API.new(api_key: 'YOUR_API_KEY')api.templates.fetchapi.templates('tem_1234567890').fetchapi.templates('tem_1234567890').locales('en-US').fetchapi.templates('tem_1234567890').versions.fetchapi.templates('tem_1234567890').locales('en-US').versions.fetchapi.templates('tem_1234567890').versions('some-version-id').fetchapi.templates('tem_1234567890').locales('en-US').versions('some-version-id').fetchapi.templates('tem_1234567890').versions('some-version-id').update(html: '<html><head></head><body><h1>UPDATE</h1></body></html>',name: 'New Version',subject: 'edited!',text: 'sometext')api.templates('tem_1234567890').locales('en-US').versions('some-version-id').update(html: '<html><head></head><body><h1>UPDATE</h1></body></html>',name: 'New Version',subject: 'edited!',text: 'sometext')api.templates.create(html: '<html><head></head><body><h1>UPDATE</h1></body></html>',name: 'New Template',subject: 'Read me plz',text: 'sometext')api.templates('tem_1234567890').locales.create(params)api.templates('tem_1234567890').versions.create(params)api.templates('tem_1234567890').deleteapi.templates('tem_1234567890').locales('en-US').deleteapi.send(template: 'tem_A5RHVP6CnRbS34UysLjYHx',recipient: {name: 'John',address: 'user@email.com'},template_data: {amount: '$12.00'},cc: [{address: 'cc_one@email.com'},{address: 'cc_two@email.com'}],bcc: [{address: 'bcc_one@email.com'},{address: 'bcc_two@email.com'}],sender: {name: 'Company',address: 'company@company.com',reply_to: 'info@company.com'},tags: ['tag1','tag2','tag3'],headers: {'X-HEADER-ONE': 'header-value'},inline: {id: 'cat.png',data: '{BASE_64_ENCODED_FILE_DATA}'},files: [{id: 'doc.txt',data: '{BASE_64_ENCODED_FILE_DATA}'},{id: 'stuff.zip',data: '{BASE_64_ENCODED_FILE_DATA}'}],locale: 'en-US',esp_account: 'esp_1a2b3c4d5e',version_name: 'Version Name')After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.