Mail-in-a-Box Ruby API
Mailinabox::Api is a lighweight Ruby API client for interacting with Mail-in-a-Box's API endpoints.
Installation
Add this line to your application's Gemfile:
gem 'mailinabox-api'
And then execute:
$ bundle
Or install it yourself as:
$ gem install mailinabox-api
Usage
- Configure the client using Mailinabox::Api.configure (if you're using Rails, put this in an initializer):
::Mailinabox::Api.configure do |config|
config.host = "HOSTNAME"
config.user = "USER"
config.password = "PASSWORD"
end
- Initialize the client:
client = Mailinabox::Api::Client.new
- Invoke any of the available endpoints:
-
#users - get all users, you can specify domain: 'DOMAIN' to only returned a filtered list for a specific domain
-
#add_user(email:, password:) - create a new user. Note that password must be at least 8 characters.
-
#remove_user(email:) - remove a user
-
#add_user_privilege(email:, privilege: :admin) - add a user privilege
-
#remove_user_privilege(email:, privilege: :admin) - remove a user privilege
Development
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.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/SebastianJ/mailinabox-api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the Mailinabox::Api project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.