Module: Octokit::Client::Contents
- Included in:
- Octokit::Client
- Defined in:
- lib/octokit/client/contents.rb
Instance Method Summary collapse
-
#archive_link(repo, options = {}) ⇒ String
This method will provide a URL to download a tarball or zipball archive for a repository.
-
#contents(repo, options = {}) ⇒ Hash
Receive a listing of a repository folder or the contents of a file.
-
#readme(repo, options = {}) ⇒ Hash
Receive the default Readme for a repository.
Instance Method Details
#archive_link(repo, options = {}) ⇒ String
This method will provide a URL to download a tarball or zipball archive for a repository.
42 43 44 45 46 47 48 |
# File 'lib/octokit/client/contents.rb', line 42 def archive_link(repo, ={}) repo_ref = .delete :ref format = (.delete :format) || 'tarball' url = "repos/#{Repository.new repo}/#{format}/#{repo_ref}" headers = get(url, , 3, false, true).headers return headers['location'] end |
#contents(repo, options = {}) ⇒ Hash
Receive a listing of a repository folder or the contents of a file
27 28 29 30 31 |
# File 'lib/octokit/client/contents.rb', line 27 def contents(repo, ={}) repo_path = .delete :path url = "repos/#{Repository.new repo}/contents/#{repo_path}" get(url, , 3) end |
#readme(repo, options = {}) ⇒ Hash
Receive the default Readme for a repository
14 15 16 |
# File 'lib/octokit/client/contents.rb', line 14 def readme(repo, ={}) get("repos/#{Repository.new repo}/readme", , 3) end |