roar 0.11.10 → 0.11.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES.markdown +5 -0
- data/lib/roar/representer/feature/hypermedia.rb +1 -1
- data/lib/roar/representer/json/hal.rb +2 -0
- data/lib/roar/version.rb +1 -1
- data/test/hypermedia_test.rb +10 -0
- metadata +2 -3
- data/test/order_representers.rb +0 -37
data/CHANGES.markdown
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
# 0.11.11
|
|
2
|
+
|
|
3
|
+
* Allow use of `::link(string)`.
|
|
4
|
+
|
|
1
5
|
## 0.11.10
|
|
6
|
+
|
|
2
7
|
* Fix a syntax error for Ruby 1.8.
|
|
3
8
|
* Store link definitions in `representable_attrs(:links)` now and no longer in the `LinksDefinition` instance itself. removing `#links_definition` in favor of `#link_configs`.
|
|
4
9
|
|
|
@@ -121,7 +121,7 @@ module Roar
|
|
|
121
121
|
# The block is executed in instance context, so you may call properties or other accessors.
|
|
122
122
|
# Note that you're free to put decider logic into #link blocks, too.
|
|
123
123
|
def link(options, &block)
|
|
124
|
-
options = {:rel => options}
|
|
124
|
+
options = {:rel => options} unless options.is_a?(Hash)
|
|
125
125
|
create_links_definition # this assures the links are rendered at the right position.
|
|
126
126
|
link_configs << [options, block]
|
|
127
127
|
end
|
data/lib/roar/version.rb
CHANGED
data/test/hypermedia_test.rb
CHANGED
|
@@ -73,6 +73,16 @@ class HypermediaTest < MiniTest::Spec
|
|
|
73
73
|
end
|
|
74
74
|
end
|
|
75
75
|
|
|
76
|
+
describe "with string rel" do
|
|
77
|
+
representer_for do
|
|
78
|
+
link("ns:self") { "//self" }
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
it "renders rel" do
|
|
82
|
+
subject.to_json.must_equal "{\"links\":[{\"rel\":\"ns:self\",\"href\":\"//self\"}]}"
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
76
86
|
describe "passing options to serialize" do
|
|
77
87
|
representer_for do
|
|
78
88
|
link(:self) { |opts| "//self/#{opts[:id]}" }
|
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.11
|
|
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-02-
|
|
12
|
+
date: 2013-02-26 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: representable
|
|
@@ -118,7 +118,6 @@ files:
|
|
|
118
118
|
- test/hypermedia_test.rb
|
|
119
119
|
- test/json_representer_test.rb
|
|
120
120
|
- test/net_http_transport_test.rb
|
|
121
|
-
- test/order_representers.rb
|
|
122
121
|
- test/representer_test.rb
|
|
123
122
|
- test/test_helper.rb
|
|
124
123
|
- test/xml_representer_test.rb
|
data/test/order_representers.rb
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
require 'roar/representer/json'
|
|
2
|
-
require 'roar/representer/feature/http_verbs'
|
|
3
|
-
require 'roar/representer/feature/hypermedia'
|
|
4
|
-
|
|
5
|
-
module JSON
|
|
6
|
-
|
|
7
|
-
class Item
|
|
8
|
-
include Roar::Representer::JSON
|
|
9
|
-
|
|
10
|
-
property :article_id
|
|
11
|
-
property :amount
|
|
12
|
-
|
|
13
|
-
include Roar::Representer::Feature::HttpVerbs
|
|
14
|
-
include Roar::Representer::Feature::Hypermedia
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class Order
|
|
19
|
-
include Roar::Representer::JSON
|
|
20
|
-
property :client_id
|
|
21
|
-
collection :items, :class => Item
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
include Roar::Representer::Feature::HttpVerbs
|
|
25
|
-
include Roar::Representer::Feature::Hypermedia
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
link :items do
|
|
29
|
-
items_url
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
link :self do
|
|
33
|
-
order_url(represented)
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
end
|