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



15
16
17
18
# File 'lib/cheatly/adapter/github.rb', line 15

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

#create(name, body) ⇒ Object

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/cheatly/adapter/github.rb', line 20

def create(name, body)
  raise NotImplementedError
end

#find(path) ⇒ Object



10
11
12
13
# File 'lib/cheatly/adapter/github.rb', line 10

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

#update(name, body) ⇒ Object

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/cheatly/adapter/github.rb', line 24

def update(name, body)
  raise NotImplementedError
end