Skip to content

nadilsons/restfolia-uritemplate

Repository files navigation

restfolia-uritemplate Build Status

Adds support to uri-templates in the dsl restfolia with the help of gem uri_template

See more about uri-template in RFC 6570

Example of use

# getting a resource
resource = Restfolia.at('http://local.service.net/id/1').get

# example of hypermedia navigation with uri-template
new_resource_ = resource.link('search').expansion(:term => "dog")
search = new_resource.get  # => GET to url http://local.service.net/d/dog
// GET http://local.service.net/id/1
{
  "value": 10,
  "name": "Test",
  "query": null,
  "tested": false,
  "links": [
    {
      "href": "http://local.service.net/{term:1}/{term}",
      "rel": "search",
      "type": "application/json"
    },
    {
      "href": "http://local.service.net/foo{?query,number}",
      "rel": "another_search",
      "type": "application/json"
    },
    {
      "href": "http://local.service.net/resource/index",
      "rel": "self",
      "type": "application/json"
    }
  ]
}

Copyright

Copyright (c) 2012 Nadilson. See LICENSE.txt for further details.

About

Adds support to uri-templates in the dsl restfolia

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages