omniauth-qiita-v2 1.4.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 156f9db42cf98499927fb2937b60c5c78e95b4dd11a9ecee5ff256feb3d4458a
4
- data.tar.gz: 9a1dfa80180f02ba9269c614ca0d68f2625a24e7daf3856cc73e4669cbb1f00b
3
+ metadata.gz: dee9d9dfd137e1ddb357b084693617f3fe145e8898bbe0908ac6db9f11116169
4
+ data.tar.gz: eeb7534f5474e5a11698ac04698f2eae4831564824c64928d2d11b24c4dd6e10
5
5
  SHA512:
6
- metadata.gz: 39c180fa2fe009f29eed214a0cd4fd0ff5e2e54ba6ff3c8dbc6d00e1f7065e74ecfe36d1786e408c1b53f0dc9d493dad793cb543441e45ebd427ce0bd764d9ca
7
- data.tar.gz: 0e03a55f4e588a4ea3414026f254a3a081d6dd6a65658825602c6ee2d18fddc0eab91847fa04509b5e6d2d152127c88d365fa188e3e791c795e092d6b2b2050e
6
+ metadata.gz: 911ab5c0b662b3265733b5f6a1a8419afcd6e5f0fcc98fb5067b12ebcc98d95abe54c260e28a98d49fcb92b437b04461c283877ab0a867b4fad9c613dcd75f95
7
+ data.tar.gz: 13c0cb04b16efec36f08e3d0b8d455463e5ee05b4355007ff6ae84d233d58982dc27bf42bd48801c641e5d7bfe8544928edbb979e9a2bc8700df2d094f47fe36
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.0.0] - 2025-11-28
4
+
5
+ - Rename strategy from `QiitaV2` to `Qiita`
6
+
7
+ ## [1.5.0] - 2025-08-02
8
+
9
+ - Refactor: Refactor `OmniAuth::Strategies::QiitaV2#authorize_params`
10
+ - Test: Update test
11
+ - Other: Update .rubocop.yml
12
+
3
13
  ## [1.4.0] - 2025-07-20
4
14
 
5
15
  - New: Update auth hash
data/README.md CHANGED
@@ -38,7 +38,7 @@ Add the following to `config/initializers/devise.rb`:
38
38
  ```ruby
39
39
  # config/initializers/devise.rb
40
40
  Devise.setup do |config|
41
- config.omniauth :qiita_v2, ENV['QIITA_CLIENT_ID'], ENV['QIITA_CLIENT_SECRET']
41
+ config.omniauth :qiita, ENV['QIITA_CLIENT_ID'], ENV['QIITA_CLIENT_SECRET']
42
42
  end
43
43
  ```
44
44
 
@@ -57,7 +57,7 @@ Add the OmniAuth configuration to your Devise model:
57
57
  class User < ApplicationRecord
58
58
  devise :database_authenticatable, :registerable,
59
59
  :recoverable, :rememberable, :validatable,
60
- :omniauthable, omniauth_providers: [:qiita_v2]
60
+ :omniauthable, omniauth_providers: [:qiita]
61
61
  end
62
62
  ```
63
63
 
@@ -68,10 +68,10 @@ You can configure several options:
68
68
  ```ruby
69
69
  # config/initializers/devise.rb
70
70
  Devise.setup do |config|
71
- config.omniauth :qiita_v2, ENV['QIITA_CLIENT_ID'], ENV['QIITA_CLIENT_SECRET'],
71
+ config.omniauth :qiita, ENV['QIITA_CLIENT_ID'], ENV['QIITA_CLIENT_SECRET'],
72
72
  {
73
73
  scope: 'read_qiita write_qiita', # Specify OAuth scopes
74
- callback_path: '/custom/qiita_v2/callback' # Custom callback path
74
+ callback_path: '/custom/qiita/callback' # Custom callback path
75
75
  }
76
76
  end
77
77
  ```
@@ -87,7 +87,7 @@ After successful authentication, the auth hash will be available in `request.env
87
87
 
88
88
  ```ruby
89
89
  {
90
- provider: 'qiita_v2',
90
+ provider: 'qiita',
91
91
  uid: 'qiita',
92
92
  info: {
93
93
  name: 'Qiita キータ',
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module QiitaV2
5
- VERSION = '1.4.0'
5
+ VERSION = '2.0.0'
6
6
  end
7
7
  end
@@ -4,22 +4,18 @@ require 'omniauth-oauth2'
4
4
 
5
5
  module OmniAuth
6
6
  module Strategies
7
- class QiitaV2 < OmniAuth::Strategies::OAuth2
7
+ class Qiita < OmniAuth::Strategies::OAuth2
8
8
  DEFAULT_SCOPE = 'read_qiita'
9
9
  USER_INFO_URL = '/api/v2/authenticated_user'
10
10
 
11
- option :name, 'qiita_v2'
12
-
11
+ option :name, 'qiita'
13
12
  option :client_options, {
14
13
  site: 'https://qiita.com',
15
14
  authorize_url: '/api/v2/oauth/authorize',
16
15
  token_url: '/api/v2/access_tokens'
17
16
  }
18
-
19
17
  option :token_params, { parse: :json }
20
-
21
18
  option :authorize_options, [:scope, :state]
22
-
23
19
  option :scope, DEFAULT_SCOPE
24
20
 
25
21
  uid { raw_info['id'] }
@@ -67,11 +63,11 @@ module OmniAuth
67
63
 
68
64
  def authorize_params
69
65
  super.tap do |params|
70
- ['scope', 'state'].each do |v|
71
- params[v.to_sym] = request.params[v] if request.params[v]
66
+ options[:authorize_options].each do |key|
67
+ params[key] = request.params[key.to_s] unless empty?(request.params[key.to_s])
72
68
  end
73
69
  params[:scope] ||= DEFAULT_SCOPE
74
- session['omniauth.state'] = params[:state] if params[:state]
70
+ session['omniauth.state'] = params[:state] unless empty?(params[:state])
75
71
  end
76
72
  end
77
73
 
@@ -86,10 +82,14 @@ module OmniAuth
86
82
  def prune!(hash)
87
83
  hash.delete_if do |_, value|
88
84
  prune!(value) if value.is_a?(Hash)
89
- value.nil? || (value.respond_to?(:empty?) && value.empty?)
85
+ empty?(value)
90
86
  end
91
87
  end
92
88
 
89
+ def empty?(value)
90
+ value.nil? || (value.respond_to?(:empty?) && value.empty?)
91
+ end
92
+
93
93
  def base_params
94
94
  {
95
95
  headers: {
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'omniauth/qiita_v2/version'
4
- require 'omniauth/strategies/qiita_v2'
4
+ require 'omniauth/strategies/qiita'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-qiita-v2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro
@@ -51,16 +51,16 @@ files:
51
51
  - Rakefile
52
52
  - lib/omniauth-qiita-v2.rb
53
53
  - lib/omniauth/qiita_v2/version.rb
54
- - lib/omniauth/strategies/qiita_v2.rb
55
- homepage: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v1.4.0
54
+ - lib/omniauth/strategies/qiita.rb
55
+ homepage: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v2.0.0
56
56
  licenses:
57
57
  - MIT
58
58
  metadata:
59
- homepage_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v1.4.0
60
- source_code_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v1.4.0
61
- changelog_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/blob/v1.4.0/CHANGELOG.md
59
+ homepage_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v2.0.0
60
+ source_code_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v2.0.0
61
+ changelog_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/blob/v2.0.0/CHANGELOG.md
62
62
  bug_tracker_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/issues
63
- documentation_uri: https://rubydoc.info/gems/omniauth-qiita-v2/1.4.0
63
+ documentation_uri: https://rubydoc.info/gems/omniauth-qiita-v2/2.0.0
64
64
  funding_uri: https://patreon.com/CadenzaTech
65
65
  rubygems_mfa_required: 'true'
66
66
  rdoc_options: []