Skip to content

Commit

Permalink
Merge pull request #117 from john-denisov/patch-1
Browse files Browse the repository at this point in the history
add syntax highlighting to examples in readme
  • Loading branch information
jsmestad committed Mar 24, 2016
2 parents 1647cbc + d498670 commit 51f0c73
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,51 +22,51 @@ This will become the `v1.x` release.
* Support for SSL protected repositories

## Overview
```ruby
PivotalTracker::Client.token('myusername@email.com', 'secretpassword') # Automatically fetch API Token
PivotalTracker::Client.token = 'jkfduisj97823974j2kl24899234' # Manually set API Token

PivotalTracker::Client.token('myusername@email.com', 'secretpassword') # Automatically fetch API Token
PivotalTracker::Client.token = 'jkfduisj97823974j2kl24899234' # Manually set API Token
PivotalTracker::Client.timeout = 50 # Set timeout on the connection with pivotal. Default is 60 seconds

PivotalTracker::Client.timeout = 50 # Set timeout on the connection with pivotal. Default is 60 seconds
@projects = PivotalTracker::Project.all # return all projects
@a_project = PivotalTracker::Project.find(84739) # find project with a given ID

@projects = PivotalTracker::Project.all # return all projects
@a_project = PivotalTracker::Project.find(84739) # find project with a given ID
@a_project.stories.all # return all stories for "a_project"
@a_project.stories.all(:label => 'overdue', :story_type => ['bug', 'chore']) # return all stories that match the passed filters
@a_project.stories.find(847762630) # find story with a given ID

@a_project.stories.all # return all stories for "a_project"
@a_project.stories.all(:label => 'overdue', :story_type => ['bug', 'chore']) # return all stories that match the passed filters
@a_project.stories.find(847762630) # find story with a given ID
@a_project.stories.create(:name => 'My Story', :story_type => 'feature') # create a story for this project

@a_project.stories.create(:name => 'My Story', :story_type => 'feature') # create a story for this project
# all tracker defined filters are allowed, as well as :limit & :offset for pagination

# all tracker defined filters are allowed, as well as :limit & :offset for pagination
# The below pattern below is planned to be added to the final release:

# The below pattern below is planned to be added to the final release:
@a_project.stories << PivotalTracker::Story.new(84739, :name => 'Ur Story') # same as earlier story creation, useful for copying/cloning from proj

@a_project.stories << PivotalTracker::Story.new(84739, :name => 'Ur Story') # same as earlier story creation, useful for copying/cloning from proj

@story = @a_project.stories.find(847762630)
@story.notes.all # return all notes (comments) for a story
@story.notes.create(:text => 'A new comment', :noted_at => '06/29/2010 05:00 EST') # add a new note

@story = @a_project.stories.find(847762630)
@story.notes.all # return all notes (comments) for a story
@story.notes.create(:text => 'A new comment', :noted_at => '06/29/2010 05:00 EST') # add a new note
@story.tasks.all # return all tasks for a story
@story.tasks.create(:description => 'Task Description') # add a new task

@story.tasks.all # return all tasks for a story
@story.tasks.create(:description => 'Task Description') # add a new task

@story.attachments # return an array of all attachment items (data only, not the files)
@story.upload_attachment(file_path) # add a file attachment to @story that can be found at file_path

@story.attachments # return an array of all attachment items (data only, not the files)
@story.upload_attachment(file_path) # add a file attachment to @story that can be found at file_path

# All 4 examples below return a PivotalTracker::Story from the new project, with the same story ID

# All 4 examples below return a PivotalTracker::Story from the new project, with the same story ID
@story.move_to_project(123456) # move @story to the project with ID 123456
@story.move_to_project('123456') # same as above
@story.move_to_project(@project) # move @story to @project
@story.move_to_project(@another_story) # move @story into the same project as @another_story

@story.move_to_project(123456) # move @story to the project with ID 123456
@story.move_to_project('123456') # same as above
@story.move_to_project(@project) # move @story to @project
@story.move_to_project(@another_story) # move @story into the same project as @another_story


# Connect to custom API endpoint
PivotalTracker::Client.tracker_host = 'www.my-pivotal-tracker.com'

# Connect to custom API endpoint
PivotalTracker::Client.tracker_host = 'www.my-pivotal-tracker.com'
```
The API is based on the following this gist: http://gist.github.com/283120

## Additional Information
Expand Down

0 comments on commit 51f0c73

Please sign in to comment.