apiql 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/apiql.gemspec +1 -1
  4. data/lib/apiql.rb +5 -0
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0bc0404a95797d80404ea76dede4ac5ab9207bcf80745ad34f1f5409594160bf
4
- data.tar.gz: 2261e778b9227a35bbcc9d649222a7b4c0760df1298ddf8057023383c25cc906
3
+ metadata.gz: fb1ebabe8ada909b6d81d7f175c34dfacac5eb97c75af10e29a1ee2f2dd9f4fd
4
+ data.tar.gz: 19980e934f637e0fc87b74f014c0ec4edb8f0730be5b8eb2c3562c06aa2b8144
5
5
  SHA512:
6
- metadata.gz: 0003b10fa365ce061d1ea8fa8e4a1500c0bf92d15cba0507c59b9f132917bd362893e036b8b9755b0dbe538e657d242c43420f672a5e03948aba18dfb149077e
7
- data.tar.gz: 4ba567161c83a2b4a47a578a18d2e8ca9fab0cfc05e6850ff9ca5882265ca6bdb2a520033cce497ba0756956706f0cda9d6f782742b66ff7af5a457c48e8fef9
6
+ metadata.gz: b258efa6ec0fbfc2841295ce888503023f41b1e9f85d7a4e76ffff73b569eba8d2d39d6aa30d04f8dcd7f68abaf0df63824d6953d8193a38837f330a67bf1070
7
+ data.tar.gz: 3a5ecde6e15da9c3fa6f9f3e3296b6d25fab6686dc318c1e1d0fee9a7bc6759dfb1c589121a2eeaade595649ac0a5fde0266682d24c9e600fac603d1221cc110
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
12
+ current_user
13
13
  end
14
14
 
15
15
  def authenticate(email, password)
@@ -20,7 +20,7 @@ class UserAPIQL < ::APIQL
20
20
  end
21
21
 
22
22
  def logout
23
- context.current_user&.logout
23
+ current_user&.logout
24
24
 
25
25
  :ok
26
26
  end
@@ -46,7 +46,7 @@ class User < ApplicationRecord
46
46
  attributes :full_name, :email, :token, :role, :roles
47
47
 
48
48
  def token
49
- object.token if object == context.current_user
49
+ object.token if object == current_user
50
50
  end
51
51
  end
52
52
 
@@ -4,7 +4,7 @@ $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.4'
7
+ spec.version = '0.1.5'
8
8
  spec.authors = ['Dmitry Silchenko']
9
9
  spec.email = ['dmitry@desofto.com']
10
10
 
@@ -54,6 +54,11 @@ class APIQL
54
54
 
55
55
  def initialize(binder, *fields)
56
56
  @context = ::APIQL::Context.new(binder, *fields)
57
+ fields.each do |field|
58
+ class_eval do
59
+ delegate field, to: :context
60
+ end
61
+ end
57
62
  end
58
63
 
59
64
  def render(schema)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apiql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Silchenko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-03 00:00:00.000000000 Z
11
+ date: 2018-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler