module Github::Blob
Constants
- ENDPOINT
Public Class Methods
create(content, encoding='utf-8')
click to toggle source
# File lib/github/blob.rb, line 12 def self.create(content, encoding='utf-8') input = { 'content' => content, 'encoding' => encoding } resp = Github.post(ENDPOINT, input) raise "Github blob POST failed with http code: #{resp.code}" if resp.code != '201' ActiveSupport::JSON.decode(resp.body)['sha'] end
get(sha)
click to toggle source
# File lib/github/blob.rb, line 5 def self.get(sha) raise 'invalid sha #{sha} when retrieving github blob' unless Github.valid_sha?(sha) resp = Github.get("#{ENDPOINT}/#{sha}") raise "Github blob retrieve failed with http code: #{resp.code}" if resp.code != '200' ActiveSupport::JSON.decode(resp.body) end