ocean-rails 1.30.1 → 2.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d76ced15f8336158e759da79f1252633740310d
4
- data.tar.gz: c23c43d05f9267fd84a6a02603b171eb83232c4f
3
+ metadata.gz: 8d50f55650536248f495678bc60191b637fea7b5
4
+ data.tar.gz: 8924c3a57ae0ed5098015df1471a1858c15aa86f
5
5
  SHA512:
6
- metadata.gz: 38119444895e482b49738c21fe2e8efa2af3448d5d220b775a10e8428b4ee6132696777f6a9f0447707bc9e490da78fb1d9f17eee5ca399350a6fe8d392cd193
7
- data.tar.gz: b783f1a258eacf8b154ff79441625e4474304a84b3ff71db48993c4e77d653a0519c02bb82fdefc031148abf12d07cab7cd97efbe1da8e50e571df2abafe6233
6
+ metadata.gz: 89c81188c0778ff56b56a0278b09e3ab215208e425f14a9a118151836404d6d1ddeb64a88b0c8a7b44c0aab917dbb850b243056fbfcd70a1d371c3d91e92772a
7
+ data.tar.gz: 98370a8598bf8716a4b77362062637fc1d80f24d25d97eba8434eecf5a3b39ad3f74ba0eb77beba05c9d990e33036d641e392c10377b79607cf08cb23252a083
@@ -37,7 +37,13 @@ describe <%= class_name.pluralize %>Controller do
37
37
  it "should return a collection" do
38
38
  get :index
39
39
  response.status.should == 200
40
- JSON.parse(response.body).should be_an Array
40
+ wrapper = JSON.parse(response.body)
41
+ wrapper.should be_a Hash
42
+ resource = wrapper['_collection']
43
+ resource.should be_a Hash
44
+ coll = resource['resources']
45
+ coll.should be_an Array
46
+ coll.count.should == 3
41
47
  end
42
48
 
43
49
  end
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem "ocean-rails", "~> 1.0"
3
+ gem "ocean-rails", "~> 2.0"
4
4
 
5
5
  gem "rails", "~> 4.0"
6
6
  gem "pg"
@@ -174,9 +174,14 @@ module OceanApplicationController
174
174
  end
175
175
  return
176
176
  else
177
- partials = x.collect { |m| render_to_string(partial: m.to_partial_path,
178
- locals: {m.class.model_name.i18n_key => m}) }
179
- render text: '[' + partials.join(',') + ']'
177
+ resources = x.collect { |m| render_to_string(partial: m.to_partial_path,
178
+ locals: {m.class.model_name.i18n_key => m}) }
179
+ attrs = {count: resources.count}
180
+ render text: '{"_collection":{"resources":[' + resources.join(',') + ']' +
181
+ (attrs.collect do |k, v|
182
+ ',"' + k.to_s + '":' + v.to_s
183
+ end).join('') +
184
+ '}}'
180
185
  end
181
186
  end
182
187
 
@@ -1,3 +1,3 @@
1
1
  module Ocean
2
- VERSION = "1.30.1"
2
+ VERSION = "2.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.30.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Bengtson