lib/tracker_api/resources/story.rb in tracker_api-1.9.1 vs lib/tracker_api/resources/story.rb in tracker_api-1.10.0
- old
+ new
@@ -52,10 +52,11 @@
property :estimate
property :accepted_at
property :deadline
property :requested_by_id
property :owner_ids, if: ->(_) { !owner_ids.blank? }
+ property :project_id
# Use render_empty: false to address: https://github.com/dashofcode/tracker_api/issues/110
# - The default value of the labels attribute in Resources::Story is an empty array.
# - If the value of labels is not change (i.e. not dirty) then when a new Story
# is created from the dirty attributes in the save method the labels attributes becomes
@@ -160,9 +161,20 @@
def transitions(params = {})
if params.blank? && @transitions.present?
@transitions
else
@transitions = Endpoints::StoryTransitions.new(client).get(project_id, id, params)
+ end
+ end
+
+ # Returns the story's original ("undirtied") project_id
+ #
+ # @return Integer
+ def project_id
+ if dirty_attributes.key?(:project_id)
+ original_attributes[:project_id]
+ else
+ @project_id
end
end
# @param [Hash] params attributes to create the task with
# @return [Task] newly created Task