Class: TrackerDeliveries::PivotalTracker
- Inherits:
-
Object
- Object
- TrackerDeliveries::PivotalTracker
- Defined in:
- lib/pivotal_tracker.rb
Constant Summary collapse
- PIVOTAL_API_URL =
'https://www.pivotaltracker.com/services/v5/'
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
Instance Method Summary collapse
- #delivered_stories ⇒ Object
-
#initialize(project_id, api_key, options = {}) ⇒ PivotalTracker
constructor
A new instance of PivotalTracker.
- #story_formatter(story) ⇒ Object
- #wrap_output(output) ⇒ Object
Constructor Details
#initialize(project_id, api_key, options = {}) ⇒ PivotalTracker
Returns a new instance of PivotalTracker.
9 10 11 12 13 14 15 |
# File 'lib/pivotal_tracker.rb', line 9 def initialize project_id, api_key, = {} @api_key = api_key @project_id = project_id @format_tools = TrackerDeliveries::FormatTools.new [:format] || :plaintext @api = Blanket.wrap PIVOTAL_API_URL, headers: { 'X-TrackerToken' => @api_key } end |
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
7 8 9 |
# File 'lib/pivotal_tracker.rb', line 7 def api @api end |
Instance Method Details
#delivered_stories ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/pivotal_tracker.rb', line 17 def delivered_stories = {with_state: "delivered"} wrap_output(api .projects(@project_id) .stories .get(params: ) .payload .map{|s| story_formatter s } .join("\n")) end |
#story_formatter(story) ⇒ Object
32 33 34 |
# File 'lib/pivotal_tracker.rb', line 32 def story_formatter story @format_tools.story_formatter story end |
#wrap_output(output) ⇒ Object
28 29 30 |
# File 'lib/pivotal_tracker.rb', line 28 def wrap_output output @format_tools.wrap_output output end |