This gem allows you to easily use the Pivotal Tracker v5 API.
It’s powered by Faraday and Virtus.
Dash of Agile uses tracker_api to create agile dashboards from Pivotal Tracker projects.
Add this line to your application's Gemfile:
gem'tracker_api'And then execute:
$ bundle installOr install it yourself as:
$ gem install tracker_apiclient=TrackerApi::Client.new(token: 'my-api-token')# Create API clientclient.me.email# Get email for the authenticated personclient.activity# Get a list of all the activity performed the authenticated personclient.notifications# Get notifications for the authenticated personprojects=client.projects# Get all projectsproject=client.project(123456)# Find project with given IDproject.activity# Get a list of all the activity performed on this projectproject.stories# Get all stories for a projectproject.stories(with_state: :unscheduled,limit: 10)# Get 10 unscheduled stories for a projectproject.stories(filter: 'requester:OWK label:"jedi stuff"')# Get all stories that match the given filtersproject.create_story(name: 'Destroy death star')# Create a story with the name 'Destroy death star'project.search('Destroy death star')# Get a search result with all epics and stories relevant to the querystory=project.story(847762630)# Find a story with the given IDstory.activity# Get a list of all the activity performed on this storystory.transitions# Get a list of all the story transitions on this storystory.name='Save the Ewoks'# Update a single story attributestory.attributes={name: 'Save the Ewoks',description: '...'}# Update multiple story attributesstory.add_label('Endor')# Add a new label to an existing storystory.save# Save changes made to a storystory=client.story(117596687)# Get a story with story ID onlystory=TrackerApi::Resources::Story.new(client: client,project_id: 123456,id: 847762630)# Use the Story resource to get the storycomments=story.comments# comments without first fetching the storycomment=story.create_comment(text: "Use the force!")# Create a new comment on the storycomment=story.create_comment(text: "Use the force again !",# Create a new comment on the story withfiles: ['path/to/an/existing/file'])# file attachmentscomment.text += " (please be careful)"comment.save# Update text of an existing commentcomment.delete# Delete an existing commentcomment.create_attachments(files: ['path/to/an/existing/file'])# Add attachments to existing commentcomment.delete_attachments# Delete all attachments from a commentattachments=comment.attachments# Get attachments associated with a commentattachments.first.delete# Delete a specific attachmentcomment.attachments(reload: true)# Re-load the attachments after modificationtask=story.tasks.first# Get story taskstask.complete=truetask.save# Mark a task completeepics=project.epics# Get all epics for a projectepic=epics.firstlabel=epic.label# Get an epic's labelworkspaces=client.workspaces# Get person's multi-project workspacesSee Pivotal Tracker API documentation for how to use the fields parameter.
client=TrackerApi::Client.new(token: 'my-api-token')# Create API clientclient.project(project_id,fields: ':default,labels(name)')# Eagerly get labels with a projectclient.project(project_id,fields: ':default,epics')# Eagerly get epics with a projectclient.project(project_id).stories(fields: ':default,tasks')# Eagerly get stories with tasksstory.comments(fields: ':default,person')# Eagerly get comments and the person that made the comment for a storyTrackerApi::Errors::ClientError is raised for 4xx HTTP status codesTrackerApi::Errors::ServerError is raised for 5xx HTTP status codes
Direct mutation of an attribute value skips coercion and dirty tracking. Please use direct assignment or the specialized add_* methods to get expected behavior. https://github.com/solnic/virtus#important-note-about-member-coercions
This will cause coercion and dirty tracking to be bypassed and the new label will not be saved.
story=project.story(847762630)label=TrackerApi::Resources::Label.new(name: 'Special Snowflake')# BADstory.labels << labelstory.save# GOODstory.labels=story.labels.dup.push(label)story.save- Add missing resources and endpoints
- Add create, update, delete for resources
- Error handling for error responses
Given a version number MAJOR.MINOR.PATCH, increment the:
- MAJOR version when you make incompatible API changes,
- MINOR version when you add functionality in a backwards-compatible manner, and
- PATCH version when you make backwards-compatible bug fixes.
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
Currently this client supports read-only access to Pivotal Tracker. We will be extending it as our use cases require, but are always happy to accept contributions.
- 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