apiql 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -2
  3. data/apiql.gemspec +4 -4
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1247c3ec8750be3ff5db48d0503782f5342bb42dd7f0159518eb214356886697
4
- data.tar.gz: 2f15a8174f0d452878913bf352ef7b49558bb33610fa63f33fc5bd4daa938519
3
+ metadata.gz: 1bbded1678a2f87e16c36aba467e427750d595d7da6f5ee7a99c3a282a495748
4
+ data.tar.gz: 4da0fc38f413a99f3205087430425b8df6517eff28e9675668aca488d90494a6
5
5
  SHA512:
6
- metadata.gz: 7ce244c93ce695ec8cfd56bc7f11f055312f1b59e0220a193faeb8a1a597b88733a33e8c0a2ca96e198fd01b34f15ff323bb51a6f03d715ce0ac02c643e36b84
7
- data.tar.gz: c3edf30b166525a052be905902b2f4d7641e38a099e20ac75951e40c9d2dadf24cc4f8894012c9fbe7cd07a3f3d6a0deae4d4f52c90655408f457ca682d6cb3e
6
+ metadata.gz: 5201be091148a26ec08de7092a0852c806dc44bfdab3f51cbdbd0789df5189e47483fe678260778371808836c6b4e2e4c4c16955ae113cb76cbd1e0befca57ba
7
+ data.tar.gz: d81b99f5b248df08eb685215bff5d2bd38211b36ab8006616c4c5ab21c3f52a5b876161167cd846b92e8322b1ee020a3bb01a6b9f8c4ab745e8002853b7ba8bc
data/README.md CHANGED
@@ -9,7 +9,7 @@ class UserAPIQL < ::APIQL
9
9
  def me
10
10
  authorize! :show, ::User
11
11
 
12
- context.current_user&.eager_load(:roles) # you can preload everything you need for speedup presenters
12
+ context.current_user
13
13
  end
14
14
 
15
15
  def authenticate(email, password)
@@ -58,7 +58,7 @@ end
58
58
  ```
59
59
  # JS:
60
60
 
61
- application.js:
61
+ assets/javascripts/application.js:
62
62
 
63
63
  ```javascript
64
64
  APIQL.endpoint = "/"
@@ -94,3 +94,25 @@ logout() {
94
94
  }
95
95
 
96
96
  ```
97
+
98
+ You can use initializer like this for authorization using cancancan gem:
99
+
100
+ config/initializers/apiql.rb:
101
+
102
+ ```ruby
103
+ class APIQL
104
+ delegate :authorize!, to: :context
105
+
106
+ class Context
107
+ def authorize!(*args)
108
+ ability.authorize!(*args)
109
+ end
110
+
111
+ private
112
+
113
+ def ability
114
+ @ability ||= ::Ability::Factory.build_ability_for(current_user)
115
+ end
116
+ end
117
+ end
118
+ ```
@@ -4,12 +4,12 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'apiql'
7
- spec.version = '0.1.0'
7
+ spec.version = '0.1.1'
8
8
  spec.authors = ['Dmitry Silchenko']
9
9
  spec.email = ['dmitry@desofto.com']
10
10
 
11
- spec.summary = 'APIQL.'
12
- spec.description = 'APIQL.'
11
+ spec.summary = 'Implementation of the API language similar to GraphQL for Ruby on Rails'
12
+ spec.description = 'Implementation of the API language similar to GraphQL for Ruby on Rails'
13
13
  spec.homepage = 'https://github.com/desofto/apiql'
14
14
  spec.license = 'MIT'
15
15
 
@@ -21,4 +21,4 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency 'bundler', '~> 1.11'
22
22
  spec.add_development_dependency 'rake', '~> 11.0'
23
23
  spec.add_development_dependency 'pry', '~> 0.10'
24
- end
24
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apiql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Silchenko
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.10'
55
- description: APIQL.
55
+ description: Implementation of the API language similar to GraphQL for Ruby on Rails
56
56
  email:
57
57
  - dmitry@desofto.com
58
58
  executables: []
@@ -87,5 +87,5 @@ rubyforge_project:
87
87
  rubygems_version: 2.7.6
88
88
  signing_key:
89
89
  specification_version: 4
90
- summary: APIQL.
90
+ summary: Implementation of the API language similar to GraphQL for Ruby on Rails
91
91
  test_files: []