Class: Trajectory::Story

Inherits:
Object
  • Object
show all
Includes:
Virtus
Defined in:
lib/trajectory/domain/story.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ true, false

Returns true if two stories are the sames i.e they share the same id attribute

Parameters:

  • other (Story)

    the other object to compare

Returns:

  • (true, false)


60
61
62
# File 'lib/trajectory/domain/story.rb', line 60

def ==(other)
  id == other.id
end

#archived?true, false

Returns true if the story has been archived, false otherwise.

Returns:

  • (true, false)

    true if the story has been archived, false otherwise



30
# File 'lib/trajectory/domain/story.rb', line 30

attribute :archived, Boolean

#assignee_nameString

Returns the name of the user assigned to the story.

Returns:

  • (String)

    the name of the user assigned to the story



9
# File 'lib/trajectory/domain/story.rb', line 9

attribute :assignee_name, String

#comments_countInteger

Returns number of comments of the story.

Returns:

  • (Integer)

    number of comments of the story



45
# File 'lib/trajectory/domain/story.rb', line 45

attribute :comments_count, Integer

#completed?true, false

Returns true if the story is completed i.e in :accepted state

Returns:

  • (true, false)


95
96
97
# File 'lib/trajectory/domain/story.rb', line 95

def completed?
  state == :accepted
end

#created_atDateTime

Returns the creation date of the story.

Returns:

  • (DateTime)

    the creation date of the story



17
# File 'lib/trajectory/domain/story.rb', line 17

attribute :created_at, DateTime

#deleted?ture, false

Returns true if the story has been deleted, false otherwise.

Returns:

  • (ture, false)

    true if the story has been deleted, false otherwise



38
# File 'lib/trajectory/domain/story.rb', line 38

attribute :deleted, Boolean

#design_neededtrue, false

Returns true if design is needed for the story, false otherwise.

Returns:

  • (true, false)

    true if design is needed for the story, false otherwise



23
# File 'lib/trajectory/domain/story.rb', line 23

attribute :design_needed, Boolean

#development_needed?true, false

Returns true if development is needed for the story, false otherwise.

Returns:

  • (true, false)

    true if development is needed for the story, false otherwise



35
# File 'lib/trajectory/domain/story.rb', line 35

attribute :development_needed, Boolean

#idInteger

Returns the unique identifier of the story.

Returns:

  • (Integer)

    the unique identifier of the story

Raises:



7
# File 'lib/trajectory/domain/story.rb', line 7

attribute :id, Integer, default: lambda { |project, attribute| raise MissingAttributeError.new(project, :id) }

#idea_subjectString

Returns the subject of the idea the story is attached to.

Returns:

  • (String)

    the subject of the idea the story is attached to



27
# File 'lib/trajectory/domain/story.rb', line 27

attribute :idea_subject, String

#in_iteration?(iteration) ⇒ true, false

Returns true if the story belongs to the given iteration, false otherwise

Parameters:

Returns:

  • (true, false)


110
111
112
# File 'lib/trajectory/domain/story.rb', line 110

def in_iteration?(iteration)
  iteration_id == iteration.id
end

#iterationIteration, false

Returns the iteration the story belongs to or false if iteration can’t be found

Returns:

  • (Iteration, false)

    the iteration or false



118
119
120
# File 'lib/trajectory/domain/story.rb', line 118

def iteration
  @iteration ||= DataStore.find_iteration_of_project_by_id(project, iteration_id)
end

#iteration_idInteger

Returns iteration id the story belongs to.

Returns:

  • (Integer)

    iteration id the story belongs to

See Also:



53
# File 'lib/trajectory/domain/story.rb', line 53

attribute :iteration_id, Integer

#not_completed?true, false

Returns true if the story is not completed i.e not in :accepted state

Returns:

  • (true, false)


88
89
90
# File 'lib/trajectory/domain/story.rb', line 88

def not_completed?
  !completed?
end

#pointsInteger

Returns estimation in points of the story complexity.

Returns:

  • (Integer)

    estimation in points of the story complexity



32
# File 'lib/trajectory/domain/story.rb', line 32

attribute :points, Integer

#positionInteger

The Integer position of the story in the backlog. Lower is higher.

Returns:

  • (Integer)

    the position of the story



15
# File 'lib/trajectory/domain/story.rb', line 15

attribute :position, Integer

#projectProject

Fetch the project the story belongs to

Returns:



67
68
69
# File 'lib/trajectory/domain/story.rb', line 67

def project
  @project ||= DataStore.find_project_by_id(project_id)
end

#project_idInteger

Returns project id the story belongs to.

Returns:

  • (Integer)

    project id the story belongs to

See Also:



50
# File 'lib/trajectory/domain/story.rb', line 50

attribute :project_id, Integer

#started?true, false

Returns true if the story is started i.e in :started state

Returns:

  • (true, false)


74
75
76
# File 'lib/trajectory/domain/story.rb', line 74

def started?
  state == :started
end

#stateSymbol

Returns state of the story in [:started, :unstarted, :delivered, :accepted, :rejected].

Returns:

  • (Symbol)

    state of the story in [:started, :unstarted, :delivered, :accepted, :rejected]



47
# File 'lib/trajectory/domain/story.rb', line 47

attribute :state, Symbol

#state_eventsArray<Symbol>

Returns the valid states the story can transition to.

Returns:

  • (Array<Symbol>)

    the valid states the story can transition to



19
# File 'lib/trajectory/domain/story.rb', line 19

attribute :state_events, Array[Symbol]

#task_typeString

Returns the type of story as “Feature”, “Bug”, “Todo” or “Milestone”.

Returns:

  • (String)

    the type of story as “Feature”, “Bug”, “Todo” or “Milestone”



11
# File 'lib/trajectory/domain/story.rb', line 11

attribute :task_type, String

#titleString

Returns the title of the story.

Returns:

  • (String)

    the title of the story



21
# File 'lib/trajectory/domain/story.rb', line 21

attribute :title, String

#unstarted?true, false

Returns true if the story is not started i.e in :unstarted state

Returns:

  • (true, false)


81
82
83
# File 'lib/trajectory/domain/story.rb', line 81

def unstarted?
  state == :unstarted
end

#updated_atDateTime

Returns the last modification date of the story.

Returns:

  • (DateTime)

    the last modification date of the story



25
# File 'lib/trajectory/domain/story.rb', line 25

attribute :updated_at, DateTime

#userUser

Fetch the user that created the story

Returns:



102
103
104
# File 'lib/trajectory/domain/story.rb', line 102

def user
  @user ||= DataStore.find_user_of_project_with_id(project, user_id)
end

#user_idInteger

Returns id of the user that created the story.

Returns:

  • (Integer)

    id of the user that created the story

See Also:



43
# File 'lib/trajectory/domain/story.rb', line 43

attribute :user_id, Integer

#user_nameString

Returns name of the user that created the story.

Returns:

  • (String)

    name of the user that created the story



40
# File 'lib/trajectory/domain/story.rb', line 40

attribute :user_name, String