Sha256: 6b6d6c468b9d94189998c8be25664a6159489dbd674496937dc657957d495783

Contents?: true

Size: 858 Bytes

Versions: 1

Compression:

Stored size: 858 Bytes

Contents

Construct a subresource, preserving authentication.

Example:

  site = RestMan::Resource.new('http://example.com', 'adam', 'mypasswd')
  site['posts/1/comments'].post 'Good article.', :content_type => 'text/plain'

This is especially useful if you wish to define your site in one place and
call it in multiple locations:

  def orders
    RestMan::Resource.new('http://example.com/orders', 'admin', 'mypasswd')
  end

  orders.get                     # GET http://example.com/orders
  orders['1'].get                # GET http://example.com/orders/1
  orders['1/items'].delete       # DELETE http://example.com/orders/1/items

Nest resources as far as you want:

  site = RestMan::Resource.new('http://example.com')
  posts = site['posts']
  first_post = posts['1']
  comments = first_post['comments']
  comments.post 'Hello', :content_type => 'text/plain'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rest-man-1.1.0 _doc/lib/restman/resource/[].rdoc