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.



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

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



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

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)


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

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