README.markdown in roar-1.0.1 vs README.markdown in roar-1.0.2
- old
+ new
@@ -1,9 +1,11 @@
# ROAR
_Resource-Oriented Architectures in Ruby._
+[](https://travis-ci.org/apotonick/roar)
+
## Introduction
Roar is a framework for parsing and rendering REST documents. Nothing more.
Representers let you define your API document structure and semantics. They allow both rendering representations from your models _and_ parsing documents to update your Ruby objects. The bi-directional nature of representers make them interesting for both server and client usage.
@@ -22,11 +24,35 @@
Roar is just a thin layer on top of the [representable](https://github.com/apotonick/representable) gem. While Roar gives you a DSL and behaviour for creating hypermedia APIs, representable implements all the mapping functionality.
If in need for a feature, make sure to check the [representable API docs](https://github.com/apotonick/representable) first.
+## Installation
+The roar gem runs with all Ruby versions >= 1.9.3.
+
+```ruby
+gem 'roar'
+```
+
+### Dependencies
+
+Roar does not bundle dependencies for JSON and XML.
+
+If you want to use JSON, add the following to your Gemfile:
+
+```ruby
+gem 'multi_json'
+```
+
+If you want to use XML, add the following to your Gemfile:
+
+```ruby
+gem 'nokogiri'
+```
+
+
## Defining Representers
Let's see how representers work. They're fun to use.
```ruby
@@ -373,11 +399,11 @@
"http://songs/#{title}"
end
end
```
-Documentation for HAL can be found in the [API docs](http://rdoc.info/github/apotonick/roar/Roar/Representer/JSON/HAL).
+Documentation for HAL can be found in the [API docs](http://rdoc.info/github/apotonick/roar/Roar/JSON/HAL).
Make sure you [understand the different contexts](#hypermedia) for links when using decorators.
### Hypermedia
@@ -416,11 +442,11 @@
#=> {"title":"True North","_embedded":{"songs":[{"title":"The Island"},{"title":"Changing Tide"}]}}
```
HAL keys nested resources under the `_embedded` key and then by their type.
-All HAL features in Roar are discussed in the [API docs](http://rdoc.info/github/apotonick/roar/Roar/Representer/JSON/HAL), including [array links](https://github.com/apotonick/roar/blob/master/lib/roar/json/hal.rb#L176).
+All HAL features in Roar are discussed in the [API docs](http://rdoc.info/github/apotonick/roar/Roar/JSON/HAL), including [array links](https://github.com/apotonick/roar/blob/master/lib/roar/json/hal.rb#L196).
## JSON-API
Roar also supports [JSON-API](http://jsonapi.org/) - yay! It can render _and_ parse singular and collection documents.
@@ -660,11 +686,11 @@
### HTTPS
Roar supports SSL connections - they are automatically detected via the protocol.
```ruby
-song.get(uri: "https://localhost:4567/songs/1")`
+song.get(uri: "https://localhost:4567/songs/1")
```
### Basic Authentication
The HTTP verbs allow you to specify credentials for HTTP basic auth.
@@ -711,22 +737,22 @@
Roar also comes with XML support.
```ruby
module SongRepresenter
- include Roar::Representer::XML
- include Roar::Representer::Hypermedia
+ include Roar::XML
+ include Roar::Hypermedia
property :title
property :id
link :self do
"http://songs/#{title}"
end
end
```
-Include the `Roar::Representer::XML` engine and get bi-directional XML for your objects.
+Include the `Roar::XML` engine and get bi-directional XML for your objects.
```ruby
song = Song.new(title: "Roxanne", id: 42)
song.extend(XML::SongRepresenter)