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.
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - jruby-18mode # JRuby in 1.8 mode
5
+ - jruby-19mode # JRuby in 1.9 mode
6
+ - rbx-18mode
7
+ - rbx-19mode
8
+ - 1.8.7
9
+ - ree
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
- TODO: Write a gem description
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
 
@@ -1,6 +1,6 @@
1
1
  module Roar::Representer::JSON::HAL::Resources
2
2
  def compile_fragment(bin, doc)
3
- return super unless bin.definition.options[:embedded]
3
+ return super unless bin.options[:embedded]
4
4
  super(bin, doc["_embedded"] ||= {})
5
5
  end
6
6
  end
@@ -5,15 +5,15 @@ module RoarExtensions::Presenter
5
5
 
6
6
  module ConditionalEmbeds
7
7
  def skip_property?(bin, options)
8
- if bin.definition.options[:embedded]
9
- super || !embed_property?(bin.definition)
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?(definition)
16
- (@embedded & [definition.name.to_sym, definition.from.to_sym]).present?
15
+ def embed_property?(binding)
16
+ (@embedded & [binding.name.to_sym, binding.from.to_sym]).present?
17
17
  end
18
18
  end
19
19
 
@@ -1,3 +1,3 @@
1
1
  module RoarExtensions
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -16,6 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.version = RoarExtensions::VERSION
17
17
 
18
18
  gem.add_dependency("roar", "0.11.3")
19
+ gem.add_dependency("representable", "~>1.2.8")
19
20
  gem.add_dependency("activesupport", ">= 2.3.14")
20
21
 
21
22
  gem.add_development_dependency "pry"
@@ -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
@@ -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::JSON).
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::JSON).
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::JSON).
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::JSON)
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
- version: 0.0.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
- date: 2012-10-29 00:00:00.000000000 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
18
+
19
+ date: 2012-11-07 00:00:00 Z
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
16
22
  name: roar
17
- requirement: !ruby/object:Gem::Requirement
18
- none: false
19
- requirements:
20
- - - '='
21
- - !ruby/object:Gem::Version
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
- version_requirements: !ruby/object:Gem::Requirement
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
- version: 2.3.14
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
- version_requirements: !ruby/object:Gem::Requirement
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
- - !ruby/object:Gem::Dependency
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
- version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
- requirements:
60
- - - ! '>='
61
- - !ruby/object:Gem::Version
62
- version: '0'
63
- - !ruby/object:Gem::Dependency
64
- name: pry-nav
65
- requirement: !ruby/object:Gem::Requirement
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
- version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
- requirements:
76
- - - ! '>='
77
- - !ruby/object:Gem::Version
78
- version: '0'
79
- - !ruby/object:Gem::Dependency
80
- name: rake
81
- requirement: !ruby/object:Gem::Requirement
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
- version_requirements: !ruby/object:Gem::Requirement
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
- version_requirements: !ruby/object:Gem::Requirement
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
- version_requirements: !ruby/object:Gem::Requirement
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
- version_requirements: !ruby/object:Gem::Requirement
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
- files:
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
- require_paths:
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
- version: '0'
197
- required_rubygems_version: !ruby/object:Gem::Requirement
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
- version: '0'
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.24
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