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:



83
84
85
86
# File 'lib/octokit/client/repository_invitations.rb', line 83

def accept_repository_invitation(invitation_id, options = {})
  options = ensure_api_media_type(:repository_invitations, 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:



96
97
98
99
# File 'lib/octokit/client/repository_invitations.rb', line 96

def decline_repository_invitation(invitation_id, options = {})
  options = ensure_api_media_type(:repository_invitations, 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:



44
45
46
47
# File 'lib/octokit/client/repository_invitations.rb', line 44

def delete_repository_invitation(repo, invitation_id, options = {})
  options = ensure_api_media_type(:repository_invitations, 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
20
# File 'lib/octokit/client/repository_invitations.rb', line 17

def invite_user_to_repository(repo, user, options = {})
  options = ensure_api_media_type(:repository_invitations, 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:



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

def repository_invitations(repo, options = {})
  options = ensure_api_media_type(:repository_invitations, 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:



58
59
60
61
# File 'lib/octokit/client/repository_invitations.rb', line 58

def update_repository_invitation(repo, invitation_id, options = {})
  options = ensure_api_media_type(:repository_invitations, 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:



70
71
72
73
# File 'lib/octokit/client/repository_invitations.rb', line 70

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