jsonapi_compliable 0.5.5 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ac1ea02274ee52a60910c86b28d7acde7849763
4
- data.tar.gz: c9355a34cc97a996f5f4ebb3c1006ce01eb092db
3
+ metadata.gz: c1a466dbd616c05cad9dd31c7c57904056e86e7a
4
+ data.tar.gz: ed4007bed09c929be5a54b1e65d8da25721b8b61
5
5
  SHA512:
6
- metadata.gz: 13eee8dc46e114513fcfabff4004ad16a96cad84e093f2c085ef6d1c71b63fc2615f124f76ba25825f454985ae6da2c17b25e101491ebec9deff7b42de16e930
7
- data.tar.gz: 6eeadb16744a3564c68f78a420bf9f3267e2cc308e470e29763de1b4936ead081c34dfbac45743f7b2022efed20b0267519d331a68ebc4e4dd4f344ba9b3d09f
6
+ metadata.gz: fd5d8efef4d85afae6f027f89ac1082e28041b6c78cd24a7da33a5e2474132f392b0c97048877fc1ed505ecb943d5a9a587486fc7b87087b34d42a7c9e874f7f
7
+ data.tar.gz: 56ceebd8d57413fd798fabe9bb3940f8c73a5bc7c8e3bb9f0d709a77e75f62e261c344a23536c317cd1e214454a1dc5ced7cd55e4829cca9b3d46d315b305e7c
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- jsonapi_compliable (0.5.2)
4
+ jsonapi_compliable (0.5.5)
5
5
  jsonapi-serializable (~> 0.1)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- jsonapi_compliable (0.5.2)
4
+ jsonapi_compliable (0.5.5)
5
5
  jsonapi-serializable (~> 0.1)
6
6
 
7
7
  GEM
@@ -17,6 +17,10 @@ module JsonapiCompliable
17
17
  raise 'you must override #sideload in an adapter subclass'
18
18
  end
19
19
 
20
+ def resolve(scope)
21
+ scope
22
+ end
23
+
20
24
  def sideloading_module
21
25
  Module.new
22
26
  end
@@ -35,6 +35,10 @@ module JsonapiCompliable
35
35
  scope.minimum(attr)
36
36
  end
37
37
 
38
+ def resolve(scope)
39
+ scope.to_a
40
+ end
41
+
38
42
  def sideloading_module
39
43
  JsonapiCompliable::Adapters::ActiveRecordSideloading
40
44
  end
@@ -193,5 +193,9 @@ module JsonapiCompliable
193
193
  def adapter
194
194
  self.class.config[:adapter]
195
195
  end
196
+
197
+ def resolve(scope)
198
+ adapter.resolve(scope)
199
+ end
196
200
  end
197
201
  end
@@ -22,9 +22,7 @@ module JsonapiCompliable
22
22
  if @query.zero_results?
23
23
  []
24
24
  else
25
- resolved = @object
26
- # TODO - configurable resolve function
27
- resolved = @object.to_a if defined?(ActiveRecord) && @object.is_a?(ActiveRecord::Relation)
25
+ resolved = @resource.resolve(@object)
28
26
  sideload(resolved, query_hash[:include]) if query_hash[:include]
29
27
  resolved
30
28
  end
@@ -1,3 +1,3 @@
1
1
  module JsonapiCompliable
2
- VERSION = "0.5.5"
2
+ VERSION = "0.5.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi_compliable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-03-06 00:00:00.000000000 Z
12
+ date: 2017-03-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jsonapi-serializable