graphql_rails 0.2.0 → 0.2.1

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: 4ddb3b72250678abf86432165a3023bc21f8619635277f35b1322068d4ebab7e
4
- data.tar.gz: f13859a7e2ae0bcb65474d33b728354cad3f645d1d2fcab5e34ba1b6f6c7c634
3
+ metadata.gz: 97ae2d35ab34e958eb13f188854ae609736cbdff918eafb289404b9736dffc9d
4
+ data.tar.gz: 75ac9efeea9bf884a0ea424a40b04b293f41d25cb35a64c40c127101e7e681db
5
5
  SHA512:
6
- metadata.gz: 0be4db6d33d148a0ebf3815f70332c05254a8f4418c71f76381e1f6424d3f4b844a77926ed5f55d53d084b07e0fb7a35d95d7641eb1500b89b9380567b3c188d
7
- data.tar.gz: ab4087c4e0af4f4bdbae330ca1c613bcd42ea803f9e70b73a20eae6ea7a400de85c2702b95f339253383fb3df636100dc4898333fbe6560695a2f24bd28a3292
6
+ metadata.gz: 5e01ee3d1a638af00eea8f03be9b889081bccbe1b77a1d7b2123494bfb5b7c7f3cb3c6f5c68318203649333240514f3b5b2fa15a5760720b383e876a2143346e
7
+ data.tar.gz: 357decd9aa77806ae4cee99bae7c8257263d5ff3ef77a42daf2aa77d17481df038fab7e8ad0a5b2d80e482b90a9be32a3bf7ab182a1cf3d41e022e0d8212e4ed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graphql_rails (0.2.0)
4
+ graphql_rails (0.2.1)
5
5
  activesupport (>= 4)
6
6
  graphql (~> 1)
7
7
 
@@ -29,7 +29,7 @@ GEM
29
29
  concurrent-ruby (1.0.5)
30
30
  diff-lcs (1.3)
31
31
  docile (1.3.0)
32
- graphql (1.7.14)
32
+ graphql (1.8.0)
33
33
  i18n (1.0.1)
34
34
  concurrent-ruby (~> 1.0)
35
35
  json (2.1.0)
@@ -24,7 +24,7 @@ module GraphqlRails
24
24
  end
25
25
 
26
26
  def name
27
- @name ||= action_path.split('#').last
27
+ @name ||= action_relative_path.split('#').last
28
28
  end
29
29
 
30
30
  private
@@ -45,12 +45,8 @@ module GraphqlRails
45
45
  type
46
46
  end
47
47
 
48
- def action_path
49
- route.path
50
- end
51
-
52
- def module_name
53
- route.module_name
48
+ def action_relative_path
49
+ route.relative_path
54
50
  end
55
51
 
56
52
  def action_config
@@ -58,11 +54,11 @@ module GraphqlRails
58
54
  end
59
55
 
60
56
  def namespaced_controller_name
61
- [module_name, controller_name].reject(&:empty?).join('/')
57
+ [route.module_name, controller_name].reject(&:empty?).join('/')
62
58
  end
63
59
 
64
60
  def controller_name
65
- @controller_name ||= action_path.split('#').first
61
+ @controller_name ||= action_relative_path.split('#').first
66
62
  end
67
63
 
68
64
  def action_model
@@ -11,10 +11,10 @@ module GraphqlRails
11
11
  # accepts path of given format "controller_name#action"
12
12
  attr_reader :type
13
13
 
14
- def initialize(controller, action_name, return_type)
14
+ def initialize(controller:, action_name:, type:)
15
15
  @controller = controller
16
16
  @action_name = action_name
17
- @type = return_type
17
+ @type = type
18
18
  end
19
19
 
20
20
  def self.from_route(route)
@@ -26,7 +26,11 @@ module GraphqlRails
26
26
  end
27
27
  end
28
28
 
29
- action_function.new(action.controller, action.name, action.return_type)
29
+ action_function.new(
30
+ controller: action.controller,
31
+ action_name: action.name,
32
+ type: action.return_type
33
+ )
30
34
  end
31
35
 
32
36
  def call(object, inputs, ctx)
@@ -6,7 +6,7 @@ module GraphqlRails
6
6
  class Router
7
7
  # Generic class for any type graphql action. Should not be used directly
8
8
  class Route
9
- attr_reader :name, :module_name, :on
9
+ attr_reader :name, :module_name, :on, :relative_path
10
10
 
11
11
  def initialize(name, to:, on:, **options)
12
12
  @name = name.to_s.camelize(:lower)
@@ -31,10 +31,6 @@ module GraphqlRails
31
31
  def options
32
32
  { function: Controller::ControllerFunction.build(path) }
33
33
  end
34
-
35
- private
36
-
37
- attr_reader :relative_path
38
34
  end
39
35
  end
40
36
  end
@@ -32,7 +32,7 @@ module GraphqlRails
32
32
  name type_name
33
33
 
34
34
  routes.each do |route|
35
- field route.name, Controller::ControllerFunction.from_route(route)
35
+ field route.name, function: Controller::ControllerFunction.from_route(route)
36
36
  end
37
37
  end
38
38
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GraphqlRails
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Povilas Jurčys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-23 00:00:00.000000000 Z
11
+ date: 2018-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql