Module: Github::Refs
- Defined in:
- lib/github/refs.rb
Constant Summary collapse
- ENDPOINT =
URI.join(Github::ROOT_ENDPOINT, 'repos/', "#{Github::OWNER}/", "#{Github::REPO}/", 'git/', 'refs').to_s
Class Method Summary collapse
Class Method Details
.create(ref, sha) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/github/refs.rb', line 17 def self.create(ref, sha) ref = "refs/#{ref}" params = { 'ref' => ref, 'sha' => sha } resp = Github.post(ENDPOINT, params) raise "Github refs POST failed with http code: #{resp.code}" if resp.code != '201' ActiveSupport::JSON.decode(resp.body) end |
.get(ref) ⇒ Object
5 6 7 8 9 |
# File 'lib/github/refs.rb', line 5 def self.get(ref) resp = Github.get("#{ENDPOINT}/#{ref}") raise "Github refs POST failed with http code: #{resp.code}" if resp.code != '200' ActiveSupport::JSON.decode(resp.body) end |
.get_all ⇒ Object
11 12 13 14 15 |
# File 'lib/github/refs.rb', line 11 def self.get_all resp = Github.get(ENDPOINT) raise "Github refs POST failed with http code: #{resp.code}" if resp.code != '200' ActiveSupport::JSON.decode(resp.body) end |
.update(ref, sha) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/github/refs.rb', line 29 def self.update(ref, sha) params = { 'sha' => sha, 'force' => true } resp = Github.patch("#{ENDPOINT}/#{ref}", params) raise "Github refs update failed with http code: #{resp.code}" if resp.code != '200' ActiveSupport::JSON.decode(resp.body) end |