roar-extensions 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +9 -0
- data/README.md +3 -1
- data/lib/roar_extensions/json_hal_extensions.rb +1 -1
- data/lib/roar_extensions/presenter.rb +4 -4
- data/lib/roar_extensions/version.rb +1 -1
- data/roar-extensions.gemspec +1 -0
- data/spec/presenter_spec.rb +1 -1
- data/spec/representable_spec.rb +4 -4
- metadata +149 -118
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Roar::Extensions
|
2
|
+
[![Build Status](https://secure.travis-ci.org/crystalcommerce/roar-extensions.png)](http://travis-ci.org/crystalcommerce/roar-extensions)
|
2
3
|
|
3
|
-
|
4
|
+
Extensions to [Roar](https://github.com/apotonick/roar). These make somewhat
|
5
|
+
breaking changes to the API to make it easier for us to work with.
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
@@ -5,15 +5,15 @@ module RoarExtensions::Presenter
|
|
5
5
|
|
6
6
|
module ConditionalEmbeds
|
7
7
|
def skip_property?(bin, options)
|
8
|
-
if bin.
|
9
|
-
super || !embed_property?(bin
|
8
|
+
if bin.options[:embedded]
|
9
|
+
super || !embed_property?(bin)
|
10
10
|
else
|
11
11
|
super
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
def embed_property?(
|
16
|
-
(@embedded & [
|
15
|
+
def embed_property?(binding)
|
16
|
+
(@embedded & [binding.name.to_sym, binding.from.to_sym]).present?
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
data/roar-extensions.gemspec
CHANGED
data/spec/presenter_spec.rb
CHANGED
@@ -159,7 +159,7 @@ module RoarExtensions
|
|
159
159
|
let(:json_options) {{ :include => [:name] }}
|
160
160
|
|
161
161
|
it "limits to the attributes requested, plus required attributes" do
|
162
|
-
subject.keys.should == ['id', 'name']
|
162
|
+
subject.keys.sort.should == ['id', 'name']
|
163
163
|
end
|
164
164
|
end
|
165
165
|
end
|
data/spec/representable_spec.rb
CHANGED
@@ -29,7 +29,7 @@ describe Representable do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it "does not write them" do
|
32
|
-
band.send(:create_representation_with, {}, {}, Representable::
|
32
|
+
band.send(:create_representation_with, {}, {}, Representable::Hash::PropertyBinding).
|
33
33
|
should == {"name" => "No One's Choice"}
|
34
34
|
end
|
35
35
|
|
@@ -37,7 +37,7 @@ describe Representable do
|
|
37
37
|
let(:band) { SkaBand.new }
|
38
38
|
|
39
39
|
it "includes the attribute with value nil" do
|
40
|
-
band.send(:create_representation_with, {}, {}, Representable::
|
40
|
+
band.send(:create_representation_with, {}, {}, Representable::Hash::PropertyBinding).
|
41
41
|
should == {"name" => "No One's Choice", "groupies" => nil}
|
42
42
|
end
|
43
43
|
end
|
@@ -49,7 +49,7 @@ describe Representable do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
it "does writes them" do
|
52
|
-
band.send(:create_representation_with, {}, {}, Representable::
|
52
|
+
band.send(:create_representation_with, {}, {}, Representable::Hash::PropertyBinding).
|
53
53
|
should == {"name" => "No One's Choice", "groupies" => false}
|
54
54
|
end
|
55
55
|
end
|
@@ -59,7 +59,7 @@ describe Representable do
|
|
59
59
|
let(:band) { PopBand.new }
|
60
60
|
|
61
61
|
it "allows false attributes" do
|
62
|
-
band.update_properties_from({"groupies" => false}, {}, Representable::
|
62
|
+
band.update_properties_from({"groupies" => false}, {}, Representable::Hash::PropertyBinding)
|
63
63
|
band.groupies.should == false
|
64
64
|
end
|
65
65
|
end
|
metadata
CHANGED
@@ -1,154 +1,176 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: roar-extensions
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Donald Plummer
|
9
14
|
- Michael Xavier
|
10
15
|
autorequire:
|
11
16
|
bindir: bin
|
12
17
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
18
|
+
|
19
|
+
date: 2012-11-07 00:00:00 Z
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
16
22
|
name: roar
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - "="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 53
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 11
|
33
|
+
- 3
|
22
34
|
version: 0.11.3
|
23
35
|
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: representable
|
24
39
|
prerelease: false
|
25
|
-
|
26
|
-
none: false
|
27
|
-
requirements:
|
28
|
-
- - '='
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: 0.11.3
|
31
|
-
- !ruby/object:Gem::Dependency
|
32
|
-
name: activesupport
|
33
|
-
requirement: !ruby/object:Gem::Requirement
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
34
41
|
none: false
|
35
|
-
requirements:
|
36
|
-
- -
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 15
|
46
|
+
segments:
|
47
|
+
- 1
|
48
|
+
- 2
|
49
|
+
- 8
|
50
|
+
version: 1.2.8
|
39
51
|
type: :runtime
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: activesupport
|
40
55
|
prerelease: false
|
41
|
-
|
42
|
-
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 31
|
62
|
+
segments:
|
63
|
+
- 2
|
64
|
+
- 3
|
65
|
+
- 14
|
46
66
|
version: 2.3.14
|
47
|
-
|
67
|
+
type: :runtime
|
68
|
+
version_requirements: *id003
|
69
|
+
- !ruby/object:Gem::Dependency
|
48
70
|
name: pry
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
|
-
requirements:
|
52
|
-
- - ! '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
type: :development
|
56
71
|
prerelease: false
|
57
|
-
|
58
|
-
none: false
|
59
|
-
requirements:
|
60
|
-
- -
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
none: false
|
67
|
-
requirements:
|
68
|
-
- - ! '>='
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: '0'
|
72
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
hash: 3
|
78
|
+
segments:
|
79
|
+
- 0
|
80
|
+
version: "0"
|
71
81
|
type: :development
|
82
|
+
version_requirements: *id004
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry-nav
|
72
85
|
prerelease: false
|
73
|
-
|
74
|
-
none: false
|
75
|
-
requirements:
|
76
|
-
- -
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
none: false
|
83
|
-
requirements:
|
84
|
-
- - ~>
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
version: 0.9.2
|
86
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
hash: 3
|
92
|
+
segments:
|
93
|
+
- 0
|
94
|
+
version: "0"
|
87
95
|
type: :development
|
96
|
+
version_requirements: *id005
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
88
99
|
prerelease: false
|
89
|
-
|
100
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
90
101
|
none: false
|
91
|
-
requirements:
|
102
|
+
requirements:
|
92
103
|
- - ~>
|
93
|
-
- !ruby/object:Gem::Version
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
hash: 63
|
106
|
+
segments:
|
107
|
+
- 0
|
108
|
+
- 9
|
109
|
+
- 2
|
94
110
|
version: 0.9.2
|
95
|
-
- !ruby/object:Gem::Dependency
|
96
|
-
name: rspec
|
97
|
-
requirement: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
|
-
requirements:
|
100
|
-
- - ~>
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: 2.10.0
|
103
111
|
type: :development
|
112
|
+
version_requirements: *id006
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: rspec
|
104
115
|
prerelease: false
|
105
|
-
|
116
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
106
117
|
none: false
|
107
|
-
requirements:
|
118
|
+
requirements:
|
108
119
|
- - ~>
|
109
|
-
- !ruby/object:Gem::Version
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
hash: 39
|
122
|
+
segments:
|
123
|
+
- 2
|
124
|
+
- 10
|
125
|
+
- 0
|
110
126
|
version: 2.10.0
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: guard
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
none: false
|
115
|
-
requirements:
|
116
|
-
- - ~>
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: 1.2.1
|
119
127
|
type: :development
|
128
|
+
version_requirements: *id007
|
129
|
+
- !ruby/object:Gem::Dependency
|
130
|
+
name: guard
|
120
131
|
prerelease: false
|
121
|
-
|
132
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
122
133
|
none: false
|
123
|
-
requirements:
|
134
|
+
requirements:
|
124
135
|
- - ~>
|
125
|
-
- !ruby/object:Gem::Version
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
hash: 29
|
138
|
+
segments:
|
139
|
+
- 1
|
140
|
+
- 2
|
141
|
+
- 1
|
126
142
|
version: 1.2.1
|
127
|
-
- !ruby/object:Gem::Dependency
|
128
|
-
name: guard-rspec
|
129
|
-
requirement: !ruby/object:Gem::Requirement
|
130
|
-
none: false
|
131
|
-
requirements:
|
132
|
-
- - ~>
|
133
|
-
- !ruby/object:Gem::Version
|
134
|
-
version: 1.1.0
|
135
143
|
type: :development
|
144
|
+
version_requirements: *id008
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: guard-rspec
|
136
147
|
prerelease: false
|
137
|
-
|
148
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
138
149
|
none: false
|
139
|
-
requirements:
|
150
|
+
requirements:
|
140
151
|
- - ~>
|
141
|
-
- !ruby/object:Gem::Version
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
hash: 19
|
154
|
+
segments:
|
155
|
+
- 1
|
156
|
+
- 1
|
157
|
+
- 0
|
142
158
|
version: 1.1.0
|
159
|
+
type: :development
|
160
|
+
version_requirements: *id009
|
143
161
|
description: Useful extensions to roar
|
144
|
-
email:
|
162
|
+
email:
|
145
163
|
- developers@crystalcommerce.com
|
146
164
|
executables: []
|
165
|
+
|
147
166
|
extensions: []
|
167
|
+
|
148
168
|
extra_rdoc_files: []
|
149
|
-
|
169
|
+
|
170
|
+
files:
|
150
171
|
- .gitignore
|
151
172
|
- .rspec
|
173
|
+
- .travis.yml
|
152
174
|
- Gemfile
|
153
175
|
- Guardfile
|
154
176
|
- LICENSE
|
@@ -182,31 +204,40 @@ files:
|
|
182
204
|
- spec/roar/representer/json/hal_spec.rb
|
183
205
|
- spec/roar_extensions_spec.rb
|
184
206
|
- spec/spec_helper.rb
|
185
|
-
homepage:
|
207
|
+
homepage: ""
|
186
208
|
licenses: []
|
209
|
+
|
187
210
|
post_install_message:
|
188
211
|
rdoc_options: []
|
189
|
-
|
212
|
+
|
213
|
+
require_paths:
|
190
214
|
- lib
|
191
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
215
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
192
216
|
none: false
|
193
|
-
requirements:
|
194
|
-
- -
|
195
|
-
- !ruby/object:Gem::Version
|
196
|
-
|
197
|
-
|
217
|
+
requirements:
|
218
|
+
- - ">="
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
hash: 3
|
221
|
+
segments:
|
222
|
+
- 0
|
223
|
+
version: "0"
|
224
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
198
225
|
none: false
|
199
|
-
requirements:
|
200
|
-
- -
|
201
|
-
- !ruby/object:Gem::Version
|
202
|
-
|
226
|
+
requirements:
|
227
|
+
- - ">="
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
hash: 3
|
230
|
+
segments:
|
231
|
+
- 0
|
232
|
+
version: "0"
|
203
233
|
requirements: []
|
234
|
+
|
204
235
|
rubyforge_project:
|
205
|
-
rubygems_version: 1.8.
|
236
|
+
rubygems_version: 1.8.17
|
206
237
|
signing_key:
|
207
238
|
specification_version: 3
|
208
239
|
summary: Useful extensions to roar
|
209
|
-
test_files:
|
240
|
+
test_files:
|
210
241
|
- spec/destroyed_record_presenter_spec.rb
|
211
242
|
- spec/helpers/embedded_parameter_parsing_spec.rb
|
212
243
|
- spec/link_presenter_spec.rb
|