Class: PivotalAPI::Story
Direct Known Subclasses
Instance Attribute Summary collapse
-
#accepted_at ⇒ Object
Returns the value of attribute accepted_at.
-
#after_id ⇒ Object
Returns the value of attribute after_id.
-
#before_id ⇒ Object
Returns the value of attribute before_id.
-
#comment_ids ⇒ Object
Returns the value of attribute comment_ids.
-
#comments ⇒ Object
Returns the value of attribute comments.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#current_state ⇒ Object
Returns the value of attribute current_state.
-
#cycle_time_details ⇒ Object
Returns the value of attribute cycle_time_details.
-
#deadline ⇒ Object
Returns the value of attribute deadline.
-
#description ⇒ Object
Returns the value of attribute description.
-
#estimate ⇒ Object
Returns the value of attribute estimate.
-
#external_id ⇒ Object
Returns the value of attribute external_id.
-
#follower_ids ⇒ Object
Returns the value of attribute follower_ids.
-
#followers ⇒ Object
Returns the value of attribute followers.
-
#has_attachments ⇒ Object
Returns the value of attribute has_attachments.
-
#id ⇒ Object
Returns the value of attribute id.
-
#integration_id ⇒ Object
Returns the value of attribute integration_id.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#label_ids ⇒ Object
Returns the value of attribute label_ids.
-
#labels ⇒ Object
Returns the value of attribute labels.
-
#name ⇒ Object
Returns the value of attribute name.
-
#owner_ids ⇒ Object
Returns the value of attribute owner_ids.
-
#owners ⇒ Object
Returns the value of attribute owners.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
-
#requested_by ⇒ Object
Returns the value of attribute requested_by.
-
#requested_by_id ⇒ Object
Returns the value of attribute requested_by_id.
-
#story_type ⇒ Object
Returns the value of attribute story_type.
-
#task_ids ⇒ Object
Returns the value of attribute task_ids.
-
#tasks ⇒ Object
Returns the value of attribute tasks.
-
#transitions ⇒ Object
Returns the value of attribute transitions.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from PivotalAPI::Base
Instance Attribute Details
#accepted_at ⇒ Object
Returns the value of attribute accepted_at.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def accepted_at @accepted_at end |
#after_id ⇒ Object
Returns the value of attribute after_id.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def after_id @after_id end |
#before_id ⇒ Object
Returns the value of attribute before_id.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def before_id @before_id end |
#comment_ids ⇒ Object
Returns the value of attribute comment_ids.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def comment_ids @comment_ids end |
#comments ⇒ Object
Returns the value of attribute comments.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def comments @comments end |
#created_at ⇒ Object
Returns the value of attribute created_at.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def created_at @created_at end |
#current_state ⇒ Object
Returns the value of attribute current_state.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def current_state @current_state end |
#cycle_time_details ⇒ Object
Returns the value of attribute cycle_time_details.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def cycle_time_details @cycle_time_details end |
#deadline ⇒ Object
Returns the value of attribute deadline.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def deadline @deadline end |
#description ⇒ Object
Returns the value of attribute description.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def description @description end |
#estimate ⇒ Object
Returns the value of attribute estimate.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def estimate @estimate end |
#external_id ⇒ Object
Returns the value of attribute external_id.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def external_id @external_id end |
#follower_ids ⇒ Object
Returns the value of attribute follower_ids.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def follower_ids @follower_ids end |
#followers ⇒ Object
Returns the value of attribute followers.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def followers @followers end |
#has_attachments ⇒ Object
Returns the value of attribute has_attachments.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def @has_attachments end |
#id ⇒ Object
Returns the value of attribute id.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def id @id end |
#integration_id ⇒ Object
Returns the value of attribute integration_id.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def integration_id @integration_id end |
#kind ⇒ Object
Returns the value of attribute kind.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def kind @kind end |
#label_ids ⇒ Object
Returns the value of attribute label_ids.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def label_ids @label_ids end |
#labels ⇒ Object
Returns the value of attribute labels.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def labels @labels end |
#name ⇒ Object
Returns the value of attribute name.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def name @name end |
#owner_ids ⇒ Object
Returns the value of attribute owner_ids.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def owner_ids @owner_ids end |
#owners ⇒ Object
Returns the value of attribute owners.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def owners @owners end |
#project_id ⇒ Object
Returns the value of attribute project_id.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def project_id @project_id end |
#requested_by ⇒ Object
Returns the value of attribute requested_by.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def requested_by @requested_by end |
#requested_by_id ⇒ Object
Returns the value of attribute requested_by_id.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def requested_by_id @requested_by_id end |
#story_type ⇒ Object
Returns the value of attribute story_type.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def story_type @story_type end |
#task_ids ⇒ Object
Returns the value of attribute task_ids.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def task_ids @task_ids end |
#tasks ⇒ Object
Returns the value of attribute tasks.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def tasks @tasks end |
#transitions ⇒ Object
Returns the value of attribute transitions.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def transitions @transitions end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def updated_at @updated_at end |
#url ⇒ Object
Returns the value of attribute url.
85 86 87 |
# File 'lib/pivotal-tracker-api/story.rb', line 85 def url @url end |
Class Method Details
.fields ⇒ Object
93 94 95 96 97 98 99 100 |
# File 'lib/pivotal-tracker-api/story.rb', line 93 def self.fields ['url', 'name', 'description', 'story_type', 'estimate', 'current_state', 'requested_by', 'owners', 'labels', 'integration_id', 'deadline', "comments(#{PivotalAPI::Comment.fields.join(',')})", 'tasks', 'transitions', 'followers', 'cycle_time_details', 'accepted_at'] end |
.from_json(json) ⇒ Object
102 103 104 |
# File 'lib/pivotal-tracker-api/story.rb', line 102 def self.from_json(json) parse_json_story(json) end |
Instance Method Details
#hours ⇒ Object
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/pivotal-tracker-api/story.rb', line 106 def hours return 0 if transitions.nil? duration_hrs = 0 started = nil transitions.each do |transition| case transition.state when 'started' started = Time.parse(transition.occurred_at.to_s) when 'finished' duration_hrs += hours_between(started, Time.parse(transition.occurred_at.to_s)) if started end end if current_state == 'accepted' duration_hrs += hours_between(started, Time.parse(accepted_at.to_s)) elsif current_state != 'accepted' && started duration_hrs += hours_between(started, Time.now) end duration_hrs end |
#overdue? ⇒ Boolean
128 129 130 |
# File 'lib/pivotal-tracker-api/story.rb', line 128 def overdue? hours >= estimate end |