roar 0.11.12 → 0.11.13
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +4 -1
- data/CHANGES.markdown +4 -0
- data/Gemfile +1 -1
- data/README.textile +2 -0
- data/gemfiles/Gemfile.representable-1.4 +12 -0
- data/lib/roar/decorator.rb +1 -0
- data/lib/roar/version.rb +1 -1
- data/test/decorator_test.rb +21 -0
- metadata +5 -2
data/.travis.yml
CHANGED
data/CHANGES.markdown
CHANGED
data/Gemfile
CHANGED
data/README.textile
CHANGED
@@ -10,6 +10,8 @@ Roar comes with built-in JSON, JSON::HAL and XML support. It exposes a highly mo
|
|
10
10
|
|
11
11
|
Roar is completely framework-agnostic and loves being used in web kits like Rails, Webmachine, Sinatra, Padrino, etc. Actually, Roar makes it fun designing real, hypermedia-driven, and resource-oriented systems that will even make Steve sleep happily at night so he finally gets some REST!
|
12
12
|
|
13
|
+
Note: This README sucks and will be updated this week (April 10, 2013).
|
14
|
+
|
13
15
|
h2. Example
|
14
16
|
|
15
17
|
Say your webshop consists of two completely separated apps. The REST backend, a Sinatra app, serves articles and processes orders. The frontend, being browsed by your clients, is a rich Rails application. It queries the services for articles, renders them nicely and reads or writes orders with REST calls. That being said, the frontend turns out to be a pure REST client.
|
@@ -0,0 +1 @@
|
|
1
|
+
Roar::Decorator = Representable::Decorator
|
data/lib/roar/version.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class DecoratorTest < MiniTest::Spec
|
4
|
+
|
5
|
+
|
6
|
+
describe "Decorator" do
|
7
|
+
it "exposes ::prepare" do
|
8
|
+
if Representable::VERSION.split(".")[1] == "4"
|
9
|
+
require 'roar/decorator'
|
10
|
+
|
11
|
+
class SongRepresentation < Roar::Decorator
|
12
|
+
include Roar::Representer::JSON
|
13
|
+
|
14
|
+
property :name
|
15
|
+
end
|
16
|
+
|
17
|
+
SongRepresentation.prepare(OpenStruct.new(:name => "Not The Same")).to_hash.must_equal({"name"=>"Not The Same"})
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.13
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-04-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: representable
|
@@ -92,7 +92,9 @@ files:
|
|
92
92
|
- Rakefile
|
93
93
|
- TODO.markdown
|
94
94
|
- gemfiles/Gemfile.representable-1.3
|
95
|
+
- gemfiles/Gemfile.representable-1.4
|
95
96
|
- lib/roar.rb
|
97
|
+
- lib/roar/decorator.rb
|
96
98
|
- lib/roar/representer.rb
|
97
99
|
- lib/roar/representer/feature/client.rb
|
98
100
|
- lib/roar/representer/feature/coercion.rb
|
@@ -110,6 +112,7 @@ files:
|
|
110
112
|
- test/client_test.rb
|
111
113
|
- test/coercion_feature_test.rb
|
112
114
|
- test/collection_json_test.rb
|
115
|
+
- test/decorator_test.rb
|
113
116
|
- test/fake_server.rb
|
114
117
|
- test/faraday_http_transport_test.rb
|
115
118
|
- test/hal_json_test.rb
|