Module: Octokit::Client::RepositoryInvitations

Included in:
Octokit::Client
Defined in:
lib/octokit/client/repository_invitations.rb

Overview

Methods for the Repository Invitations API

Instance Method Summary collapse

Instance Method Details

#accept_repository_invitation(invitation_id, options = {}) ⇒ Boolean Also known as: accept_repo_invitation

Accept a repository invitation

Requires authenticated client

Parameters:

  • invitation_id (Integer)

    The id of the invitation

Returns:

  • (Boolean)

    True if the acceptance of the invitation was successful

See Also:



78
79
80
# File 'lib/octokit/client/repository_invitations.rb', line 78

def accept_repository_invitation(invitation_id, options = {})
  patch "/user/repository_invitations/#{invitation_id}", options
end

#decline_repository_invitation(invitation_id, options = {}) ⇒ Boolean Also known as: decline_invitation

Decline a repository invitation

Requires authenticated client

Parameters:

  • invitation_id (Integer)

    The id of the invitation

Returns:

  • (Boolean)

    True if the acceptance of the invitation was successful

See Also:



90
91
92
# File 'lib/octokit/client/repository_invitations.rb', line 90

def decline_repository_invitation(invitation_id, options = {})
  boolean_from_response :delete, "/user/repository_invitations/#{invitation_id}", options
end

#delete_repository_invitation(repo, invitation_id, options = {}) ⇒ Boolean Also known as: delete_repo_invitation

Delete an invitation for a repository

Requires authenticated client

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

  • invitation_id (Integer)

    The id of the invitation

Returns:

  • (Boolean)

    True if the invitation was successfully deleted

See Also:



42
43
44
# File 'lib/octokit/client/repository_invitations.rb', line 42

def delete_repository_invitation(repo, invitation_id, options = {})
  boolean_from_response :delete, "#{Repository.path repo}/invitations/#{invitation_id}", options
end

#invite_user_to_repository(repo, user, options = {}) ⇒ Sawyer::Resource Also known as: invite_user_to_repo

Invite a user to a repository

Requires authenticated client

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository

  • user (String)

    User GitHub username to add

Returns:

  • (Sawyer::Resource)

    The repository invitation

See Also:



17
18
19
# File 'lib/octokit/client/repository_invitations.rb', line 17

def invite_user_to_repository(repo, user, options = {})
  put "#{Repository.path repo}/collaborators/#{user}", options
end

#repository_invitations(repo, options = {}) ⇒ Array<Sawyer::Resource> Also known as: repo_invitations

List all invitations for a repository

Requires authenticated client

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

Returns:

  • (Array<Sawyer::Resource>)

    A list of invitations

See Also:



29
30
31
# File 'lib/octokit/client/repository_invitations.rb', line 29

def repository_invitations(repo, options = {})
  paginate "#{Repository.path repo}/invitations", options
end

#update_repository_invitation(repo, invitation_id, options = {}) ⇒ Sawyer::Resource Also known as: update_repo_invitation

Update an invitation for a repository

Requires authenticated client

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

  • invitation_id (Integer)

    The id of the invitation

Returns:

  • (Sawyer::Resource)

    The updated repository invitation

See Also:



55
56
57
# File 'lib/octokit/client/repository_invitations.rb', line 55

def update_repository_invitation(repo, invitation_id, options = {})
  patch "#{Repository.path repo}/invitations/#{invitation_id}", options
end

#user_repository_invitations(options = {}) ⇒ Array<Sawyer::Resource> Also known as: user_repo_invitations

List all repository invitations for the user

Requires authenticated client

Returns:

  • (Array<Sawyer::Resource>)

    The users repository invitations

See Also:



66
67
68
# File 'lib/octokit/client/repository_invitations.rb', line 66

def user_repository_invitations(options = {})
  paginate "/user/repository_invitations", options
end