omniauth-qiita-v2 1.1.0 → 1.3.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: 424b52c57a9f6b4c14c26c7a79ed09d330c051c17886e8d74da66b16b6c2ff42
4
- data.tar.gz: 4de61e6df80dc4eb7f8fb0c68874334103edcc3bc89374e29649a50724d9fb60
3
+ metadata.gz: e4b679036f385e173638ff9b2c05b906946cf0e79fcc5f3a232a085ff76a890c
4
+ data.tar.gz: 5156daff4789f75345af5632eb5c85b1147d64239cec829706f7e2ae2c6bd640
5
5
  SHA512:
6
- metadata.gz: e03046a56547011c65d3dd0e63158e0a5ac8ad41102bb8f5375fe58f60593640f625b252921ba5a07d16788f707f289e3216880417a69602e21d9238df6869ce
7
- data.tar.gz: '04533491a11893817248515f945e15df810dba5bf6cdb76b41322a8cbdce801d2d2d128318f5d2a70c04f395584033c59b212e8fed8391e4bf24d9812f990ce6'
6
+ metadata.gz: 7e5c405f33c342c64b33f9308f4877cac8bbf4326ae406d2882a9f3636667e95ac06da9f089e690220e6c8c36cbc3d81e4e54970a079ad82ac9780b81184e4dc
7
+ data.tar.gz: a9707c87a683b4401775ee78392faf871f437f94775d091377e055af4cfb834d93ef6a3610f899841e22d61f8762f4dde88e1f1d516254d4bc412bb794534e53
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.3.0] - 2025-07-17
4
+
5
+ - New: Remove oauth2 dependency
6
+ - Refactor: Refactoring
7
+ - Test: Update test
8
+
9
+ ## [1.2.0] - 2025-07-16
10
+
11
+ - Refactor: Refactoring
12
+ - Test: Update test
13
+ - Other: Update README.md
14
+
3
15
  ## [1.1.0] - 2025-07-15
4
16
 
5
17
  - New: Add `permanent_id` and `organization` to auth hash
data/README.md CHANGED
@@ -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: %i[qiita_v2]
60
+ :omniauthable, omniauth_providers: [:qiita_v2]
61
61
  end
62
62
  ```
63
63
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module QiitaV2
5
- VERSION = '1.1.0'
5
+ VERSION = '1.3.0'
6
6
  end
7
7
  end
@@ -61,35 +61,12 @@ module OmniAuth
61
61
  hash
62
62
  end
63
63
 
64
- def raw_info # rubocop:disable Metrics/AbcSize
65
- @raw_info ||= begin
66
- access_token.get(USER_INFO_URL).parsed || {}
67
- rescue ::OAuth2::Error => e
68
- case e.response.status
69
- when 401
70
- log :error, '401 Unauthorized - Invalid access token'
71
- raise ::OmniAuth::NoSessionError.new('Invalid access token')
72
- when 403
73
- log :error, '403 Forbidden - Insufficient permissions'
74
- raise ::OmniAuth::NoSessionError.new('Insufficient permissions')
75
- when 404
76
- log :error, '404 Not Found - User not found'
77
- raise ::OmniAuth::NoSessionError.new('User not found')
78
- else
79
- log :error, "API Error: #{e.response.status} - #{e.message}"
80
- raise e
81
- end
82
- rescue ::Errno::ETIMEDOUT
83
- log :error, 'Connection timed out'
84
- raise ::OmniAuth::NoSessionError.new('Connection timed out')
85
- rescue ::SocketError => e
86
- log :error, "Network error: #{e.message}"
87
- raise ::OmniAuth::NoSessionError.new('Network error')
88
- end
64
+ def raw_info
65
+ @raw_info ||= access_token.get(USER_INFO_URL).parsed
89
66
  end
90
67
 
91
68
  def callback_url
92
- options[:redirect_uri] || (full_host + script_name + callback_path)
69
+ options[:redirect_uri] || (full_host + callback_path)
93
70
  end
94
71
 
95
72
  def authorize_params
@@ -102,6 +79,12 @@ module OmniAuth
102
79
  end
103
80
  end
104
81
 
82
+ protected
83
+
84
+ def build_access_token
85
+ client.get_token(base_params.merge(token_params.to_hash(symbolize_keys: true)).merge(deep_symbolize(options.auth_token_params)))
86
+ end
87
+
105
88
  private
106
89
 
107
90
  def prune!(hash)
@@ -111,44 +94,17 @@ module OmniAuth
111
94
  end
112
95
  end
113
96
 
114
- def build_access_token
115
- client.get_token(access_token_params)
116
- rescue ::OAuth2::Error => e
117
- log :error, "Failed to build access token: #{e.message}"
118
- fail!(:invalid_credentials, e)
119
- rescue ::Timeout::Error, ::Errno::ETIMEDOUT => e
120
- log :error, "Timeout during token exchange: #{e.message}"
121
- fail!(:timeout, e)
122
- end
123
-
124
- def access_token_params
125
- base_params
126
- .merge(token_params_from_options)
127
- .merge(deep_symbolize(options.auth_token_params))
128
- end
129
-
130
97
  def base_params
131
98
  {
132
99
  headers: {
133
100
  'Content-Type' => 'application/json'
134
101
  },
135
- redirect_uri: callback_url,
136
102
  client_id: options.client_id,
137
103
  client_secret: options.client_secret,
104
+ redirect_uri: callback_url,
138
105
  code: request.params['code']
139
106
  }
140
107
  end
141
-
142
- def token_params_from_options
143
- return {} unless options.token_params
144
-
145
- if options.token_params.is_a?(Hash)
146
- params = options.token_params
147
- else
148
- params = options.token_params.to_hash
149
- end
150
- params.transform_keys(&:to_sym)
151
- end
152
108
  end
153
109
  end
154
110
  end
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.1.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro
@@ -9,20 +9,6 @@ bindir: exe
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
- - !ruby/object:Gem::Dependency
13
- name: oauth2
14
- requirement: !ruby/object:Gem::Requirement
15
- requirements:
16
- - - "~>"
17
- - !ruby/object:Gem::Version
18
- version: '2.0'
19
- type: :runtime
20
- prerelease: false
21
- version_requirements: !ruby/object:Gem::Requirement
22
- requirements:
23
- - - "~>"
24
- - !ruby/object:Gem::Version
25
- version: '2.0'
26
12
  - !ruby/object:Gem::Dependency
27
13
  name: omniauth
28
14
  requirement: !ruby/object:Gem::Requirement
@@ -66,15 +52,15 @@ files:
66
52
  - lib/omniauth-qiita-v2.rb
67
53
  - lib/omniauth/qiita_v2/version.rb
68
54
  - lib/omniauth/strategies/qiita_v2.rb
69
- homepage: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v1.1.0
55
+ homepage: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v1.3.0
70
56
  licenses:
71
57
  - MIT
72
58
  metadata:
73
- homepage_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v1.1.0
74
- source_code_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v1.1.0
75
- changelog_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/blob/v1.1.0/CHANGELOG.md
59
+ homepage_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v1.3.0
60
+ source_code_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v1.3.0
61
+ changelog_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/blob/v1.3.0/CHANGELOG.md
76
62
  bug_tracker_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/issues
77
- documentation_uri: https://rubydoc.info/gems/omniauth-qiita-v2/1.1.0
63
+ documentation_uri: https://rubydoc.info/gems/omniauth-qiita-v2/1.3.0
78
64
  funding_uri: https://patreon.com/CadenzaTech
79
65
  rubygems_mfa_required: 'true'
80
66
  rdoc_options: []
@@ -91,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
77
  - !ruby/object:Gem::Version
92
78
  version: '0'
93
79
  requirements: []
94
- rubygems_version: 3.6.7
80
+ rubygems_version: 3.6.9
95
81
  specification_version: 4
96
82
  summary: Qiita strategy for OmniAuth
97
83
  test_files: []