Class: YandexTracker::Collections::Comments

Inherits:
Base
  • Object
show all
Defined in:
lib/yandex_tracker/collections/comments.rb

Overview

Collections::Comments

Instance Attribute Summary collapse

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#inspect

Constructor Details

#initialize(client, issue_id) ⇒ Comments

Returns a new instance of Comments.

Raises:

  • (ArgumentError)


11
12
13
14
15
16
17
# File 'lib/yandex_tracker/collections/comments.rb', line 11

def initialize(client, issue_id)
  raise ArgumentError, "issue_id is required" if issue_id.nil?

  super(client)
  @resource = Resources::Comment.new(client)
  @issue_id = issue_id
end

Instance Attribute Details

#issue_idObject (readonly)

Returns the value of attribute issue_id.



9
10
11
# File 'lib/yandex_tracker/collections/comments.rb', line 9

def issue_id
  @issue_id
end

Instance Method Details

#create(**attributes) ⇒ Object



24
25
26
27
# File 'lib/yandex_tracker/collections/comments.rb', line 24

def create(**attributes)
  response = resource.create(issue_id, **attributes)
  build_object(Objects::Comment, response, { issue_id: issue_id })
end

#find(id) ⇒ Object



19
20
21
22
# File 'lib/yandex_tracker/collections/comments.rb', line 19

def find(id)
  response = resource.find(issue_id, id)
  build_object(Objects::Comment, response, { issue_id: issue_id })
end

#list(**params) ⇒ Object



29
30
31
32
# File 'lib/yandex_tracker/collections/comments.rb', line 29

def list(**params)
  response = resource.list(issue_id, **params)
  build_objects(Objects::Comment, response, { issue_id: issue_id })
end

#update(comment, **attributes) ⇒ Object



34
35
36
37
# File 'lib/yandex_tracker/collections/comments.rb', line 34

def update(comment, **attributes)
  response = resource.update(issue_id, comment.id, **attributes)
  build_object(Objects::Comment, response, { issue_id: issue_id })
end