Parent

Class/Module Index [+]

Quicksearch

Github::Client::Issues::Comments

Public Instance Methods

all(*args) click to toggle source
Alias for: list
create(*args) click to toggle source

Create a comment

@param [Hash] params @option [String] :body

Required string

@example

github = Github.new
github.issues.comments.create 'user-name', 'repo-name', 'number',
   body: 'a new comment'

@example

github.issues.comments.create
  user: 'owner-name',
  repo: 'repo-name',
  number: 'comment-number',
  body: 'a new comment body'

@api public

# File lib/github_api/client/issues/comments.rb, line 86
def create(*args)
  arguments(args, required: [:user, :repo, :number]) do
    permit VALID_ISSUE_COMMENT_PARAM_NAME
    assert_required ] body ]
  end
  params = arguments.params

  post_request("/repos/#{arguments.user}/#{arguments.repo}/issues/#{arguments.number}/comments", params)
end
delete(*args) click to toggle source

Delete a comment

Examples

github = Github.new
github.issues.comments.delete 'owner-name', 'repo-name', 'comment-id'

@example

github.issues.comments.delete
  user: 'owner-name',
  repo: 'repo-name',
  id: 'comment-id',

@api public

# File lib/github_api/client/issues/comments.rb, line 137
def delete(*args)
  arguments(args, required: [:user, :repo, :id])

  delete_request("/repos/#{arguments.user}/#{arguments.repo}/issues/comments/#{arguments.id}", arguments.params)
end
edit(*args) click to toggle source

Edit a comment

@param [Hash] params @option params [String] :body

Required string

@example

github = Github.new
github.issues.comments.edit 'owner-name', 'repo-name', 'id',
   body: 'a new comment'

@example

github.issues.comments.edit
  user: 'owner-name',
  repo: 'repo-name',
  id: 'comment-id',
  body: 'a new comment body'

@api public

# File lib/github_api/client/issues/comments.rb, line 115
def edit(*args)
  arguments(args, required: [:user, :repo, :id]) do
    permit VALID_ISSUE_COMMENT_PARAM_NAME
    assert_required ] body ]
  end

  patch_request("/repos/#{arguments.user}/#{arguments.repo}/issues/comments/#{arguments.id}", arguments.params)
end
find(*args) click to toggle source
Alias for: get
get(*args) click to toggle source

Get a single comment

@example

github = Github.new
github.issues.comments.find 'user-name', 'repo-name', 'id'

@example

github.issues.comments.find owner: 'user-name', repo: 'repo-name', id: 'id'
# File lib/github_api/client/issues/comments.rb, line 59
def get(*args)
  arguments(args, required: [:user, :repo, :id])
  params = arguments.params

  get_request("/repos/#{arguments.user}/#{arguments.repo}/issues/comments/#{arguments.id}", params)
end
Also aliased as: find
list(*args) click to toggle source

List comments on an issue

@example

github = Github.new
github.issues.comments.all 'owner-name', 'repo-name', number: 'id'
github.issues.comments.all 'owner-name', 'repo-name', number: 'id' {|com| .. }

@example

github.issues.comments.all owner: 'username', repo: 'repo-name', number: 'id'

List comments in a repository

@param [Hash] params @option params [String] :sort

Optional string, created or updated

@option params [String] :direction

Optional string, asc or desc. Ignored with sort parameter.

@option params [String] :since

Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ

@example

github = Github.new
github.issues.comments.all 'user-name', 'repo-name'
github.issues.comments.all 'user-name', 'repo-name' {|com| .. }

@api public

# File lib/github_api/client/issues/comments.rb, line 36
def list(*args)
  arguments(args, required: [:user, :repo])
  params = arguments.params

  response = if (number = params.delete('number'))
    get_request("/repos/#{arguments.user}/#{arguments.repo}/issues/#{number}/comments", params)
  else
    get_request("/repos/#{arguments.user}/#{arguments.repo}/issues/comments", params)
  end
  return response unless block_given?
  response.each { |el| yield el }
end
Also aliased as: all

[Validate]

Generated with the Darkfish Rdoc Generator 2.