Class: Cheatly::Adapter::GitHub

Inherits:
Object
  • Object
show all
Defined in:
lib/cheatly/adapter/github.rb

Constant Summary collapse

FOLDER =
'sheets'
REPO =
'arthurnn/cheatly'

Instance Method Summary collapse

Instance Method Details

#allObject



17
18
19
20
# File 'lib/cheatly/adapter/github.rb', line 17

def all
  response = Octokit.contents(REPO, path: "#{FOLDER}")
  response.map { |f| f.name.gsub(/\.[a-z]+\z/, '') }
end

#createObject

Raises:

  • (NotImplementedError)


22
23
24
# File 'lib/cheatly/adapter/github.rb', line 22

def create
  raise NotImplementedError
end

#find(path) ⇒ Object



12
13
14
15
# File 'lib/cheatly/adapter/github.rb', line 12

def find(path)
  response = Octokit.contents(REPO, path: "#{FOLDER}/#{path}.md")
  Base64.decode64(response.content)
end