- Bundles a GitHub and a ZenHub client in one module API
- Derived from
tkm-kj/zenhub_ruby
- Extended ZenHub REST API
- Contains a
Rakefile
to build and un/re/install the local gem
rake build_gem
: Build the Zenhub gem locallyrake install_gem
: Install the local Zenhub gem filerake reinstall_gem
: Reinstall the local Zenhub gem filerake uninstall_gem
: Uninstall the local Zenhub gem file
-
Require the modules needed:
require 'dotenv' require 'zenhub'
-
I strongly recommend to put the API keys in an unversioned
.env
file and read that at the beginning:Dotenv.load
-
Define some issue numbers to use for tests:
issue_number = 13249 epic_number = 12146
-
Instantiate the client:
client = Zenhub::Client.new(ENV["ZH_TOKEN"], ENV["GH_TOKEN"])
-
Grab all the data you like:
issue = client.issue_data(ENV["REPO_NAME"], issue_number) board = client.board_data(ENV['REPO_NAME']) board.body['pipelines'].each do |value| puts "#{value['name']} - #{value['id']}" end epics = client.epics(ENV['REPO_NAME']) epics.body['epic_issues'].each do |value| puts "#{value['issue_number']} - #{value['issue_url']}" end epic = client.epic_data(ENV['REPO_NAME'], epic_number) epic.body['issues'].each do |value| puts "#{value['issue_number']} - #{value['is_epic']}" end