123456789_123456789_123456789_123456789_123456789_

Module: Octokit::Client::Search

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

Overview

Methods for the Search API

Instance Method Summary

Instance Method Details

#search(path, query, options = {}) (private)

[ GitHub ]

  
# File 'lib/octokit/client/search.rb', line 83

def search(path, query, options = {})
  opts = options.merge(q: query)
  paginate(path, opts) do |data, last_response|
    data.items.concat last_response.data.items
  end
end

#search_code(query, options = {}) ⇒ Sawyer::Resource

Search code

Parameters:

  • query (String)

    Search term and qualifiers

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

    Sort and pagination options

Options Hash (options):

  • :sort (String)

    Sort field

  • :order (String)

    Sort order (asc or desc)

  • :page (Integer)

    Page of paginated results

  • :per_page (Integer)

    Number of items per page

Returns:

  • (Sawyer::Resource)

    Search results object

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/search.rb', line 19

def search_code(query, options = {})
  search 'search/code', query, options
end

#search_commits(query, options = {}) ⇒ Sawyer::Resource

Search commits

Parameters:

  • query (String)

    Search terms and qualifiers

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

    Sort and pagination options

Options Hash (options):

  • :sort (String)

    Sort field

  • :order (String)

    Sort order (asc or desc)

  • :page (Integer)

    Page of paginated results

  • :per_page (Integer)

    Number of items per page

Returns:

  • (Sawyer::Resource)

    Search results object

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/search.rb', line 33

def search_commits(query, options = {})
  options = ensure_api_media_type(:commit_search, options)
  search 'search/commits', query, options
end

#search_issues(query, options = {}) ⇒ Sawyer::Resource

Search issues

Parameters:

  • query (String)

    Search term and qualifiers

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

    Sort and pagination options

Options Hash (options):

  • :sort (String)

    Sort field

  • :order (String)

    Sort order (asc or desc)

  • :page (Integer)

    Page of paginated results

  • :per_page (Integer)

    Number of items per page

Returns:

  • (Sawyer::Resource)

    Search results object

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/search.rb', line 48

def search_issues(query, options = {})
  search 'search/issues', query, options
end

#search_repos(query, options = {})

[ GitHub ]

  
# File 'lib/octokit/client/search.rb', line 65

alias search_repos search_repositories

#search_repositories(query, options = {}) ⇒ Sawyer::Resource Also known as: #search_repos

Search repositories

Parameters:

  • query (String)

    Search term and qualifiers

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

    Sort and pagination options

Options Hash (options):

  • :sort (String)

    Sort field

  • :order (String)

    Sort order (asc or desc)

  • :page (Integer)

    Page of paginated results

  • :per_page (Integer)

    Number of items per page

Returns:

  • (Sawyer::Resource)

    Search results object

See Also:

[ GitHub ]

  
# File 'lib/octokit/client/search.rb', line 62

def search_repositories(query, options = {})
  search 'search/repositories', query, options
end

#search_users(query, options = {}) ⇒ Sawyer::Resource

Search users

Parameters:

  • query (String)

    Search term and qualifiers

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

    Sort and pagination options

Options Hash (options):

  • :sort (String)

    Sort field

  • :order (String)

    Sort order (asc or desc)

  • :page (Integer)

    Page of paginated results

  • :per_page (Integer)

    Number of items per page

Returns:

  • (Sawyer::Resource)

    Search results object

See Also:

[ GitHub ]

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

def search_users(query, options = {})
  search 'search/users', query, options
end