gamache / hyperresource

A self-inflating Ruby client for hypermedia APIs. Not under active development.
http://hyperresource.com/doc
MIT License
304 stars 29 forks source link

Support for POST/PUT/DELETE #8

Closed jsmestad closed 11 years ago

jsmestad commented 11 years ago

I want to help contribute to this gem and where I would like to start is by adding support for other HTTP actions. How are we going to support these actions? Should we just implement '.save' on a Resource and know thats an HTTP PUT or am I missing a better way?

gamache commented 11 years ago

Hi there! Thanks for the interest in helping.

You should check out the 'tests' branch. In it, I wrote code for put and post, then got tied up trying to figure out how to test it (in particular, how to launch and later terminate a reference Sinatra API from a test). Then I got pinned at work, so it's still sitting on the shelf.

I'll be largely offline for the next two weeks, headed to the woods, so I can't be of too much help until mid-to-late August. But I intend to get some good work done on HyperResource when I return.

Thanks again!

-pete

jsmestad commented 11 years ago

@gamache ah thanks! I took a look at the branch and still cannot figure out how your detecting HTTP methods in the payload of:

{ name: "My Widgets",
          _links: {
            self: {href:"/widgets"},
            root: {href:"/"}
          },
          _embedded: {
            widgets: [
              { name: "Widget 1",
                _links: {
                  self: {href: "/widgets/1"},
                  widgets: {href: "/widgets"}
                }
              }
            ]
          }
        }

I am probably just missing something obvious, but how do you know for example that widgets: {href: '/widgets'} takes a POST for creation for example.

gamache commented 11 years ago

This is supported in the 0.1.9.4 release. Thanks for waiting! Documentation will appear in the next week.