class Potatochop::GithubInterface

Attributes

source[R]

Public Class Methods

new(repo, gh_options = {}) click to toggle source
# File lib/potatochop/github_interface.rb, line 5
def initialize(repo, gh_options = {})
  @source = repo
  @gh_client = Octokit::Client.new access_token: gh_options[:access_token]
end

Public Instance Methods

exists?(file_name) click to toggle source
# File lib/potatochop/github_interface.rb, line 10
def exists?(file_name)
  begin
    @gh_client.contents(@source, path: file_name, accept: 'application/vnd.github.raw')
    true
  rescue Octokit::NotFound
    false
  end
end
read(file_name) click to toggle source
# File lib/potatochop/github_interface.rb, line 19
def read(file_name)
  @gh_client.contents(@source, path: file_name, accept: 'application/vnd.github.raw')
end