123456789_123456789_123456789_123456789_123456789_

Module: Octokit::Client::Apps

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/octokit/client/apps.rb

Overview

Methods for the Apps API

Instance Method Summary

Instance Method Details

#add_repo_to_installation(installation, repo, options = {})

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 131

alias add_repo_to_installation add_repository_to_app_installation

#add_repository_to_app_installation(installation, repo, options = {}) ⇒ Boolean Also known as: #add_repo_to_installation

Add a single repository to an installation

Parameters:

  • installation (Integer)

    The id of a GitHub App Installation

  • repo (Integer)

    The id of the GitHub repository

  • options (Hash) (defaults to: {})

    A customizable set of options

Returns:

  • (Boolean)

    Success

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 128

def add_repository_to_app_installation(installation, repo, options = {})
  boolean_from_response :put, "user/installations/#{installation}/repositories/#{repo}", options
end

#app(options = {}) ⇒ Sawyer::Resource

Get the authenticated App

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options

Returns:

  • (Sawyer::Resource)

    App information

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 14

def app(options = {})
  get 'app', options
end

#app_hook_delivery(delivery_id, options = {}) ⇒ <Sawyer::Resource>

Returns a delivery for the webhook configured for a GitHub App.

Parameters:

  • delivery_id (String)

    The id of a GitHub App Hook Delivery

  • options (Hash) (defaults to: {})

    A customizable set of options

Returns:

  • (<Sawyer::Resource>)

    The webhook delivery

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 194

def app_hook_delivery(delivery_id, options = {})
  get "/app/hook/deliveries/#{delivery_id}", options
end

#create_app_installation_access_token(installation, options = {}) ⇒ <Sawyer::Resource> Also known as: #create_installation_access_token

Create a new installation token

Parameters:

  • installation (Integer)

    The id of a GitHub App Installation

  • options (Hash) (defaults to: {})

    A customizable set of options

Returns:

  • (<Sawyer::Resource>)

    An installation token

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 64

def create_app_installation_access_token(installation, options = {})
  post "app/installations/#{installation}/access_tokens", options
end

#create_installation_access_token(installation, options = {})

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 67

alias create_installation_access_token create_app_installation_access_token

#delete_installation(installation, options = {}) ⇒ Boolean

Delete an installation and uninstall a GitHub App

Parameters:

  • installation (Integer)

    The id of a GitHub App Installation

  • options (Hash) (defaults to: {})

    A customizable set of options

Returns:

  • (Boolean)

    Success

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 169

def delete_installation(installation, options = {})
  boolean_from_response :delete, "app/installations/#{installation}", options
end

#deliver_app_hook(delivery_id, options = {}) ⇒ Boolean

Redeliver a delivery for the webhook configured for a GitHub App.

Parameters:

  • delivery_id (Integer)

    The id of a GitHub App Hook Delivery

  • options (Hash) (defaults to: {})

    A customizable set of options

Returns:

  • (Boolean)

    Success

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 206

def deliver_app_hook(delivery_id, options = {})
  boolean_from_response :post, "app/hook/deliveries/#{delivery_id}/attempts", options
end

#find_app_installations(options = {})

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 29

alias find_app_installations list_app_installations

#find_installation_repositories_for_user(installation, options = {}) ⇒ Sawyer::Resource

List repositories accessible to the user for an installation

Parameters:

  • installation (Integer)

    The id of a GitHub App Installation

  • options (Hash) (defaults to: {})

    A customizable set of options

Returns:

  • (Sawyer::Resource)

    the total_count and an array of repositories

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 155

def find_installation_repositories_for_user(installation, options = {})
  paginate("user/installations/#{installation}/repositories", options) do |data, last_response|
    data.repositories.concat last_response.data.repositories
  end
end

#find_installations(options = {})

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 28

alias find_installations list_app_installations

#find_organization_installation(organization, options = {}) ⇒ Sawyer::Resource

Enables an app to find the organization's installation information.

Parameters:

  • organization (String)
  • options (Hash) (defaults to: {})

    A customizable set of options

Returns:

  • (Sawyer::Resource)

    Installation information

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 77

def find_organization_installation(organization, options = {})
  get "#{Organization.path(organization)}/installation", options
end

#find_repository_installation(repo, options = {}) ⇒ Sawyer::Resource

Enables an app to find the repository's installation information.

Parameters:

  • repo (String)

    A GitHub repository

  • options (Hash) (defaults to: {})

    A customizable set of options

Returns:

  • (Sawyer::Resource)

    Installation information

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 89

def find_repository_installation(repo, options = {})
  get "#{Repository.path(repo)}/installation", options
end

#find_user_installation(user, options = {}) ⇒ Sawyer::Resource

Enables an app to find the user's installation information.

Parameters:

  • user (String)

    GitHub user login

  • options (Hash) (defaults to: {})

    A customizable set of options

Returns:

  • (Sawyer::Resource)

    Installation information

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 101

def find_user_installation(user, options = {})
  get "#{User.path(user)}/installation", options
end

#find_user_installations(options = {})

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 43

alias find_user_installations list_user_installations

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

Get a single installation

Parameters:

  • id (Integer)

    Installation id

Returns:

  • (Sawyer::Resource)

    Installation information

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 52

def installation(id, options = {})
  get "app/installations/#{id}", options
end

#list_app_hook_deliveries(options = {}) ⇒ Array<Hash>

Returns a list of webhook deliveries for the webhook configured for a GitHub App.

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options

Returns:

  • (Array<Hash>)

    an array of hook deliveries

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 180

def list_app_hook_deliveries(options = {})
  paginate('app/hook/deliveries', options) do |data, last_response|
    data.concat last_response.data
  end
end

#list_app_installation_repositories(options = {}) ⇒ Sawyer::Resource Also known as: #list_installation_repos

List repositories that are accessible to the authenticated installation

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options

Returns:

  • (Sawyer::Resource)

    the total_count and an array of repositories

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 112

def list_app_installation_repositories(options = {})
  paginate('installation/repositories', options) do |data, last_response|
    data.repositories.concat last_response.data.repositories
  end
end

#list_app_installations(options = {}) ⇒ Array<Sawyer::Resource> Also known as: #find_installations, #find_app_installations

List all installations that belong to an App

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options

Returns:

  • (Array<Sawyer::Resource>)

    the total_count and an array of installations

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 25

def list_app_installations(options = {})
  paginate 'app/installations', options
end

#list_installation_repos(options = {})

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 117

alias list_installation_repos list_app_installation_repositories

#list_user_installations(options = {}) ⇒ Sawyer::Resource Also known as: #find_user_installations

List all installations that are accessible to the authenticated user

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options

Returns:

  • (Sawyer::Resource)

    the total_count and an array of installations

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 38

def list_user_installations(options = {})
  paginate('user/installations', options) do |data, last_response|
    data.installations.concat last_response.data.installations
  end
end

#remove_repo_from_installation(installation, repo, options = {})

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 145

alias remove_repo_from_installation remove_repository_from_app_installation

#remove_repository_from_app_installation(installation, repo, options = {}) ⇒ Boolean Also known as: #remove_repo_from_installation

Remove a single repository to an installation

Parameters:

  • installation (Integer)

    The id of a GitHub App Installation

  • repo (Integer)

    The id of the GitHub repository

  • options (Hash) (defaults to: {})

    A customizable set of options

Returns:

  • (Boolean)

    Success

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/apps.rb', line 142

def remove_repository_from_app_installation(installation, repo, options = {})
  boolean_from_response :delete, "user/installations/#{installation}/repositories/#{repo}", options
end