This repository has been archived by the owner on Aug 21, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Api requests as simple markdown, with fancy example code block handlers
- Loading branch information
Showing
11 changed files
with
168 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
module Doctaur | ||
|
||
class Resultifier | ||
|
||
def self.resultify(flavor, code) | ||
resultifier_klass_for(flavor).new(flavor, code).result_mkd | ||
end | ||
|
||
def self.resultifier_klass_for(flavor) | ||
case flavor.to_s | ||
when "bash" then CurlResultifier | ||
else NullResultifier | ||
end | ||
end | ||
|
||
class NullResultifier | ||
attr_reader :flavor, :code | ||
|
||
def initialize(flavor, code) | ||
@flavor, @code = flavor, code | ||
end | ||
|
||
def result_mkd | ||
<<-RESULT | ||
```#{flavor} | ||
#{code} | ||
-- No result, because I don't know what to do with #{flavor.inspect} | ||
``` | ||
RESULT | ||
end | ||
end | ||
|
||
class CurlResultifier < NullResultifier | ||
|
||
def subbed_code | ||
code.gsub('{{password}}', ENV['GH_PASSWORD']) | ||
end | ||
|
||
def result | ||
puts subbed_code | ||
result = `#{subbed_code}` | ||
end | ||
|
||
def result_mkd | ||
<<-RESULT | ||
```#{flavor} | ||
#{code} | ||
#{result} | ||
``` | ||
RESULT | ||
end | ||
end | ||
|
||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: Quick Reference | ||
sort_order: 2 | ||
title: Quick Reference | ||
sort_order: 2 | ||
--- | ||
|
||
%h1 Quick Reference | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
title: "Retrieve current user" | ||
endpoint: /user | ||
method: GET | ||
requires_auth: true | ||
response: user | ||
--- | ||
|
||
You can use `/user` to get the currently logged in user. This is a shortcut to `/user/{login}` for | ||
your particular login. | ||
|
||
```bash | ||
curl -u "paul:{{password}}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/user | ||
``` | ||
|
||
```ruby | ||
@github = GitHub::Client.new(token) | ||
@github.current_user | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
title: "Fetch user by login" | ||
endpoint: /users/{login} | ||
method: GET | ||
response: user | ||
--- | ||
|
||
To lookup a particular user's public profile data, you can find them by their login name. | ||
|
||
```bash | ||
curl -H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/users/paul | ||
``` | ||
|
||
```ruby | ||
@github = GitHub::Client.new(token) | ||
@github.current_user | ||
``` | ||
|
||
|
||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.