youtrack-rest-client
Ruby client for the Youtrack REST API
Usage
Installation
Using bundler:
bundle add youtrack_client
Authentication
With your permanent token ( see Manage-Permanent-Token):
require 'youtrack'
# 1. create an instance, pass your youtrack instance url and access token
youtrack = Youtrack::Client.new(base_url: "https://example.myjetbrains.com", token: "perm:your-token")
# 2. make requests!
youtrack.users.current.email
# get the current user
youtrack.users.current
# get all users
youtrack.users.all
# search users
youtrack.users.all("query" => "admin")
# get a user by id
youtrack.users.by_id('1-1')
# get all projects
youtrack.projects.all
# search projects
youtrack.projects.all(query: "DEMO")
# get a project by its id
youtrack.projects.by_id('0-0')
# search/list issues
youtrack.issues.search('project: T1')
# get issue by id
youtrack.issues.by_id('T1-2')
# delete an issue
youtrack.issues.delete('2-2')
# create a new issue
youtrack.issues.create({
summary: 'lorem ipsum',
description: 'created using rest api',
project: {
id: '0-0'
}
})
# you can also pass a model instance
youtrack.issues.create(Youtrack::Models::Issue.new(summary: "demo issue",
description: "demo issue description",
project: youtrack.projects.by_id("0-0")))
# execute command for issue(s)
youtrack.issues.command("State Open", youtrack.issues.search("DEMO-12"))
# pass the ids directly
youtrack.issues.command("State Open", %w[T1-1 T1-2 T1-3])
Contributing
If you encounter any missing features or bugs, you're welcome to open an Issue! PRs are welcome too ;-)
- Fork it ( https://github.com/shanehofstetter/youtrack-rest-client-ruby/fork )
- 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 a new Pull Request