Class: TrackerApi::Resources::Epic

Inherits:
Object
  • Object
show all
Includes:
Shared::Base
Defined in:
lib/tracker_api/resources/epic.rb

Defined Under Namespace

Classes: UpdateRepresenter

Instance Method Summary collapse

Methods included from Shared::Base

included

Instance Method Details

#comments(reload: false) ⇒ Object

Provides a list of all the comments on the epic.



39
40
41
42
43
44
45
# File 'lib/tracker_api/resources/epic.rb', line 39

def comments(reload: false)
  if !reload && @comments.present?
    @comments
  else
    @comments = Endpoints::Comments.new(client).get(project_id, epic_id: id)
  end
end

#create_comment(params) ⇒ Comment

Returns newly created Comment.

Parameters:

  • params (Hash)

    attributes to create the comment with

Returns:

  • (Comment)

    newly created Comment



49
50
51
52
53
54
# File 'lib/tracker_api/resources/epic.rb', line 49

def create_comment(params)
  files = params.delete(:files)
  comment = Endpoints::Comment.new(client).create(project_id, epic_id: id, params: params)
  comment.create_attachments(files: files) if files.present?
  comment
end

#saveObject

Save changes to an existing Epic.

Raises:

  • (ArgumentError)


32
33
34
35
36
# File 'lib/tracker_api/resources/epic.rb', line 32

def save
  raise ArgumentError, 'Can not update an epic with an unknown project_id.' if project_id.nil?

  Endpoints::Epic.new(client).update(self, UpdateRepresenter.new(self))
end