Intervals API
By Staplegun
Description
This gem is a wrapper around the Intervals REST API which allows you to retrieve, create, update, and delete several different resources from their database.
Usage
To begin, create an instance of your specific Intervals account using the account's API token. You can learn where to find that here.
intervals = IntervalsAPI::RequestHandler.new('your_token')
Now you're free to make your requests. The structure of a request looks like:
intervals.get(resource, )
Request Arguments
resource
Type: String
The endpoint resource you are querying
query_options
Type: Hash
Default: {}
A hash of options that you wish to query by. This could be filter options for a GET request, new object options for a POST request, etc.
View the Intervals documentation to learn about which resources and query options are available to use
Response
The response from Intervals API will contain all returned json data from Intervals in the form of a hash.
Request Type Examples
Get
# Retrieve all clients
response = intervals.get('/client/');
# Retrieve all active clients
response = intervals.get('/client/', { active: true });
Post
# Create a task request
intervals.post('/request/', {
personid: 5,
projectid: 6,
title: 'Just an average title'
})
Put
# Update a task request
intervals.put('/request/1/', {
priorityid: 1,
title: "Here's an updated title"
})
Delete
# Delete a task request
intervals.delete('/request/1/')
TODO
Build a test suite to test the API. If anyone has a great way to test an authenticated third-party API, throw out some ideas.
Intervals API is licensed under the GPL license.