Module: Octokit::Client::SourceImport

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

Overview

Methods for the Source Import API

Instance Method Summary collapse

Instance Method Details

#cancel_source_import(repo, options = {}) ⇒ Boolean

Stop an import for a repository.

Examples:

@client.cancel_source_import("octokit/octokit.rb")

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Boolean)

    True if the import has been cancelled, false otherwise.

See Also:



87
88
89
90
# File 'lib/octokit/client/source_import.rb', line 87

def cancel_source_import(repo, options = {})
  options = ensure_api_media_type(:source_imports, options)
  boolean_from_response :delete, "#{Repository.path repo}/import", options
end

#map_source_import_commit_author(author_url, values, options = {}) ⇒ Sawyer::Resource

Update an author’s identity for the import.

Examples:

author_url = "https://api.github.com/repos/octokit/octokit.rb/import/authors/1"
@client.map_source_import_commit_author(author_url, {
  :email => "[email protected]",
  :name => "Hubot the Robot"
})

Parameters:

  • author_url (String)

    The source import API url for the commit author

  • values (Hash)

    The updated author attributes

Options Hash (values):

  • :email (String)

    The new Git author email.

  • :name (String)

    The new Git author name.

Returns:

  • (Sawyer::Resource)

    Hash representing the updated commit author

See Also:



74
75
76
77
# File 'lib/octokit/client/source_import.rb', line 74

def map_source_import_commit_author(author_url, values, options = {})
  options = ensure_api_media_type(:source_imports, options.merge(values))
  patch author_url, options
end

#source_import_commit_authors(repo, options = {}) ⇒ Array<Sawyer::Resource>

List source import commit authors

Examples:

@client.source_import_commit_authors("octokit/octokit.rb")

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

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

Options Hash (options):

  • :since (String)

    Only authors found after this id are returned.

Returns:

  • (Array<Sawyer::Resource>)

    Array of hashes representing commit_authors.

See Also:



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

def source_import_commit_authors(repo, options = {})
  options = ensure_api_media_type(:source_imports, options)
  get "#{Repository.path repo}/import/authors", options
end

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

View the progress of an import.

Examples:

@client.source_import_progress("octokit/octokit.rb")

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

Returns:

  • (Sawyer::Resource)

    Hash representing the progress of the import

See Also:



39
40
41
42
# File 'lib/octokit/client/source_import.rb', line 39

def source_import_progress(repo, options = {})
  options = ensure_api_media_type(:source_imports, options)
  get "#{Repository.path repo}/import", options
end

#start_source_import(repo, vcs, vcs_url, options = {}) ⇒ Sawyer::Resource

Start a source import to a GitHub repository using GitHub Importer.

Examples:

@client.import("octokit/octokit.rb", "subversion", "http://svn.mycompany.com/svn/myproject" {
 :vcs_username" => "octocat",
 :vcs_password  => "secret"
})

Parameters:

  • repo (Integer, String, Hash, Repository)

    A GitHub repository.

  • vcs (String)

    The originating VCS type. Can be one of “subversion”, “git”, “mercurial”, or “tfvc”.

  • vcs_url (String)

    The URL of the originating repository.

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

Options Hash (options):

  • :vcs_username (String)

    If authentication is required, the username to provide to vcs_url.

  • :vcs_password (String)

    If authentication is required, the password to provide to vcs_url.

  • :tfvc_project (String)

    For a tfvc import, the name of the project that is being imported.

Returns:

  • (Sawyer::Resource)

    Hash representing the repository import

See Also:



26
27
28
29
# File 'lib/octokit/client/source_import.rb', line 26

def start_source_import(repo, vcs, vcs_url, options = {})
  options = ensure_api_media_type(:source_imports, options.merge(:vcs => vcs, :vcs_url => vcs_url))
  put "#{Repository.path repo}/import", options
end