Module: Bugsnag::Api::Client::Comments

Included in:
Bugsnag::Api::Client
Defined in:
lib/bugsnag/api/client/comments.rb

Overview

Methods for the Errors API

Instance Method Summary collapse

Instance Method Details

#comment(id, options = {}) ⇒ Sawyer::Resource

View an Comment

Returns:

  • (Sawyer::Resource)

    Requested Comment

See Also:



25
26
27
# File 'lib/bugsnag/api/client/comments.rb', line 25

def comment(id, options = {})
  get "comments/#{id}", options
end

#comments(project_id, error_id, options = {}) ⇒ Array<Sawyer::Resource>

List Comments on an Error

Parameters:

  • offset (Hash)

    a customizable set of options

  • sort (Hash)

    a customizable set of options

  • direction (Hash)

    a customizable set of options

  • per_page (Hash)

    a customizable set of options

Returns:

  • (Array<Sawyer::Resource>)

    List of Error Comments

See Also:



17
18
19
# File 'lib/bugsnag/api/client/comments.rb', line 17

def comments(project_id, error_id, options = {})
  paginate "projects/#{project_id}/errors/#{error_id}/comments", options
end

#create_comment(project_id, error_id, message, options = {}) ⇒ Sawyer::Resource

Create a Comment on an Error

Returns:

  • (Sawyer::Resource)

    The new Comment

See Also:



33
34
35
# File 'lib/bugsnag/api/client/comments.rb', line 33

def create_comment(project_id, error_id, message, options = {})
  post "projects/#{project_id}/errors/#{error_id}/comments", options.merge({:message => message})
end

#delete_comment(id, options = {}) ⇒ Object

Delete a Comment



49
50
51
# File 'lib/bugsnag/api/client/comments.rb', line 49

def delete_comment(id, options = {})
  boolean_from_response :delete, "comments/#{id}", options
end

#update_comment(id, message, options = {}) ⇒ Sawyer::Resource

Update a Comment

Returns:

  • (Sawyer::Resource)

    The updated Comment

See Also:



41
42
43
# File 'lib/bugsnag/api/client/comments.rb', line 41

def update_comment(id, message, options = {})
  patch "comments/#{id}", options.merge({:message => message})
end