class Slodd::Github
Attributes
owner[RW]
path[RW]
ref[RW]
repo[RW]
token[RW]
Public Class Methods
new(attrs)
click to toggle source
# File lib/slodd/github.rb, line 8 def initialize(attrs) self.owner = attrs.fetch(:owner) self.repo = attrs.fetch(:repo) self.token = attrs.fetch(:token) self.path = attrs.fetch(:path) self.ref = attrs[:ref] end
Public Instance Methods
schema()
click to toggle source
# File lib/slodd/github.rb, line 16 def schema @schema ||= open(url, headers).read rescue OpenURI::HTTPError raise Slodd::GithubError, "Check your credentials and the schema file location!" end
Private Instance Methods
branch()
click to toggle source
# File lib/slodd/github.rb, line 28 def branch "?ref=#{ref}" unless ref.nil? end
headers()
click to toggle source
# File lib/slodd/github.rb, line 32 def headers { "Accept" => "application/vnd.github.3.raw", "Authorization" => "token #{token}", } end
url()
click to toggle source
# File lib/slodd/github.rb, line 24 def url "https://api.github.com/repos/#{owner}/#{repo}/contents/#{path}#{branch}" end