Class: Twigg::Pivotal::Project
- Defined in:
- lib/twigg-pivotal/pivotal/project.rb
Overview
Models the project resource in Pivotal Tracker.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#pivotal_id ⇒ Object
readonly
Returns the value of attribute pivotal_id.
Class Method Summary collapse
-
.projects ⇒ Object
Returns an array of all projects accessible with the configured access token.
Instance Method Summary collapse
-
#initialize(json) ⇒ Project
constructor
A new instance of Project.
-
#stories ⇒ Object
Returns the open stories for this project.
Constructor Details
#initialize(json) ⇒ Project
Returns a new instance of Project.
16 17 18 19 |
# File 'lib/twigg-pivotal/pivotal/project.rb', line 16 def initialize(json) raise ArgumentError unless @pivotal_id = json['id'] raise ArgumentError unless @name = json['name'] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/twigg-pivotal/pivotal/project.rb', line 5 def name @name end |
#pivotal_id ⇒ Object (readonly)
Returns the value of attribute pivotal_id.
5 6 7 |
# File 'lib/twigg-pivotal/pivotal/project.rb', line 5 def pivotal_id @pivotal_id end |
Class Method Details
.projects ⇒ Object
Returns an array of all projects accessible with the configured access token.
10 11 12 13 |
# File 'lib/twigg-pivotal/pivotal/project.rb', line 10 def projects results = get 'projects', fields: 'name', paginate: false results.map { |project| new(project) } end |