Remove dependency on tent-apidoc
This commit is contained in:
parent
101f7f49d1
commit
e8ac6de51f
5 changed files with 334 additions and 135 deletions
26
Gemfile
26
Gemfile
|
@ -6,19 +6,13 @@ gem 'rack'
|
||||||
gem 'puma'
|
gem 'puma'
|
||||||
gem 'rack-rewrite'
|
gem 'rack-rewrite'
|
||||||
gem 'clogger'
|
gem 'clogger'
|
||||||
|
gem 'nanoc'
|
||||||
group :development do
|
gem 'nanoc-cachebuster'
|
||||||
gem 'nanoc'
|
gem 'redcarpet'
|
||||||
gem 'nanoc-cachebuster'
|
gem 'slim'
|
||||||
gem 'redcarpet'
|
gem 'rainpress'
|
||||||
gem 'slim'
|
gem 'nokogiri'
|
||||||
gem 'rainpress'
|
gem 'adsf'
|
||||||
gem 'nokogiri'
|
gem 'builder'
|
||||||
gem 'adsf'
|
gem 'tent-schemas', :git => 'git://github.com/tent/tent-schemas.git', :branch => 'master'
|
||||||
gem 'builder'
|
gem 'pygments.rb', :git => 'git://github.com/akzhan/pygments.rb.git', :branch => 'rubypython-0.6'
|
||||||
gem 'tent-schemas', :git => 'git://github.com/tent/tent-schemas.git', :branch => 'master'
|
|
||||||
gem 'tent-client', :git => 'git@github.com:tent/tent-client-ruby.git', :branch => 'master'
|
|
||||||
gem 'tentd', :git => 'git@github.com:tent/tentd.git', :branch => 'master'
|
|
||||||
gem 'tent-apidoc', :git => 'git@github.com:tent/tent-apidoc.git', :branch => 'master'
|
|
||||||
gem 'pygments.rb', :git => 'git://github.com/akzhan/pygments.rb.git', :branch => 'rubypython-0.6'
|
|
||||||
end
|
|
||||||
|
|
116
Gemfile.lock
116
Gemfile.lock
|
@ -14,128 +14,21 @@ GIT
|
||||||
tent-schemas (0.0.1)
|
tent-schemas (0.0.1)
|
||||||
json-schema
|
json-schema
|
||||||
|
|
||||||
GIT
|
|
||||||
remote: git@github.com:tent/tent-apidoc.git
|
|
||||||
revision: 748c297e05c8e6978c80d6bde7f713d7e05e2439
|
|
||||||
branch: master
|
|
||||||
specs:
|
|
||||||
tent-apidoc (0.1.0)
|
|
||||||
fabrication
|
|
||||||
faker
|
|
||||||
rack-test
|
|
||||||
tent-client
|
|
||||||
tentd
|
|
||||||
|
|
||||||
GIT
|
|
||||||
remote: git@github.com:tent/tent-client-ruby.git
|
|
||||||
revision: 8e2755dae78a1ae991eb288085e2f00b1d6a0c75
|
|
||||||
branch: master
|
|
||||||
specs:
|
|
||||||
tent-client (0.0.1)
|
|
||||||
faraday (= 0.8.4)
|
|
||||||
faraday_middleware (= 0.8.8)
|
|
||||||
json
|
|
||||||
nokogiri
|
|
||||||
|
|
||||||
GIT
|
|
||||||
remote: git@github.com:tent/tentd.git
|
|
||||||
revision: 2c2f3108e2c78a07a0d7b30ca3d14a642d3df29d
|
|
||||||
branch: master
|
|
||||||
specs:
|
|
||||||
tentd (0.0.1)
|
|
||||||
data_mapper (~> 1.2.0)
|
|
||||||
dm-ar-finders (~> 1.2.0)
|
|
||||||
dm-constraints (~> 1.2.0)
|
|
||||||
dm-postgres-adapter (~> 1.2.0)
|
|
||||||
girl_friday (~> 0.10)
|
|
||||||
hashie
|
|
||||||
rack-mount (~> 0.8.3)
|
|
||||||
tent-client
|
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: http://rubygems.org/
|
remote: http://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
addressable (2.2.8)
|
|
||||||
adsf (1.1.1)
|
adsf (1.1.1)
|
||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
bcrypt-ruby (3.0.1)
|
|
||||||
blankslate (2.1.2.4)
|
blankslate (2.1.2.4)
|
||||||
builder (3.1.1)
|
builder (3.1.1)
|
||||||
clogger (1.1.0)
|
clogger (1.1.0)
|
||||||
rack (> 0.9)
|
rack (> 0.9)
|
||||||
colored (1.2)
|
colored (1.2)
|
||||||
connection_pool (0.9.2)
|
|
||||||
cri (2.3.0)
|
cri (2.3.0)
|
||||||
colored (>= 1.2)
|
colored (>= 1.2)
|
||||||
data_mapper (1.2.0)
|
|
||||||
dm-aggregates (~> 1.2.0)
|
|
||||||
dm-constraints (~> 1.2.0)
|
|
||||||
dm-core (~> 1.2.0)
|
|
||||||
dm-migrations (~> 1.2.0)
|
|
||||||
dm-serializer (~> 1.2.0)
|
|
||||||
dm-timestamps (~> 1.2.0)
|
|
||||||
dm-transactions (~> 1.2.0)
|
|
||||||
dm-types (~> 1.2.0)
|
|
||||||
dm-validations (~> 1.2.0)
|
|
||||||
data_objects (0.10.8)
|
|
||||||
addressable (~> 2.1)
|
|
||||||
dm-aggregates (1.2.0)
|
|
||||||
dm-core (~> 1.2.0)
|
|
||||||
dm-ar-finders (1.2.0)
|
|
||||||
dm-core (~> 1.2.0)
|
|
||||||
dm-constraints (1.2.0)
|
|
||||||
dm-core (~> 1.2.0)
|
|
||||||
dm-core (1.2.0)
|
|
||||||
addressable (~> 2.2.6)
|
|
||||||
dm-do-adapter (1.2.0)
|
|
||||||
data_objects (~> 0.10.6)
|
|
||||||
dm-core (~> 1.2.0)
|
|
||||||
dm-migrations (1.2.0)
|
|
||||||
dm-core (~> 1.2.0)
|
|
||||||
dm-postgres-adapter (1.2.0)
|
|
||||||
dm-do-adapter (~> 1.2.0)
|
|
||||||
do_postgres (~> 0.10.6)
|
|
||||||
dm-serializer (1.2.2)
|
|
||||||
dm-core (~> 1.2.0)
|
|
||||||
fastercsv (~> 1.5)
|
|
||||||
json (~> 1.6)
|
|
||||||
json_pure (~> 1.6)
|
|
||||||
multi_json (~> 1.0)
|
|
||||||
dm-timestamps (1.2.0)
|
|
||||||
dm-core (~> 1.2.0)
|
|
||||||
dm-transactions (1.2.0)
|
|
||||||
dm-core (~> 1.2.0)
|
|
||||||
dm-types (1.2.2)
|
|
||||||
bcrypt-ruby (~> 3.0)
|
|
||||||
dm-core (~> 1.2.0)
|
|
||||||
fastercsv (~> 1.5)
|
|
||||||
json (~> 1.6)
|
|
||||||
multi_json (~> 1.0)
|
|
||||||
stringex (~> 1.4)
|
|
||||||
uuidtools (~> 2.1)
|
|
||||||
dm-validations (1.2.0)
|
|
||||||
dm-core (~> 1.2.0)
|
|
||||||
do_postgres (0.10.8)
|
|
||||||
data_objects (= 0.10.8)
|
|
||||||
fabrication (2.2.3)
|
|
||||||
faker (1.0.1)
|
|
||||||
i18n (~> 0.4)
|
|
||||||
faraday (0.8.4)
|
|
||||||
multipart-post (~> 1.1)
|
|
||||||
faraday_middleware (0.8.8)
|
|
||||||
faraday (>= 0.7.4, < 0.9)
|
|
||||||
fastercsv (1.5.5)
|
|
||||||
ffi (1.0.11)
|
ffi (1.0.11)
|
||||||
girl_friday (0.10.0)
|
|
||||||
connection_pool (~> 0.9.0)
|
|
||||||
hashie (1.2.0)
|
|
||||||
i18n (0.6.1)
|
|
||||||
json (1.7.5)
|
|
||||||
json-schema (1.0.9)
|
json-schema (1.0.9)
|
||||||
json_pure (1.7.5)
|
|
||||||
mime-types (1.19)
|
mime-types (1.19)
|
||||||
multi_json (1.3.6)
|
|
||||||
multipart-post (1.1.5)
|
|
||||||
nanoc (3.4.0)
|
nanoc (3.4.0)
|
||||||
cri (~> 2.2)
|
cri (~> 2.2)
|
||||||
nanoc-cachebuster (0.3.1)
|
nanoc-cachebuster (0.3.1)
|
||||||
|
@ -144,11 +37,7 @@ GEM
|
||||||
puma (1.6.3)
|
puma (1.6.3)
|
||||||
rack (~> 1.2)
|
rack (~> 1.2)
|
||||||
rack (1.4.1)
|
rack (1.4.1)
|
||||||
rack-mount (0.8.3)
|
|
||||||
rack (>= 1.0.0)
|
|
||||||
rack-rewrite (1.2.1)
|
rack-rewrite (1.2.1)
|
||||||
rack-test (0.6.1)
|
|
||||||
rack (>= 1.0)
|
|
||||||
rainpress (1.0)
|
rainpress (1.0)
|
||||||
redcarpet (2.1.1)
|
redcarpet (2.1.1)
|
||||||
rubypython (0.6.2)
|
rubypython (0.6.2)
|
||||||
|
@ -157,10 +46,8 @@ GEM
|
||||||
slim (1.3.0)
|
slim (1.3.0)
|
||||||
temple (~> 0.4.1)
|
temple (~> 0.4.1)
|
||||||
tilt (~> 1.3.3)
|
tilt (~> 1.3.3)
|
||||||
stringex (1.4.0)
|
|
||||||
temple (0.4.1)
|
temple (0.4.1)
|
||||||
tilt (1.3.3)
|
tilt (1.3.3)
|
||||||
uuidtools (2.1.3)
|
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
@ -180,7 +67,4 @@ DEPENDENCIES
|
||||||
rainpress
|
rainpress
|
||||||
redcarpet
|
redcarpet
|
||||||
slim
|
slim
|
||||||
tent-apidoc!
|
|
||||||
tent-client!
|
|
||||||
tent-schemas!
|
tent-schemas!
|
||||||
tentd!
|
|
||||||
|
|
3
Rules
3
Rules
|
@ -70,6 +70,9 @@ route '/' do
|
||||||
'/index.html'
|
'/index.html'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
route 'api_examples.yaml' do
|
||||||
|
end
|
||||||
|
|
||||||
route '*' do
|
route '*' do
|
||||||
next nil if item.identifier.split('/')[-1][0,1] == '_' # partial
|
next nil if item.identifier.split('/')[-1][0,1] == '_' # partial
|
||||||
|
|
||||||
|
|
316
content/docs/api_examples.yaml
Normal file
316
content/docs/api_examples.yaml
Normal file
|
@ -0,0 +1,316 @@
|
||||||
|
---
|
||||||
|
:examples:
|
||||||
|
:create_follower: ! "\n```text\nPOST /followers HTTP/1.1\nContent-Type: application/vnd.tent.v0+json\nAccept:
|
||||||
|
application/vnd.tent.v0+json\n```\n\n```json\n{\n \"entity\": \"https://example.org\",\n
|
||||||
|
\ \"types\": [\n \"all\"\n ],\n \"licenses\": [\n \"http://creativecommons.org/licenses/by/3.0/\"\n
|
||||||
|
\ ]\n}\n```\n\n```text\nHTTP/1.1 200 OK\nContent-Type: application/vnd.tent.v0+json\nContent-Length:
|
||||||
|
254\n```\n\n```json\n{\n \"entity\": \"https://example.org\",\n \"permissions\":
|
||||||
|
{\n \"public\": false\n },\n \"id\": \"dpqw2k\",\n \"mac_key_id\": \"s:efec812e\",\n
|
||||||
|
\ \"mac_key\": \"3aa93bc378d3b30a1b9c1c67411e6197\",\n \"mac_algorithm\": \"hmac-sha-256\",\n
|
||||||
|
\ \"licenses\": [\n \"http://creativecommons.org/licenses/by/3.0/\"\n ],\n
|
||||||
|
\ \"types\": [\n \"all\"\n ]\n}\n```\n"
|
||||||
|
:get_follower: ! "\n```text\nGET /followers/dpqw2k HTTP/1.1\nAccept: application/vnd.tent.v0+json\nAuthorization:
|
||||||
|
MAC id=\"s:efec812e\", ts=\"1347021179\", nonce=\"2ddbef\", mac=\"6VL/yB3GdOTxXRge/v9f8Dg1/4cb2Q53riHkqbNlwcc=\"\n```\n\n```text\nHTTP/1.1
|
||||||
|
200 OK\nContent-Type: application/vnd.tent.v0+json\nLast-Modified: Fri, 07 Sep
|
||||||
|
2012 12:32:59 GMT\nCache-Control: private\nContent-Length: 152\n```\n\n```json\n{\n
|
||||||
|
\ \"entity\": \"https://example.org\",\n \"permissions\": {\n \"public\":
|
||||||
|
false\n },\n \"id\": \"dpqw2k\",\n \"licenses\": [\n \"http://creativecommons.org/licenses/by/3.0/\"\n
|
||||||
|
\ ],\n \"types\": [\n \"all\"\n ]\n}\n```\n"
|
||||||
|
:update_follower: ! "\n```text\nPUT /followers/dpqw2k HTTP/1.1\nContent-Type: application/vnd.tent.v0+json\nAccept:
|
||||||
|
application/vnd.tent.v0+json\nAuthorization: MAC id=\"s:efec812e\", ts=\"1347021179\",
|
||||||
|
nonce=\"9f1d27\", mac=\"EqowObtTw64nSMgs+PI+8HC04pPKtVTcHjtWECofok0=\"\n```\n\n```json\n{\n
|
||||||
|
\ \"entity\": \"https://example.org\",\n \"licenses\": [\n \"http://creativecommons.org/licenses/by/3.0/\"\n
|
||||||
|
\ ],\n \"types\": [\n \"https://tent.io/types/post/essay/v0.1.0#full\"\n ]\n}\n```\n\n```text\nHTTP/1.1
|
||||||
|
200 OK\nContent-Type: application/vnd.tent.v0+json\nContent-Length: 193\n```\n\n```json\n{\n
|
||||||
|
\ \"entity\": \"https://example.org\",\n \"permissions\": {\n \"public\":
|
||||||
|
false\n },\n \"id\": \"dpqw2k\",\n \"licenses\": [\n \"http://creativecommons.org/licenses/by/3.0/\"\n
|
||||||
|
\ ],\n \"types\": [\n \"https://tent.io/types/post/essay/v0.1.0#full\"\n ]\n}\n```\n"
|
||||||
|
:get_profile: ! "\n```text\nGET /profile HTTP/1.1\nAccept: application/vnd.tent.v0+json\n```\n\n```text\nHTTP/1.1
|
||||||
|
200 OK\nContent-Type: application/vnd.tent.v0+json\nContent-Length: 448\n```\n\n```json\n{\n
|
||||||
|
\ \"https://tent.io/types/info/core/v0.1.0\": {\n \"licenses\": [\n \"http://creativecommons.org/licenses/by/3.0/\"\n
|
||||||
|
\ ],\n \"entity\": \"https://example.org\",\n \"servers\": [\n \"https://tent.example.org\",\n
|
||||||
|
\ \"http://eqt5g4fuenphqinx.onion/\"\n ]\n },\n \"https://tent.io/types/info/basic/v0.1.0\":
|
||||||
|
{\n \"name\": \"The Tentity\",\n \"avatar_url\": \"http://example.org/avatar.jpg\",\n
|
||||||
|
\ \"birthdate\": \"2012-08-23\",\n \"location\": \"The Internet\",\n \"gender\":
|
||||||
|
\"Unknown\",\n \"bio\": \"Saepe ex doloribus quod et veritatis quos voluptatem.\"\n
|
||||||
|
\ }\n}\n```\n"
|
||||||
|
:create_app: ! "\n```text\nPOST /apps HTTP/1.1\nContent-Type: application/vnd.tent.v0+json\nAccept:
|
||||||
|
application/vnd.tent.v0+json\n```\n\n```json\n{\n \"name\": \"FooApp\",\n \"description\":
|
||||||
|
\"Does amazing foos with your data\",\n \"url\": \"http://example.com\",\n \"icon\":
|
||||||
|
\"http://example.com/icon.png\",\n \"redirect_uris\": [\n \"https://app.example.com/tent/callback\"\n
|
||||||
|
\ ],\n \"scopes\": {\n \"write_profile\": \"Uses an app profile section to
|
||||||
|
describe foos\",\n \"read_followings\": \"Calculates foos based on your followings\"\n
|
||||||
|
\ }\n}\n```\n\n```text\nHTTP/1.1 200 OK\nContent-Type: application/vnd.tent.v0+json\nContent-Length:
|
||||||
|
459\n```\n\n```json\n{\n \"name\": \"FooApp\",\n \"description\": \"Does amazing
|
||||||
|
foos with your data\",\n \"url\": \"http://example.com\",\n \"icon\": \"http://example.com/icon.png\",\n
|
||||||
|
\ \"redirect_uris\": [\n \"https://app.example.com/tent/callback\"\n ],\n
|
||||||
|
\ \"scopes\": {\n \"write_profile\": \"Uses an app profile section to describe
|
||||||
|
foos\",\n \"read_followings\": \"Calculates foos based on your followings\"\n
|
||||||
|
\ },\n \"id\": \"r4mte9\",\n \"mac_key_id\": \"a:7d5a9ce3\",\n \"mac_key\":
|
||||||
|
\"4bae9cd6ab9108e33b9586147b61f82c\",\n \"mac_algorithm\": \"hmac-sha-256\",\n
|
||||||
|
\ \"authorizations\": [\n\n ]\n}\n```\n"
|
||||||
|
:app_auth: ! "\n```text\nPOST /apps/r4mte9/authorizations HTTP/1.1\nContent-Type:
|
||||||
|
application/vnd.tent.v0+json\nAccept: application/vnd.tent.v0+json\nAuthorization:
|
||||||
|
MAC id=\"a:7d5a9ce3\", ts=\"1347021179\", nonce=\"1815c1\", mac=\"UeOhpfwqUGI3L6KsFXVQ3UUD0lu+vj2gDfkXe6m5MLE=\"\n```\n\n```json\n{\n
|
||||||
|
\ \"code\": \"764e470c47ff9edc3044e5c5c873c3b5\",\n \"token_type\": \"mac\"\n}\n```\n\n```text\nHTTP/1.1
|
||||||
|
200 OK\nContent-Type: application/vnd.tent.v0+json\nContent-Length: 124\n```\n\n```json\n{\n
|
||||||
|
\ \"access_token\": \"u:59c164fe\",\n \"mac_key\": \"b68e21fb7cea36fb631b46e186ffcd19\",\n
|
||||||
|
\ \"mac_algorithm\": \"hmac-sha-256\",\n \"token_type\": \"mac\"\n}\n```\n"
|
||||||
|
:get_app: ! "\n```text\nGET /apps/r4mte9 HTTP/1.1\nAccept: application/vnd.tent.v0+json\nAuthorization:
|
||||||
|
MAC id=\"a:7d5a9ce3\", ts=\"1347021179\", nonce=\"89c963\", mac=\"hs9YKdRaLPvxVNwm0M6zY2YLBy9KiTu8Wm6uIiTNoxM=\"\n```\n\n```text\nHTTP/1.1
|
||||||
|
200 OK\nContent-Type: application/vnd.tent.v0+json\nLast-Modified: Fri, 07 Sep
|
||||||
|
2012 12:32:59 GMT\nContent-Length: 853\n```\n\n```json\n{\n \"name\": \"FooApp\",\n
|
||||||
|
\ \"description\": \"Does amazing foos with your data\",\n \"url\": \"http://example.com\",\n
|
||||||
|
\ \"icon\": \"http://example.com/icon.png\",\n \"redirect_uris\": [\n \"https://app.example.com/tent/callback\"\n
|
||||||
|
\ ],\n \"scopes\": {\n \"write_profile\": \"Uses an app profile section to
|
||||||
|
describe foos\",\n \"read_followings\": \"Calculates foos based on your followings\"\n
|
||||||
|
\ },\n \"id\": \"r4mte9\",\n \"authorizations\": [\n {\n \"post_types\":
|
||||||
|
[\n \"https://tent.io/types/post/status/v0.1.0\",\n \"https://tent.io/types/post/photo/v0.1.0\"\n
|
||||||
|
\ ],\n \"profile_info_types\": [\n \"https://tent.io/types/info/basic/v0.1.0\"\n
|
||||||
|
\ ],\n \"scopes\": [\n \"read_posts\",\n \"write_posts\",\n
|
||||||
|
\ \"import_posts\",\n \"read_profile\",\n \"write_profile\",\n
|
||||||
|
\ \"read_followers\",\n \"write_followers\",\n \"read_followings\",\n
|
||||||
|
\ \"write_followings\",\n \"read_groups\",\n \"write_groups\",\n
|
||||||
|
\ \"read_permissions\",\n \"write_permissions\",\n \"read_apps\",\n
|
||||||
|
\ \"write_apps\",\n \"follow_ui\",\n \"read_secrets\",\n \"write_secrets\"\n
|
||||||
|
\ ],\n \"notification_url\": null,\n \"id\": \"2nunq7\"\n }\n
|
||||||
|
\ ]\n}\n```\n"
|
||||||
|
:update_app: ! "\n```text\nPUT /apps/r4mte9 HTTP/1.1\nContent-Type: application/vnd.tent.v0+json\nAccept:
|
||||||
|
application/vnd.tent.v0+json\nAuthorization: MAC id=\"a:7d5a9ce3\", ts=\"1347021179\",
|
||||||
|
nonce=\"e45798\", mac=\"2HVnTcuatrNAAdnoKD+zUSLVd2zgOAq76POIHItbr0M=\"\n```\n\n```json\n{\n
|
||||||
|
\ \"name\": \"FooApp\",\n \"description\": \"Does amazing foos with your data\",\n
|
||||||
|
\ \"url\": \"http://example.com\",\n \"icon\": \"http://example.com/icon.png\",\n
|
||||||
|
\ \"redirect_uris\": [\n \"https://app.example.com/tent/callback\"\n ],\n
|
||||||
|
\ \"scopes\": {\n \"write_profile\": \"Uses an app profile section to describe
|
||||||
|
foos\",\n \"read_followings\": \"Calculates foos based on your followings\",\n
|
||||||
|
\ \"write_following\": \"Follow new users when you click\"\n }\n}\n```\n\n```text\nHTTP/1.1
|
||||||
|
200 OK\nContent-Type: application/vnd.tent.v0+json\nContent-Length: 905\n```\n\n```json\n{\n
|
||||||
|
\ \"name\": \"FooApp\",\n \"description\": \"Does amazing foos with your data\",\n
|
||||||
|
\ \"url\": \"http://example.com\",\n \"icon\": \"http://example.com/icon.png\",\n
|
||||||
|
\ \"redirect_uris\": [\n \"https://app.example.com/tent/callback\"\n ],\n
|
||||||
|
\ \"scopes\": {\n \"write_profile\": \"Uses an app profile section to describe
|
||||||
|
foos\",\n \"read_followings\": \"Calculates foos based on your followings\",\n
|
||||||
|
\ \"write_following\": \"Follow new users when you click\"\n },\n \"id\":
|
||||||
|
\"r4mte9\",\n \"authorizations\": [\n {\n \"post_types\": [\n \"https://tent.io/types/post/status/v0.1.0\",\n
|
||||||
|
\ \"https://tent.io/types/post/photo/v0.1.0\"\n ],\n \"profile_info_types\":
|
||||||
|
[\n \"https://tent.io/types/info/basic/v0.1.0\"\n ],\n \"scopes\":
|
||||||
|
[\n \"read_posts\",\n \"write_posts\",\n \"import_posts\",\n
|
||||||
|
\ \"read_profile\",\n \"write_profile\",\n \"read_followers\",\n
|
||||||
|
\ \"write_followers\",\n \"read_followings\",\n \"write_followings\",\n
|
||||||
|
\ \"read_groups\",\n \"write_groups\",\n \"read_permissions\",\n
|
||||||
|
\ \"write_permissions\",\n \"read_apps\",\n \"write_apps\",\n
|
||||||
|
\ \"follow_ui\",\n \"read_secrets\",\n \"write_secrets\"\n
|
||||||
|
\ ],\n \"notification_url\": null,\n \"id\": \"2nunq7\"\n }\n
|
||||||
|
\ ]\n}\n```\n"
|
||||||
|
:discovery: ! '
|
||||||
|
|
||||||
|
```text
|
||||||
|
|
||||||
|
HEAD / HTTP/1.1
|
||||||
|
|
||||||
|
Accept: application/vnd.tent.v0+json
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
```text
|
||||||
|
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
|
||||||
|
Content-Type: text/html
|
||||||
|
|
||||||
|
Link: </profile>; rel="https://tent.io/rels/profile"
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
'
|
||||||
|
:update_profile: ! "\n```text\nPUT /profile/https%3A%2F%2Ftent.io%2Ftypes%2Finfo%2Fbasic%2Fv0.1.0
|
||||||
|
HTTP/1.1\nContent-Type: application/vnd.tent.v0+json\nAccept: application/vnd.tent.v0+json\nAuthorization:
|
||||||
|
MAC id=\"u:59c164fe\", ts=\"1347021179\", nonce=\"d7df67\", mac=\"R90fAhI3jYeiJZCNcJ76J5/ioodQr03jYmmka8R2MP4=\"\n```\n\n```json\n{\n
|
||||||
|
\ \"name\": \"The Tentity\",\n \"avatar_url\": \"http://example.org/avatar.jpg\",\n
|
||||||
|
\ \"birthdate\": \"2012-08-23\",\n \"location\": \"The Internet\",\n \"gender\":
|
||||||
|
\"Unknown\",\n \"bio\": \"Enim architecto velit dolorum nihil.\"\n}\n```\n\n```text\nHTTP/1.1
|
||||||
|
200 OK\nContent-Type: application/vnd.tent.v0+json\nContent-Length: 431\n```\n\n```json\n{\n
|
||||||
|
\ \"https://tent.io/types/info/core/v0.1.0\": {\n \"licenses\": [\n \"http://creativecommons.org/licenses/by/3.0/\"\n
|
||||||
|
\ ],\n \"entity\": \"https://example.org\",\n \"servers\": [\n \"https://tent.example.org\",\n
|
||||||
|
\ \"http://eqt5g4fuenphqinx.onion/\"\n ]\n },\n \"https://tent.io/types/info/basic/v0.1.0\":
|
||||||
|
{\n \"name\": \"The Tentity\",\n \"avatar_url\": \"http://example.org/avatar.jpg\",\n
|
||||||
|
\ \"birthdate\": \"2012-08-23\",\n \"location\": \"The Internet\",\n \"gender\":
|
||||||
|
\"Unknown\",\n \"bio\": \"Enim architecto velit dolorum nihil.\"\n }\n}\n```\n"
|
||||||
|
:create_post: ! "\n```text\nPOST /posts HTTP/1.1\nContent-Type: application/vnd.tent.v0+json\nAccept:
|
||||||
|
application/vnd.tent.v0+json\nAuthorization: MAC id=\"u:59c164fe\", ts=\"1347021179\",
|
||||||
|
nonce=\"bc1414\", mac=\"MeRTgB7M231PN1HNvwsIc9xko5NFFNNlWAz5EX5DmL8=\"\n```\n\n```json\n{\n
|
||||||
|
\ \"type\": \"https://tent.io/types/post/status/v0.1.0\",\n \"published_at\":
|
||||||
|
1347021179,\n \"permissions\": {\n \"public\": true\n },\n \"licenses\":
|
||||||
|
[\n \"http://creativecommons.org/licenses/by/3.0/\"\n ],\n \"content\": {\n
|
||||||
|
\ \"text\": \"Just landed.\",\n \"location\": {\n \"type\": \"Point\",\n
|
||||||
|
\ \"coordinates\": [\n 50.923878,\n 4.028605\n ]\n }\n
|
||||||
|
\ }\n}\n```\n\n```text\nHTTP/1.1 200 OK\nContent-Type: application/vnd.tent.v0+json\nContent-Length:
|
||||||
|
471\n```\n\n```json\n{\n \"entity\": \"https://example.org\",\n \"type\": \"https://tent.io/types/post/status/v0.1.0\",\n
|
||||||
|
\ \"licenses\": [\n \"http://creativecommons.org/licenses/by/3.0/\"\n ],\n
|
||||||
|
\ \"content\": {\n \"text\": \"Just landed.\",\n \"location\": {\n \"type\":
|
||||||
|
\"Point\",\n \"coordinates\": [\n 50.923878,\n 4.028605\n ]\n
|
||||||
|
\ }\n },\n \"published_at\": 1347021179,\n \"permissions\": {\n \"groups\":
|
||||||
|
[\n\n ],\n \"entities\": {\n },\n \"public\": true\n },\n \"id\":
|
||||||
|
\"mdvmyx\",\n \"updated_at\": 1347021179,\n \"received_at\": 1347021179,\n \"app\":
|
||||||
|
{\n \"url\": \"http://example.com\",\n \"name\": \"FooApp\"\n },\n \"attachments\":
|
||||||
|
[\n\n ],\n \"known_entity\": null\n}\n```\n"
|
||||||
|
:create_following: ! "\n```text\nPOST /followings HTTP/1.1\nContent-Type: application/vnd.tent.v0+json\nAccept:
|
||||||
|
application/vnd.tent.v0+json\nAuthorization: MAC id=\"u:59c164fe\", ts=\"1347021179\",
|
||||||
|
nonce=\"0ab15f\", mac=\"qmC88izXsxm0c6oXr6hWERDn59vse4bSoJ/nlvfHmH0=\"\n```\n\n```json\n{\n
|
||||||
|
\ \"entity\": \"https://example.org\"\n}\n```\n\n```text\nHTTP/1.1 200 OK\nContent-Type:
|
||||||
|
application/vnd.tent.v0+json\nContent-Length: 211\n```\n\n```json\n{\n \"remote_id\":
|
||||||
|
\"yr3wf4\",\n \"entity\": \"https://example.org\",\n \"permissions\": {\n \"groups\":
|
||||||
|
[\n\n ],\n \"entities\": {\n },\n \"public\": false\n },\n \"id\":
|
||||||
|
\"7emcux\",\n \"created_at\": 1347021180,\n \"updated_at\": 1347021180,\n \"groups\":
|
||||||
|
[\n\n ],\n \"profile\": {\n },\n \"licenses\": [\n\n ]\n}\n```\n"
|
||||||
|
:get_followings: ! "\n```text\nGET /followings HTTP/1.1\nAccept: application/vnd.tent.v0+json\nAuthorization:
|
||||||
|
MAC id=\"u:59c164fe\", ts=\"1347021180\", nonce=\"af85a3\", mac=\"AleRkcyK5bOJzIxIn8rs3cB7eW2ClDfUcdb1ziqcgtg=\"\n```\n\n```text\nHTTP/1.1
|
||||||
|
200 OK\nContent-Type: application/vnd.tent.v0+json\nLast-Modified: Fri, 07 Sep
|
||||||
|
2012 12:33:00 GMT\nCache-Control: private\nContent-Length: 213\n```\n\n```json\n[\n
|
||||||
|
\ {\n \"remote_id\": \"yr3wf4\",\n \"entity\": \"https://example.org\",\n
|
||||||
|
\ \"permissions\": {\n \"groups\": [\n\n ],\n \"entities\": {\n
|
||||||
|
\ },\n \"public\": false\n },\n \"id\": \"7emcux\",\n \"created_at\":
|
||||||
|
1347021180,\n \"updated_at\": 1347021180,\n \"groups\": [\n\n ],\n \"profile\":
|
||||||
|
{\n },\n \"licenses\": [\n\n ]\n }\n]\n```\n"
|
||||||
|
:get_following: ! "\n```text\nGET /followings/7emcux HTTP/1.1\nAccept: application/vnd.tent.v0+json\nAuthorization:
|
||||||
|
MAC id=\"u:59c164fe\", ts=\"1347021180\", nonce=\"5e4ae2\", mac=\"sPoeZUMm7Xf7Tr1ETEDw2UuoNmct8eA02AGiSxdZygQ=\"\n```\n\n```text\nHTTP/1.1
|
||||||
|
200 OK\nContent-Type: application/vnd.tent.v0+json\nLast-Modified: Fri, 07 Sep
|
||||||
|
2012 12:33:00 GMT\nCache-Control: private\nContent-Length: 211\n```\n\n```json\n{\n
|
||||||
|
\ \"remote_id\": \"yr3wf4\",\n \"entity\": \"https://example.org\",\n \"permissions\":
|
||||||
|
{\n \"groups\": [\n\n ],\n \"entities\": {\n },\n \"public\": false\n
|
||||||
|
\ },\n \"id\": \"7emcux\",\n \"created_at\": 1347021180,\n \"updated_at\":
|
||||||
|
1347021180,\n \"groups\": [\n\n ],\n \"profile\": {\n },\n \"licenses\":
|
||||||
|
[\n\n ]\n}\n```\n"
|
||||||
|
:delete_following: ! '
|
||||||
|
|
||||||
|
```text
|
||||||
|
|
||||||
|
DELETE /followings/7emcux HTTP/1.1
|
||||||
|
|
||||||
|
Accept: application/vnd.tent.v0+json
|
||||||
|
|
||||||
|
Authorization: MAC id="u:59c164fe", ts="1347021180", nonce="1a1a97", mac="kgacNl5QTMwDr9suKFEx37IfSY+f/o95S1XIVaBTmxc="
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
```text
|
||||||
|
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
|
||||||
|
Content-Type: text/html
|
||||||
|
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
'
|
||||||
|
:get_followers: ! "\n```text\nGET /followers HTTP/1.1\nAccept: application/vnd.tent.v0+json\nAuthorization:
|
||||||
|
MAC id=\"u:59c164fe\", ts=\"1347021180\", nonce=\"5e3775\", mac=\"/+6XwNKQ+Z6spyhxgGfaehkFAq/huE4jnM9VzM2Shv8=\"\n```\n\n```text\nHTTP/1.1
|
||||||
|
200 OK\nContent-Type: application/vnd.tent.v0+json\nLast-Modified: Fri, 07 Sep
|
||||||
|
2012 12:33:00 GMT\nCache-Control: private\nContent-Length: 1421\n```\n\n```json\n[\n
|
||||||
|
\ {\n \"entity\": \"https://example.org\",\n \"permissions\": {\n \"groups\":
|
||||||
|
[\n\n ],\n \"entities\": {\n },\n \"public\": false\n },\n
|
||||||
|
\ \"id\": \"dpqw2k\",\n \"created_at\": 1347021179,\n \"updated_at\":
|
||||||
|
1347021179,\n \"groups\": [\n\n ],\n \"profile\": {\n \"https://tent.io/types/info/core/v0.1.0\":
|
||||||
|
{\n \"licenses\": [\n \"http://creativecommons.org/licenses/by/3.0/\"\n
|
||||||
|
\ ],\n \"entity\": \"https://example.org\",\n \"servers\":
|
||||||
|
[\n \"https://tent.example.org\",\n \"http://eqt5g4fuenphqinx.onion/\"\n
|
||||||
|
\ ]\n },\n \"https://tent.io/types/info/basic/v0.1.0\": {\n \"name\":
|
||||||
|
\"The Tentity\",\n \"avatar_url\": \"http://example.org/avatar.jpg\",\n
|
||||||
|
\ \"birthdate\": \"2012-08-23\",\n \"location\": \"The Internet\",\n
|
||||||
|
\ \"gender\": \"Unknown\",\n \"bio\": \"Saepe ex doloribus quod et
|
||||||
|
veritatis quos voluptatem.\"\n }\n },\n \"licenses\": [\n \"http://creativecommons.org/licenses/by/3.0/\"\n
|
||||||
|
\ ],\n \"types\": [\n \"https://tent.io/types/post/essay/v0.1.0#full\"\n
|
||||||
|
\ ]\n },\n {\n \"entity\": \"https://example.org\",\n \"permissions\":
|
||||||
|
{\n \"groups\": [\n\n ],\n \"entities\": {\n },\n \"public\":
|
||||||
|
false\n },\n \"id\": \"yr3wf4\",\n \"created_at\": 1347021180,\n \"updated_at\":
|
||||||
|
1347021180,\n \"groups\": [\n\n ],\n \"profile\": {\n \"https://tent.io/types/info/core/v0.1.0\":
|
||||||
|
{\n \"licenses\": [\n \"http://creativecommons.org/licenses/by/3.0/\"\n
|
||||||
|
\ ],\n \"entity\": \"https://example.org\",\n \"servers\":
|
||||||
|
[\n \"https://tent.example.org\",\n \"http://eqt5g4fuenphqinx.onion/\"\n
|
||||||
|
\ ]\n },\n \"https://tent.io/types/info/basic/v0.1.0\": {\n \"name\":
|
||||||
|
\"The Tentity\",\n \"avatar_url\": \"http://example.org/avatar.jpg\",\n
|
||||||
|
\ \"birthdate\": \"2012-08-23\",\n \"location\": \"The Internet\",\n
|
||||||
|
\ \"gender\": \"Unknown\",\n \"bio\": \"Enim architecto velit dolorum
|
||||||
|
nihil.\"\n }\n },\n \"licenses\": [\n \"http://creativecommons.org/licenses/by/3.0/\"\n
|
||||||
|
\ ],\n \"types\": [\n \"all\"\n ]\n }\n]\n```\n"
|
||||||
|
:get_posts: ! "\n```text\nGET /posts HTTP/1.1\nAccept: application/vnd.tent.v0+json\nAuthorization:
|
||||||
|
MAC id=\"u:59c164fe\", ts=\"1347021180\", nonce=\"e0b414\", mac=\"Umwmol8EFsflIhzONMROdp774CvBIFLlKMpnIMmtLi4=\"\n```\n\n```text\nHTTP/1.1
|
||||||
|
200 OK\nContent-Type: application/vnd.tent.v0+json\nLast-Modified: Fri, 07 Sep
|
||||||
|
2012 12:32:59 GMT\nCache-Control: private\nContent-Length: 473\n```\n\n```json\n[\n
|
||||||
|
\ {\n \"entity\": \"https://example.org\",\n \"type\": \"https://tent.io/types/post/status/v0.1.0\",\n
|
||||||
|
\ \"licenses\": [\n \"http://creativecommons.org/licenses/by/3.0/\"\n ],\n
|
||||||
|
\ \"content\": {\n \"text\": \"Just landed.\",\n \"location\": {\n
|
||||||
|
\ \"type\": \"Point\",\n \"coordinates\": [\n 50.923878,\n
|
||||||
|
\ 4.028605\n ]\n }\n },\n \"published_at\": 1347021179,\n
|
||||||
|
\ \"permissions\": {\n \"groups\": [\n\n ],\n \"entities\": {\n
|
||||||
|
\ },\n \"public\": true\n },\n \"id\": \"mdvmyx\",\n \"updated_at\":
|
||||||
|
1347021179,\n \"received_at\": 1347021179,\n \"app\": {\n \"url\":
|
||||||
|
\"http://example.com\",\n \"name\": \"FooApp\"\n },\n \"attachments\":
|
||||||
|
[\n\n ],\n \"known_entity\": null\n }\n]\n```\n"
|
||||||
|
:get_post: ! "\n```text\nGET /posts/mdvmyx HTTP/1.1\nAccept: application/vnd.tent.v0+json\nAuthorization:
|
||||||
|
MAC id=\"u:59c164fe\", ts=\"1347021180\", nonce=\"e763e2\", mac=\"u8Kro2DaT97nawtJdE32obeHpgRyFVyxd+Xu7j8fWRE=\"\n```\n\n```text\nHTTP/1.1
|
||||||
|
200 OK\nContent-Type: application/vnd.tent.v0+json\nLast-Modified: Fri, 07 Sep
|
||||||
|
2012 12:32:59 GMT\nCache-Control: public\nContent-Length: 471\n```\n\n```json\n{\n
|
||||||
|
\ \"entity\": \"https://example.org\",\n \"type\": \"https://tent.io/types/post/status/v0.1.0\",\n
|
||||||
|
\ \"licenses\": [\n \"http://creativecommons.org/licenses/by/3.0/\"\n ],\n
|
||||||
|
\ \"content\": {\n \"text\": \"Just landed.\",\n \"location\": {\n \"type\":
|
||||||
|
\"Point\",\n \"coordinates\": [\n 50.923878,\n 4.028605\n ]\n
|
||||||
|
\ }\n },\n \"published_at\": 1347021179,\n \"permissions\": {\n \"groups\":
|
||||||
|
[\n\n ],\n \"entities\": {\n },\n \"public\": true\n },\n \"id\":
|
||||||
|
\"mdvmyx\",\n \"updated_at\": 1347021179,\n \"received_at\": 1347021179,\n \"app\":
|
||||||
|
{\n \"url\": \"http://example.com\",\n \"name\": \"FooApp\"\n },\n \"attachments\":
|
||||||
|
[\n\n ],\n \"known_entity\": null\n}\n```\n"
|
||||||
|
:follower_get_post: ! "\n```text\nGET /posts/mdvmyx HTTP/1.1\nAccept: application/vnd.tent.v0+json\nAuthorization:
|
||||||
|
MAC id=\"s:efec812e\", ts=\"1347021180\", nonce=\"72e3f7\", mac=\"jrVlEXbGON2RzheEaeEB3nOjKHfr88OlEwdgIEreKtc=\"\n```\n\n```text\nHTTP/1.1
|
||||||
|
200 OK\nContent-Type: application/vnd.tent.v0+json\nLast-Modified: Fri, 07 Sep
|
||||||
|
2012 12:32:59 GMT\nCache-Control: public\nContent-Length: 376\n```\n\n```json\n{\n
|
||||||
|
\ \"entity\": \"https://example.org\",\n \"type\": \"https://tent.io/types/post/status/v0.1.0\",\n
|
||||||
|
\ \"licenses\": [\n \"http://creativecommons.org/licenses/by/3.0/\"\n ],\n
|
||||||
|
\ \"content\": {\n \"text\": \"Just landed.\",\n \"location\": {\n \"type\":
|
||||||
|
\"Point\",\n \"coordinates\": [\n 50.923878,\n 4.028605\n ]\n
|
||||||
|
\ }\n },\n \"published_at\": 1347021179,\n \"permissions\": {\n \"public\":
|
||||||
|
true\n },\n \"id\": \"mdvmyx\",\n \"app\": {\n \"url\": \"http://example.com\",\n
|
||||||
|
\ \"name\": \"FooApp\"\n },\n \"attachments\": [\n\n ]\n}\n```\n"
|
||||||
|
:follower_get_posts: ! "\n```text\nGET /posts HTTP/1.1\nAccept: application/vnd.tent.v0+json\nAuthorization:
|
||||||
|
MAC id=\"s:efec812e\", ts=\"1347021180\", nonce=\"d286ce\", mac=\"VQNAcGkX7HVwx5odlKqDPnoAkQ6f1Jcb74WBdWmMOyc=\"\n```\n\n```text\nHTTP/1.1
|
||||||
|
200 OK\nContent-Type: application/vnd.tent.v0+json\nLast-Modified: Fri, 07 Sep
|
||||||
|
2012 12:32:59 GMT\nCache-Control: private\nContent-Length: 378\n```\n\n```json\n[\n
|
||||||
|
\ {\n \"entity\": \"https://example.org\",\n \"type\": \"https://tent.io/types/post/status/v0.1.0\",\n
|
||||||
|
\ \"licenses\": [\n \"http://creativecommons.org/licenses/by/3.0/\"\n ],\n
|
||||||
|
\ \"content\": {\n \"text\": \"Just landed.\",\n \"location\": {\n
|
||||||
|
\ \"type\": \"Point\",\n \"coordinates\": [\n 50.923878,\n
|
||||||
|
\ 4.028605\n ]\n }\n },\n \"published_at\": 1347021179,\n
|
||||||
|
\ \"permissions\": {\n \"public\": true\n },\n \"id\": \"mdvmyx\",\n
|
||||||
|
\ \"app\": {\n \"url\": \"http://example.com\",\n \"name\": \"FooApp\"\n
|
||||||
|
\ },\n \"attachments\": [\n\n ]\n }\n]\n```\n"
|
||||||
|
:delete_follower: ! '
|
||||||
|
|
||||||
|
```text
|
||||||
|
|
||||||
|
DELETE /followers/dpqw2k HTTP/1.1
|
||||||
|
|
||||||
|
Accept: application/vnd.tent.v0+json
|
||||||
|
|
||||||
|
Authorization: MAC id="s:efec812e", ts="1347021180", nonce="ad9fa8", mac="zdM3ZBkvfLtfa8OACoRCGrIN3lTRXsU1CimVx1C+Aac="
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
```text
|
||||||
|
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
|
||||||
|
Content-Type: text/html
|
||||||
|
|
||||||
|
Content-Length: 0
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
'
|
||||||
|
:variables:
|
||||||
|
:app_code: !binary |-
|
||||||
|
NzY0ZTQ3MGM0N2ZmOWVkYzMwNDRlNWM1Yzg3M2MzYjU=
|
||||||
|
:app_id: r4mte9
|
|
@ -1,9 +1,11 @@
|
||||||
require 'tent-apidoc'
|
require 'yaml'
|
||||||
|
|
||||||
class ApiExampleFilter < Nanoc::Filter
|
class ApiExampleFilter < Nanoc::Filter
|
||||||
identifier :api_example
|
identifier :api_example
|
||||||
type :text
|
type :text
|
||||||
|
|
||||||
|
DATA = YAML.load(File.read('content/docs/api_examples.yaml'))
|
||||||
|
|
||||||
def run(content, params={})
|
def run(content, params={})
|
||||||
content.gsub(/\{(\w+) example\}/) { api_example($1) }.gsub(/\{(\w+) var\}/) { api_var($1) }
|
content.gsub(/\{(\w+) example\}/) { api_example($1) }.gsub(/\{(\w+) var\}/) { api_var($1) }
|
||||||
end
|
end
|
||||||
|
@ -11,10 +13,10 @@ class ApiExampleFilter < Nanoc::Filter
|
||||||
private
|
private
|
||||||
|
|
||||||
def api_example(id)
|
def api_example(id)
|
||||||
TentApiDoc.examples[id.to_sym]
|
DATA[:examples][id.to_sym]
|
||||||
end
|
end
|
||||||
|
|
||||||
def api_var(id)
|
def api_var(id)
|
||||||
TentApiDoc.variables[id.to_sym]
|
DATA[:variables][id.to_sym]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue