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.
41 42 43 44 45 46 |
# File 'lib/octokit/client/contents.rb', line 41 def archive_link(repo, ={}) repo_ref = .delete :ref format = (.delete :format) || 'tarball' url = "repos/#{Repository.new repo}/#{format}/#{repo_ref}" request(:head, url, ).env[:url].to_s end |
#contents(repo, options = {}) ⇒ Hash
Receive a listing of a repository folder or the contents of a file
26 27 28 29 30 |
# File 'lib/octokit/client/contents.rb', line 26 def contents(repo, ={}) repo_path = .delete :path url = "repos/#{Repository.new repo}/contents/#{repo_path}" get(url, ) end |
#readme(repo, options = {}) ⇒ Hash
Receive the default Readme for a repository
13 14 15 |
# File 'lib/octokit/client/contents.rb', line 13 def readme(repo, ={}) get("repos/#{Repository.new repo}/readme", ) end |