LoginSignup
3
1

More than 5 years have passed since last update.

Pivotal Tracker APIを使って、見積もったポイントの合計を計算する

Posted at

Gemfile

source 'https://rubygems.org'

gem 'pivotal-tracker'

main.rb

require 'rubygems'
require 'pivotal-tracker'

PivotalTracker::Client.token = 'api token'
project_id = 12345
label = '見積もる分'

project = PivotalTracker::Project.find(project_id)

sum = 0

project.stories.all(label: label).each do |story|
  next if story.estimate == -1
  sum += story.estimate
end

puts sum

story.estimateが-1を返る場合はそのストーリーに見積もりが付いてない状態でした。

初期設定

  • PivotalTracker::Client.tokenにはapiトークンを設定します。
  • project_idには見積もりたいプロジェクトのidを設定します。
  • labelには、見積もりたいストーリーに例えば(見積もる分)みたいなラベル名を付けておいたのを設定します。
3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1