caelum / restfulie

CRUD through HTTP is a good step forward to using resources and becoming RESTful. Another step further into it is to make use of hypermedia-based services and the Restfulie gem allows you to do it very quickly.
Other
393 stars 43 forks source link

Tokamak syntax ambiguity #68

Closed rurounijones closed 13 years ago

rurounijones commented 13 years ago

The downloadable PDF from the caelum site has one style of tokamak syntax

collection(@items) do |collection|
    collection.link "basket", baskets_url
    collection.members do |member, item|
        partial "show", binding
    end
end

the restbuy example has another syntax:

products {
  link "order", orders_url, "type" => "application/xml"

  @products.each do |prod|
    product {
      link :self, product_url(prod)
      id prod.id
      name prod.name
      price prod.price
    }
  end  
}

and the provisioning example has yet another syntax:

describe_collection(@machines) do |collection|
  collection.links << link(:rel => :self, :href => machines_url)
  collection.describe_members do |member, machine|
    partial "show", binding
  end
end

And I think the Tokamak github page has another syntax....

This is all rather confusing to someone who is looking into restfulie for the first time. Could the correct syntax be enshrine in the Wiki and made obvious that this is the "one true syntax"?

so far I have been attempting various combinations but none of them seem to be working properly so a full example on the wiki page would be nice

guilhermesilveira commented 13 years ago

Hello there,

I've removed the old project (provisioning), and recorded a request to open source the pdf for easy update - will do it this week. I've updated the docs from Restfulie. We have forked tokamak into hypertemplate (with backwards support forever?) so we can maintain it.

Ill ask to close this one as soon as I have the pdf upadted out, ok?

In Restfulie 1.0.3 (already out), tokamak's dsl is still supported and so is this one: https://github.com/caelum/hypertemplate

Regards

rurounijones commented 13 years ago

ah excellent. I shall consider the hypertemplate syntax to be the base and work from there. thanks for the information.