Remind101
A thin Ruby client for the Remind101 API.
Installation
Add this line to your application's Gemfile:
gem 'remind101'
Usage
remind101 = Remind101::Client.new(auth_token: 'token')
groups
Returns an Array
of Hashie::Mash
's for all the groups for the currently
logged in user.
remind101.groups
# => [{ ... }]
create_group
Creates the group and returns a Hashie::Mash
.
remind101.create_group class_name: 'Math 101'
destroy_group
Destroys the group with the given id
.
remind101.destroy_group 1234
messages
Returns an Array
of Hashie::Mash
's for all the messages for the currently
logged in user.
remind101.
# => [{ ... }]
send_message
Send a new message to all subscribers of the given group. Returns a
Hashie::Mash
for the created message.
remind101. body: 'Be ready for the test tomorrow!', group_ids: [1234]
# => { id: 4321, body: 'Be ready for the test tomorrow!' }
cancel_message
Attempts to destroy (cancel) a message.
remind101. 4321
# => true
subscribers
Returns an Array
of Hashie::Mash
's for all the subscribers of the given
group.
remind101.subscribers 1234
# => [{ ... }]
Validation Errors
When a validation error is returned (HTTP 422), a
Remind101::Error::ValidationError
with be raised. The #error
method on this
object will be a key/val hash of the errors.
begin
remind101.create_group! class_name: '1'
rescue Remind101::Error::ValidationError => e
e.error.each do |attribute, errors|
p "#{attribute}: #{errors}"
end
end
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