Class: Cheatly::Adapter::GitHub
- Inherits:
-
Object
- Object
- Cheatly::Adapter::GitHub
- Defined in:
- lib/cheatly/adapter/github.rb
Constant Summary collapse
- FOLDER =
'sheets'- REPO =
'arthurnn/cheatly'
Instance Method Summary collapse
Instance Method Details
#all ⇒ Object
19 20 21 22 |
# File 'lib/cheatly/adapter/github.rb', line 19 def all response = Octokit.contents(REPO, path: "#{FOLDER}") response.map { |f| f.name.gsub(/\.[a-z]+\z/, '') } end |
#create ⇒ Object
24 25 26 |
# File 'lib/cheatly/adapter/github.rb', line 24 def create raise NotImplementedError end |
#find(path) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/cheatly/adapter/github.rb', line 12 def find(path) response = Octokit.contents(REPO, path: "#{FOLDER}/#{path}.yml") sheet_yaml = Base64.decode64(response.content) yml = YAML.load(sheet_yaml).first [yml.first, yml.last] end |