roar 0.11.17 → 0.11.18
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +6 -5
- data/CHANGES.markdown +4 -0
- data/gemfiles/Gemfile.representable-1.5.ruby-1.8 +6 -0
- data/gemfiles/Gemfile.representable-1.5.ruby-1.9 +5 -0
- data/lib/roar/representer/feature/hypermedia.rb +1 -0
- data/lib/roar/representer/json.rb +1 -1
- data/lib/roar/representer/json/hal.rb +1 -1
- data/lib/roar/representer/xml.rb +1 -1
- data/lib/roar/version.rb +1 -1
- data/roar.gemspec +7 -2
- data/test/decorator_test.rb +9 -7
- data/test/http_verbs_feature_test.rb +2 -2
- data/test/test_helper.rb +1 -15
- metadata +88 -7
- data/gemfiles/Gemfile.representable-1.4 +0 -13
data/.travis.yml
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
matrix:
|
2
|
+
include:
|
3
|
+
- rvm: 1.9.3
|
4
|
+
gemfile: gemfiles/Gemfile.representable-1.5.ruby-1.9
|
5
|
+
- rvm: 1.8.7
|
6
|
+
gemfile: gemfiles/Gemfile.representable-1.5.ruby-1.8
|
4
7
|
notifications:
|
5
8
|
irc: "irc.freenode.org#cells"
|
6
|
-
gemfile:
|
7
|
-
- gemfiles/Gemfile.representable-1.4
|
data/CHANGES.markdown
CHANGED
@@ -47,7 +47,7 @@ module Roar
|
|
47
47
|
def links_definition_options
|
48
48
|
# FIXME: this doesn't belong into the generic JSON representer.
|
49
49
|
[:links_array, {:from => :links, :class => Feature::Hypermedia::Hyperlink, :extend => HyperlinkRepresenter, :collection => true,
|
50
|
-
:
|
50
|
+
:decorator_scope => true, :getter => lambda { |*| links_array }, :setter => lambda { |val,*| self.links_array=(val) } }]
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -159,7 +159,7 @@ module Roar::Representer
|
|
159
159
|
{
|
160
160
|
:extend => HAL::Links::LinkCollectionRepresenter,
|
161
161
|
:instance => lambda { |*| LinkCollection.new(link_array_rels) }, # defined in InstanceMethods as this is executed in represented context.
|
162
|
-
:
|
162
|
+
:decorator_scope => true,
|
163
163
|
:getter => lambda { |*| links },
|
164
164
|
:setter => lambda { |val,*| self.links=(val) }
|
165
165
|
}
|
data/lib/roar/representer/xml.rb
CHANGED
@@ -40,7 +40,7 @@ module Roar
|
|
40
40
|
def links_definition_options
|
41
41
|
# FIXME: this doesn't belong into the generic XML representer.
|
42
42
|
[:links_array, {:from => :link, :class => Feature::Hypermedia::Hyperlink, :collection => true, :extend => XML::HyperlinkRepresenter,
|
43
|
-
:
|
43
|
+
:decorator_scope => true, :getter => lambda { |*| links_array }, :setter => lambda { |val,*| self.links_array=(val) } }] # TODO: merge with JSON.
|
44
44
|
end
|
45
45
|
|
46
46
|
# Generic entry-point for parsing.
|
data/lib/roar/version.rb
CHANGED
data/roar.gemspec
CHANGED
@@ -19,9 +19,14 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
|
-
s.add_runtime_dependency "representable", ">= 1.5.
|
22
|
+
s.add_runtime_dependency "representable", ">= 1.5.2"
|
23
23
|
|
24
24
|
s.add_development_dependency "rake"
|
25
25
|
s.add_development_dependency "test_xml", ">= 0.1.4"
|
26
|
-
s.add_development_dependency "minitest", ">=
|
26
|
+
s.add_development_dependency "minitest", ">= 5.0.0"
|
27
|
+
s.add_development_dependency "sham_rack"
|
28
|
+
s.add_development_dependency "sinatra"
|
29
|
+
s.add_development_dependency "virtus"
|
30
|
+
s.add_development_dependency "faraday"
|
31
|
+
s.add_development_dependency "json"
|
27
32
|
end
|
data/test/decorator_test.rb
CHANGED
@@ -2,15 +2,17 @@ require 'test_helper'
|
|
2
2
|
require 'roar/decorator'
|
3
3
|
|
4
4
|
class DecoratorTest < MiniTest::Spec
|
5
|
-
|
6
|
-
|
7
|
-
class SongRepresentation < Roar::Decorator
|
8
|
-
include Roar::Representer::JSON
|
5
|
+
class SongRepresentation < Roar::Decorator
|
6
|
+
include Roar::Representer::JSON
|
9
7
|
|
10
|
-
|
11
|
-
|
8
|
+
property :name
|
9
|
+
end
|
12
10
|
|
13
|
-
|
11
|
+
describe "Decorator" do
|
12
|
+
let (:song) { OpenStruct.new(:name => "Not The Same") }
|
13
|
+
|
14
|
+
it "exposes ::prepare" do
|
15
|
+
SongRepresentation.prepare(song).to_hash.must_equal({"name"=>"Not The Same"})
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
@@ -55,7 +55,7 @@ class HttpVerbsTest < MiniTest::Spec
|
|
55
55
|
|
56
56
|
it 'performs no HTTP error handling with NetHttpTransport' do
|
57
57
|
@band.transport_engine = Roar::Representer::Transport::NetHTTP
|
58
|
-
assert_raises(
|
58
|
+
assert_raises(MultiJson::LoadError) do
|
59
59
|
@band.get('http://roar.example.com/bands/anthrax', "application/json")
|
60
60
|
end
|
61
61
|
end
|
@@ -74,7 +74,7 @@ class HttpVerbsTest < MiniTest::Spec
|
|
74
74
|
it "updates instance with incoming representation" do
|
75
75
|
@band.name = "Strung Out"
|
76
76
|
assert_equal nil, @band.label
|
77
|
-
|
77
|
+
|
78
78
|
@band.post("http://roar.example.com/bands", "application/xml")
|
79
79
|
assert_equal "STRUNG OUT", @band.name
|
80
80
|
assert_equal nil, @band.label
|
data/test/test_helper.rb
CHANGED
@@ -1,24 +1,10 @@
|
|
1
|
-
require '
|
2
|
-
Bundler.setup
|
3
|
-
|
4
|
-
require 'test/unit'
|
5
|
-
require 'minitest/spec'
|
1
|
+
require 'minitest/autorun'
|
6
2
|
require 'ostruct'
|
7
3
|
|
8
4
|
require 'roar/representer'
|
9
5
|
require 'roar/representer/feature/http_verbs'
|
10
6
|
require 'roar/representer/json/hal'
|
11
7
|
|
12
|
-
begin
|
13
|
-
require 'turn'
|
14
|
-
|
15
|
-
Turn.config do |config|
|
16
|
-
config.format = :dotted
|
17
|
-
# config.trace = true
|
18
|
-
end
|
19
|
-
rescue LoadError
|
20
|
-
end
|
21
|
-
|
22
8
|
module AttributesConstructor # TODO: remove me.
|
23
9
|
def initialize(attrs={})
|
24
10
|
attrs.each do |k,v|
|
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.18
|
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-05-
|
12
|
+
date: 2013-05-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: representable
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.5.
|
21
|
+
version: 1.5.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.5.
|
29
|
+
version: 1.5.2
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rake
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
requirements:
|
67
67
|
- - ! '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: 5.0.0
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,7 +74,87 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
77
|
+
version: 5.0.0
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: sham_rack
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: sinatra
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: virtus
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: faraday
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: json
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
78
158
|
description: Streamlines the development of RESTful, resource-oriented architectures
|
79
159
|
in Ruby.
|
80
160
|
email:
|
@@ -91,7 +171,8 @@ files:
|
|
91
171
|
- README.textile
|
92
172
|
- Rakefile
|
93
173
|
- TODO.markdown
|
94
|
-
- gemfiles/Gemfile.representable-1.
|
174
|
+
- gemfiles/Gemfile.representable-1.5.ruby-1.8
|
175
|
+
- gemfiles/Gemfile.representable-1.5.ruby-1.9
|
95
176
|
- lib/roar.rb
|
96
177
|
- lib/roar/decorator.rb
|
97
178
|
- lib/roar/representer.rb
|