graphiti-activegraph 0.1.6 → 0.1.7

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
  SHA256:
3
- metadata.gz: 7676ed353c8221dd290fe5661bae000a5b33ffc1523a666f8d23f9bf13fdef54
4
- data.tar.gz: a820f49f41ae2be5862212ee1b5c187300218a77058f1877d9b95e53b6a9c811
3
+ metadata.gz: 4ce7eee981fcd7439be5bba5208039c3c64503edcaaca9ef767cba7b27b5fd22
4
+ data.tar.gz: d591ab8b478dafe188a47a16044e998115afc9643e75e67e89036dd97891e092
5
5
  SHA512:
6
- metadata.gz: 49d1761671bc79f78fab0dfed9f198db1318dc8d7a3fe100937ddd07350259febbac5460022251920366114bb2d39863fefb2cef1867f8fb065a56d2ac258a35
7
- data.tar.gz: b12f722f29f70cab33189c4201fcbfd02efcd74bee0113e53d0bb10e11cdcf1eff572ae918c8b360f549c85e5a58c349d9170b2cc02faec7f8afba83887cce14
6
+ metadata.gz: 2934711d909710ba68d3c4a86a4c09354190099a775fdb89258daeefa2d185d637b86bc1a635608a14e384c34b18526d7c293ea33db51e47dd5aa9195f29d6e8
7
+ data.tar.gz: 7baf44eebc6191ac5cb1ce3e6ed7482ac95c495706c67c0bb7f0c090e58d423568bd3f35af914c95b21107322d88691a1a0975c70111c83fa763f695e7dd8477
@@ -0,0 +1,10 @@
1
+ ---
2
+ dist: xenial
3
+ language: ruby
4
+ jdk:
5
+ - openjdk11
6
+ cache: bundler
7
+ rvm:
8
+ - 2.7.1
9
+ - jruby-9.2.13.0
10
+ script: 'bundle exec rspec'
File without changes
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Hardik Joshi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -1,23 +1,6 @@
1
1
  module Graphiti::ActiveGraph
2
2
  module SideloadResolve
3
3
  def resolve_sideloads(parents)
4
- @query.sideloads.each_pair do |name, q|
5
- sideload = @resource.class.sideload(name)
6
- next if sideload.nil? || sideload.shared_remote?
7
-
8
- if sideload.assign_each_proc
9
- Array.wrap(parents).each do |parent|
10
- children = sideload.assign_each_proc.call(parent) || sideload.default_value_when_empty
11
-
12
- # currently there is no possible way to assign association on activegraph without triggering save
13
- # https://github.com/neo4jrb/activegraph/issues/1445
14
- # as a workaround we are using instance variable here to store and retrive associations
15
- # once above issue is fixed use that fix to assign the association here
16
- # and also remove 1) this code and 2) SerializerRelationship#data_proc
17
- parent.instance_variable_set("@graphiti_render_#{name}", { data: children })
18
- end
19
- end
20
- end
21
4
  end
22
5
  end
23
6
  end
@@ -6,11 +6,10 @@ module Graphiti::ActiveGraph
6
6
  ->(_) {
7
7
  # use custom assigned sideload if it is specified via "assign_each_proc"
8
8
  # otherwise retrieve sideload using normal getter on parent object
9
- custom_assigned_sideload = @object.instance_variable_get("@graphiti_render_#{sideload_ref.association_name}")
10
- records = if custom_assigned_sideload.blank?
11
- @object.public_send(sideload_ref.association_name)
9
+ records = if custom_proc = sideload_ref.assign_each_proc
10
+ custom_proc.call(@object)
12
11
  else
13
- custom_assigned_sideload[:data]
12
+ @object.public_send(sideload_ref.association_name)
14
13
  end
15
14
 
16
15
  if records
@@ -1,5 +1,5 @@
1
1
  module Graphiti
2
2
  module ActiveGraph
3
- VERSION = '0.1.6'
3
+ VERSION = '0.1.7'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphiti-activegraph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hardik Joshi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-06 00:00:00.000000000 Z
11
+ date: 2021-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphiti
@@ -187,7 +187,10 @@ extra_rdoc_files: []
187
187
  files:
188
188
  - ".gitignore"
189
189
  - ".rspec"
190
+ - ".travis.yml"
191
+ - CHANGELOG.md
190
192
  - Gemfile
193
+ - LICENSE.txt
191
194
  - graphiti-activegraph.gemspec
192
195
  - lib/graphiti-activegraph.rb
193
196
  - lib/graphiti/active_graph/adapters/active_graph.rb
@@ -226,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
229
  - !ruby/object:Gem::Version
227
230
  version: '0'
228
231
  requirements: []
229
- rubygems_version: 3.0.3
232
+ rubygems_version: 3.1.2
230
233
  signing_key:
231
234
  specification_version: 4
232
235
  summary: Easily build jsonapi.org-compatible APIs for GraphDB