Created
July 12, 2012 03:31
-
-
Save dyoder/3095508 to your computer and use it in GitHub Desktop.
Resource Description Schema Example
This file contains hidden or 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
account: | |
versions: | |
"1.0": | |
paths: [ "/accounts/:id" ] | |
actions: | |
get: (id) -> | |
# code for getting an account |
This file contains hidden or 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 is a variant of: | |
# | |
# https://github.com/automatthew/rigger/blob/master/examples/spire/interface.coffee | |
# | |
# intended for illustration purposes | |
# | |
# i'm ignoring authorization for a moment because i don't quite understand how that is used | |
# | |
# first thing: we know this is a resource description, so we can start right off with name. | |
# in a related story, it's possible for a single resource to have multiple URLs | |
account: | |
description: "The account resource" | |
versions: | |
"1.0": # this has to be next to support multiple versions | |
# leave it to the generator to decide format of the schema | |
schema: "http://acme.org/schema?version=1.0#account" | |
# no path / url templates here ... leave that to the code binding | |
actions: | |
# the 'get' action is not the same thing as a the GET method | |
get: | |
method: "get" | |
# when given a URL, assume it's a schema with a defined media-type attribute | |
returning: [ "http://acme.org/schema?version=1.0#account" ] | |
update: | |
method: "put" | |
taking: "http://acme.org/schema?version=1.0#account" | |
returning: [ "http://acme.org/schema?version=1.0#account" ] | |
reset: | |
method: "post" # override the default | |
returning: [ "http://acme.org/schema?version=1.0#account" ] | |
delete: | |
method: "delete" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"authorization" in the spec represents the authorization scheme used for this request. e.g. Basic, Digest, Capability
This is a direct port from the carcharadonic counterpart.