A Ruby client library for using the Mailgun web service.
Add this line to your application's
And then execute:
Or install it yourself as:
$ gem install pew_pew
You must have a valid API key to use the Mailgun API. If you don't yet have one, you can sign up here.
You can use the following method to configure your API key and domain:
PewPew.configure do |config| config.api_key = ENV['MAILGUN_API_KEY'] config.domain = ENV['MAILGUN_DOMAIN'] # optional end
If you'd like to use multiple instances of the API with different keys, you can
PewPew::Client directly and treat those instances the same as you
pew_pew = PewPew::Client.new pew_pew.configure do |config| config.api_key = ENV['MAILGUN_API_KEY'] config.domain = ENV['MAILGUN_DOMAIN'] # optional end
Once the API key has been configured, resources can be called on the
module directly or off your client instances:
PewPew..send_email( to: 'email@example.com', from: 'firstname.lastname@example.org', subject: 'Test', text: 'This is a test message.' )
For resources that require a domain, you may pass it as an option when calling the resource. If a domain has been configured, it will be used as the default.
PewPew.stats.all # uses the configured domain PewPew.stats(domain: 'example.com').all # uses example.com
- 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 a new Pull Request