Sha256: 181600106566db32d08b7062fb92cdbf95ee91491fa00292d33f634d42cd78cd

Contents?: true

Size: 1.3 KB

Versions: 5

Compression:

Stored size: 1.3 KB

Contents

Retrieving resources
 
There are 2 ways to initially access a resource:

* Directly accessing an entry point, without using any class: 

<pre>
   book = Restfulie.at("http://resource.entrypoint.com/book/5").as('application/atom+xml').get!
   book.title #=> "Hello world!"
</pre>

With this usage, there is no need to create a class, because Restfulie will return a model which respond to each representation's attribute.

Within the REST style, clients should not expect type safety, therefore the above example is the best way to access a REST server.

* Using an existing class:

<pre>
   class Book                                                        
     include Restfulie::Client::Base                                 
                                                                 
     uses_restfulie do |config|                                      
       config.entry_point     = 'http://restfulie.com/books'
       config.default_headers = {                                    
         :get  => { 'Accept'       => 'application/atom+xml' },      
         :post => { 'Content-Type' => 'application/atom+xml' }       
       }                                                             
     end                                                             
   end

   books = Book.get!
   p books.length #=> 5
</pre>

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
restfulie-nosqlite-1.0.4 lib/restfulie/client/README.textile
restfulie-1.1.1 lib/restfulie/client/README.textile
restfulie-1.1.0 lib/restfulie/client/README.textile
restfulie-nosqlite-1.0.3 lib/restfulie/client/README.textile
restfulie-1.0.3 lib/restfulie/client/README.textile