graphql_devise 1.0.1 → 1.1.0

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: 3f82f570616cfaaae35c4660c7f33939bfe749ff615f94c3cd58e6ac7261aec2
4
- data.tar.gz: 15f4a78b52e3d4ddb9f40343668f983db3eda83dcc4d0f0adda06b4b4394eb98
3
+ metadata.gz: 7325ecea583beb248fe28de9d2421121ddbff9776178bca006d16880b39867df
4
+ data.tar.gz: 7005c49c45623fa02a7f6ebd1f72d893890264564ad91ae2628814c99d811a24
5
5
  SHA512:
6
- metadata.gz: 7f22e378ecd7d40da887996eafcb77ad83c4fade6cfdfac21ad4200d10c75cfb78f3f98f675052eda164fed451dd703ad23ef3158502b24c974cbabf94e283b9
7
- data.tar.gz: 2f349211452d275da7fc07337188ff13c8fad04f2577e763a516fd6c43030f2b919bd6d713fb3ef89b2941dc603e600bc0e578df729967db370860bfa43090bf
6
+ metadata.gz: da309b6629078b7e83ac491958b613ac501be53f9166de18f0bb5df8256e4d906012454770fc76bca2c5c4b0c2b6803dec01ad58a0c8553ccbd182033f9daf6e
7
+ data.tar.gz: 5109daf3bd8103f7c70e723ed7f096e5e4b3c1eb1ebe36d02f3b7d9bea693dcc0eaf41a7f9147d1588cb7a56cd7ecccfeff1c9ecec20c9ea802ceba7794665c2
data/.circleci/config.yml CHANGED
@@ -69,35 +69,11 @@ workflows:
69
69
  - gemfiles/rails6.1_graphql1.12.gemfile
70
70
  - gemfiles/rails6.1_graphql1.13.gemfile
71
71
  - gemfiles/rails6.1_graphql2.0.gemfile
72
+ - gemfiles/rails7.0_graphql1.11.gemfile
73
+ - gemfiles/rails7.0_graphql1.12.gemfile
74
+ - gemfiles/rails7.0_graphql1.13.gemfile
75
+ - gemfiles/rails7.0_graphql2.0.gemfile
72
76
  exclude:
73
- - ruby-version: '2.2'
74
- gemfile: gemfiles/rails6.0_graphql1.11.gemfile
75
- - ruby-version: '2.2'
76
- gemfile: gemfiles/rails6.0_graphql1.12.gemfile
77
- - ruby-version: '2.2'
78
- gemfile: gemfiles/rails6.0_graphql1.13.gemfile
79
- - ruby-version: '2.2'
80
- gemfile: gemfiles/rails6.1_graphql1.11.gemfile
81
- - ruby-version: '2.2'
82
- gemfile: gemfiles/rails6.1_graphql1.12.gemfile
83
- - ruby-version: '2.2'
84
- gemfile: gemfiles/rails6.1_graphql1.13.gemfile
85
- - ruby-version: '2.2'
86
- gemfile: gemfiles/rails6.1_graphql2.0.gemfile
87
- - ruby-version: '2.3'
88
- gemfile: gemfiles/rails6.0_graphql1.11.gemfile
89
- - ruby-version: '2.3'
90
- gemfile: gemfiles/rails6.0_graphql1.12.gemfile
91
- - ruby-version: '2.3'
92
- gemfile: gemfiles/rails6.0_graphql1.13.gemfile
93
- - ruby-version: '2.3'
94
- gemfile: gemfiles/rails6.1_graphql1.11.gemfile
95
- - ruby-version: '2.3'
96
- gemfile: gemfiles/rails6.1_graphql1.12.gemfile
97
- - ruby-version: '2.3'
98
- gemfile: gemfiles/rails6.1_graphql1.13.gemfile
99
- - ruby-version: '2.3'
100
- gemfile: gemfiles/rails6.1_graphql2.0.gemfile
101
77
  - ruby-version: '2.4'
102
78
  gemfile: gemfiles/rails6.0_graphql1.11.gemfile
103
79
  - ruby-version: '2.4'
@@ -112,10 +88,34 @@ workflows:
112
88
  gemfile: gemfiles/rails6.1_graphql1.13.gemfile
113
89
  - ruby-version: '2.4'
114
90
  gemfile: gemfiles/rails6.1_graphql2.0.gemfile
91
+ - ruby-version: '2.4'
92
+ gemfile: gemfiles/rails7.0_graphql1.11.gemfile
93
+ - ruby-version: '2.4'
94
+ gemfile: gemfiles/rails7.0_graphql1.12.gemfile
95
+ - ruby-version: '2.4'
96
+ gemfile: gemfiles/rails7.0_graphql1.13.gemfile
97
+ - ruby-version: '2.4'
98
+ gemfile: gemfiles/rails7.0_graphql2.0.gemfile
99
+ - ruby-version: '2.5'
100
+ gemfile: gemfiles/rails7.0_graphql1.11.gemfile
115
101
  - ruby-version: '2.5'
116
102
  gemfile: gemfiles/rails6.0_graphql1.13.gemfile
117
103
  - ruby-version: '2.5'
118
104
  gemfile: gemfiles/rails6.1_graphql1.13.gemfile
105
+ - ruby-version: '2.5'
106
+ gemfile: gemfiles/rails7.0_graphql1.12.gemfile
107
+ - ruby-version: '2.5'
108
+ gemfile: gemfiles/rails7.0_graphql1.13.gemfile
109
+ - ruby-version: '2.5'
110
+ gemfile: gemfiles/rails7.0_graphql2.0.gemfile
111
+ - ruby-version: '2.6'
112
+ gemfile: gemfiles/rails7.0_graphql1.11.gemfile
113
+ - ruby-version: '2.6'
114
+ gemfile: gemfiles/rails7.0_graphql1.12.gemfile
115
+ - ruby-version: '2.6'
116
+ gemfile: gemfiles/rails7.0_graphql1.13.gemfile
117
+ - ruby-version: '2.6'
118
+ gemfile: gemfiles/rails7.0_graphql2.0.gemfile
119
119
  - ruby-version: '2.7'
120
120
  gemfile: gemfiles/rails4.2_graphql1.8.gemfile
121
121
  - ruby-version: '3.0'
data/Appraisals CHANGED
@@ -145,20 +145,11 @@ appraise 'rails6.1-graphql2.0' do
145
145
  gem 'graphql', '~> 2.0.1'
146
146
  end
147
147
 
148
- appraise 'rails7.0-graphql1.10' do
149
- gem 'sassc-rails'
150
- gem 'sqlite3', '~> 1.4'
151
- gem 'devise', '>= 4.7'
152
- gem 'devise_token_auth', git: 'https://github.com/lynndylanhurley/devise_token_auth', branch: 'master'
153
- gem 'rails', git: 'https://github.com/rails/rails', branch: '7-0-stable'
154
- gem 'graphql', '~> 1.10.0'
155
- end
156
-
157
148
  appraise 'rails7.0-graphql1.11' do
158
149
  gem 'sassc-rails'
159
150
  gem 'sqlite3', '~> 1.4'
160
151
  gem 'devise', '>= 4.7'
161
- gem 'devise_token_auth', git: 'https://github.com/lynndylanhurley/devise_token_auth', branch: 'master'
152
+ gem 'devise_token_auth', '>= 1.2.1'
162
153
  gem 'rails', git: 'https://github.com/rails/rails', branch: '7-0-stable'
163
154
  gem 'graphql', '~> 1.11.0'
164
155
  end
@@ -167,7 +158,7 @@ appraise 'rails7.0-graphql1.12' do
167
158
  gem 'sassc-rails'
168
159
  gem 'sqlite3', '~> 1.4'
169
160
  gem 'devise', '>= 4.7'
170
- gem 'devise_token_auth', git: 'https://github.com/lynndylanhurley/devise_token_auth', branch: 'master'
161
+ gem 'devise_token_auth', '>= 1.2.1'
171
162
  gem 'rails', git: 'https://github.com/rails/rails', branch: '7-0-stable'
172
163
  gem 'graphql', '~> 1.12.0'
173
164
  end
@@ -176,16 +167,16 @@ appraise 'rails7.0-graphql1.13' do
176
167
  gem 'sassc-rails'
177
168
  gem 'sqlite3', '~> 1.4'
178
169
  gem 'devise', '>= 4.7'
179
- gem 'devise_token_auth', git: 'https://github.com/lynndylanhurley/devise_token_auth', branch: 'master'
170
+ gem 'devise_token_auth', '>= 1.2.1'
180
171
  gem 'rails', git: 'https://github.com/rails/rails', branch: '7-0-stable'
181
172
  gem 'graphql', '~> 1.13.0'
182
173
  end
183
174
 
184
- appraise 'rails7.0-graphql_edge' do
175
+ appraise 'rails7.0-graphql2.0' do
185
176
  gem 'sassc-rails'
186
177
  gem 'sqlite3', '~> 1.4'
187
- gem 'devise_token_auth', git: 'https://github.com/lynndylanhurley/devise_token_auth', branch: 'master'
178
+ gem 'devise_token_auth', '>= 1.2.1'
188
179
  gem 'devise', '>= 4.7'
189
180
  gem 'rails', git: 'https://github.com/rails/rails', branch: '7-0-stable'
190
- gem 'graphql', git: 'https://github.com/rmosolgo/graphql-ruby', branch: 'master'
181
+ gem 'graphql', '~> 2.0.1'
191
182
  end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [v1.1.0](https://github.com/graphql-devise/graphql_devise/tree/v1.1.0) (2022-09-15)
4
+
5
+ [Full Changelog](https://github.com/graphql-devise/graphql_devise/compare/v1.0.1...v1.1.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Support Rails 7 [\#241](https://github.com/graphql-devise/graphql_devise/pull/241) ([mcelicalderon](https://github.com/mcelicalderon))
10
+
11
+ **Merged pull requests:**
12
+
13
+ - Fix typo in README file. [\#238](https://github.com/graphql-devise/graphql_devise/pull/238) ([MathiasPfeil](https://github.com/MathiasPfeil))
14
+
3
15
  ## [v1.0.1](https://github.com/graphql-devise/graphql_devise/tree/v1.0.1) (2022-08-15)
4
16
 
5
17
  [Full Changelog](https://github.com/graphql-devise/graphql_devise/compare/v1.0.0...v1.0.1)
data/README.md CHANGED
@@ -176,7 +176,7 @@ options go [here](#available-mount-options)
176
176
  ### Mounting Operations In an Existing Schema
177
177
 
178
178
  Starting with `v0.12.0` you can mount the GQL operations provided by this gem into an
179
- existing schema in you app.
179
+ existing schema in your app.
180
180
 
181
181
  ```ruby
182
182
  # app/graphql/dummy_schema.rb
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  spec.add_dependency 'devise_token_auth', '>= 0.1.43', '< 2.0'
31
31
  spec.add_dependency 'graphql', '>= 1.8', '< 2.1'
32
- spec.add_dependency 'rails', '>= 4.2', '< 6.2'
32
+ spec.add_dependency 'rails', '>= 4.2', '< 7.1'
33
33
  spec.add_dependency 'zeitwerk'
34
34
 
35
35
  spec.add_development_dependency 'appraisal'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GraphqlDevise
4
- VERSION = '1.0.1'
4
+ VERSION = '1.1.0'
5
5
  end
@@ -10,7 +10,11 @@ module Types
10
10
  field :vip_field, String, null: false, authenticate: ->(user) { user.is_a?(User) && user.vip? }
11
11
 
12
12
  def public_field
13
- 'Field does not require authentication'
13
+ if context[:current_resource]
14
+ "Authenticated user on public field: #{context[:current_resource].email}"
15
+ else
16
+ 'Field does not require authentication'
17
+ end
14
18
  end
15
19
 
16
20
  def private_field
@@ -30,6 +30,16 @@ RSpec.describe "Integrations with the user's controller" do
30
30
  it 'does not require authentication' do
31
31
  expect(json_response[:data][:publicField]).to eq('Field does not require authentication')
32
32
  end
33
+
34
+ context 'when user sends authentication headers anyway' do
35
+ let(:headers) { user.create_new_auth_token }
36
+
37
+ it 'sets current resource in the context' do
38
+ expect(json_response[:data][:publicField]).to eq(
39
+ "Authenticated user on public field: #{user.email}"
40
+ )
41
+ end
42
+ end
33
43
  end
34
44
 
35
45
  context 'when using an interpreter schema' do
@@ -38,6 +48,16 @@ RSpec.describe "Integrations with the user's controller" do
38
48
  it 'does not require authentication' do
39
49
  expect(json_response[:data][:publicField]).to eq('Field does not require authentication')
40
50
  end
51
+
52
+ context 'when user sends authentication headers anyway' do
53
+ let(:headers) { user.create_new_auth_token }
54
+
55
+ it 'sets current resource in the context' do
56
+ expect(json_response[:data][:publicField]).to eq(
57
+ "Authenticated user on public field: #{user.email}"
58
+ )
59
+ end
60
+ end
41
61
  end
42
62
  end
43
63
 
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql_devise
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Celi
8
8
  - David Revelo
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-08-15 00:00:00.000000000 Z
12
+ date: 2022-09-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: devise_token_auth
@@ -60,7 +60,7 @@ dependencies:
60
60
  version: '4.2'
61
61
  - - "<"
62
62
  - !ruby/object:Gem::Version
63
- version: '6.2'
63
+ version: '7.1'
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
@@ -70,7 +70,7 @@ dependencies:
70
70
  version: '4.2'
71
71
  - - "<"
72
72
  - !ruby/object:Gem::Version
73
- version: '6.2'
73
+ version: '7.1'
74
74
  - !ruby/object:Gem::Dependency
75
75
  name: zeitwerk
76
76
  requirement: !ruby/object:Gem::Requirement
@@ -511,7 +511,7 @@ licenses:
511
511
  metadata:
512
512
  homepage_uri: https://github.com/graphql-devise/graphql_devise
513
513
  source_code_uri: https://github.com/graphql-devise/graphql_devise
514
- post_install_message:
514
+ post_install_message:
515
515
  rdoc_options: []
516
516
  require_paths:
517
517
  - lib
@@ -526,8 +526,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
526
526
  - !ruby/object:Gem::Version
527
527
  version: '0'
528
528
  requirements: []
529
- rubygems_version: 3.1.6
530
- signing_key:
529
+ rubygems_version: 3.3.22
530
+ signing_key:
531
531
  specification_version: 4
532
532
  summary: GraphQL queries and mutations on top of devise_token_auth
533
533
  test_files: