Class: PivotalToTrello::PivotalWrapper
- Inherits:
-
Object
- Object
- PivotalToTrello::PivotalWrapper
- Defined in:
- lib/pivotal_to_trello/pivotal_wrapper.rb
Overview
Interface to the Pivotal Tracker API.
Instance Method Summary collapse
-
#initialize(token) ⇒ PivotalWrapper
constructor
Constructor.
-
#project(project_id) ⇒ Object
Returns the Pivotal project that we’re exporting.
-
#project_choices ⇒ Object
Returns a hash of available projects keyed on project ID.
-
#stories(project_id) ⇒ Object
Returns all stories for the given project.
Constructor Details
#initialize(token) ⇒ PivotalWrapper
Constructor
9 10 11 |
# File 'lib/pivotal_to_trello/pivotal_wrapper.rb', line 9 def initialize(token) @client = TrackerApi::Client.new(token: token) end |
Instance Method Details
#project(project_id) ⇒ Object
Returns the Pivotal project that we’re exporting.
26 27 28 29 |
# File 'lib/pivotal_to_trello/pivotal_wrapper.rb', line 26 def project(project_id) @projects ||= {} @projects[project_id] ||= @client.project(project_id) end |
#project_choices ⇒ Object
Returns a hash of available projects keyed on project ID.
14 15 16 17 18 |
# File 'lib/pivotal_to_trello/pivotal_wrapper.rb', line 14 def project_choices @client.projects.each_with_object({}) do |project, hash| hash[project.id] = project.name end end |
#stories(project_id) ⇒ Object
Returns all stories for the given project.
21 22 23 |
# File 'lib/pivotal_to_trello/pivotal_wrapper.rb', line 21 def stories(project_id) @client.project(project_id).stories.sort_by(&:created_at) end |