RubySwift
A ruby wrapper of the Swift Digital Suite Mail House API.
This is currently a relatively crude wrapper and does not tidy responses from Swift a lot. Contributions are welcome.
Version 1.0.0 introduced breaking changes on the way the wrapper returns responses.
INSTALLATION
You can install the library via Rubygems:
$ gem install ruby-swift
Or within your Gemfile if you're using Bundler:
gem "ruby-swift"
USAGE
Initialize the connection:
swift = RubySwift.new("API_PASSWORD")
Helpers:
swift.person_exists?("[email protected]") # -> true
API methods:
Read a person:
person = swift.read_person("[email protected]") # -> {:status => 0, :response => {...}}
Add someone to a mail group:
swift.add_group_member("[email protected]", "Group Name") # -> {:status => 0, :response => true}
Remove someone from a mail group:
swift.remove_group_member("[email protected]", "Group Name") # -> {:status => 0, :response => true}
Create a person:
swift.write_person(email: "[email protected]", first_name: "Dennis", last_name: "Ritchie") # -> {:status => 0, :response => true}
Update person:
swift.update_person(email: "[email protected]", first_name: "Donald", last_name: "Knuth") # -> {:status => 0, :response => true}
Create or update existing person:
swift.write_or_update_person(email: "[email protected]", first_name: "Dennis", last_name: "Ritchie") # -> {:status => 0, :response => true}
Create a group:
swift.write_group("Group name") # -> {:status => 0, :response => true}
Read all groups:
groups = swift.read_groups # -> {:status => 0, :response => ["group1", "group2", ...]}
Read all members of a group:
people = swift.read_persons("Group Name") # -> {:status => 0, :response => [{...}, ...]}
Remove a group:
swift.remove_group("Group Name") # -> {:status => 0, :response => true}
Remove a person:
swift.remove_person("[email protected]") # -> {:status => 0, :response => true}
TODO
- Allow custom fields in write/update