Class: TrackerApi::Endpoints::Review

Inherits:
Object
  • Object
show all
Defined in:
lib/tracker_api/endpoints/review.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Review

Returns a new instance of Review.



6
7
8
# File 'lib/tracker_api/endpoints/review.rb', line 6

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



4
5
6
# File 'lib/tracker_api/endpoints/review.rb', line 4

def client
  @client
end

Instance Method Details

#update(review, params = {}) ⇒ Object

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
17
18
# File 'lib/tracker_api/endpoints/review.rb', line 10

def update(review, params = {})
  raise ArgumentError, 'Valid review required to update.' unless review.instance_of?(Resources::Review)

  data = client.put("/projects/#{review.project_id}/stories/#{review.story_id}/reviews/#{review.id}", params: params).body

  review.attributes = data
  review.clean!
  review
end