omniauth-qiita-v2 1.0.0 → 1.2.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: 6ebcad1458bccca6309a1362640a151659e5d15fc1087de80cdd04a8c372ed3a
4
- data.tar.gz: ebad76cb61bc98cd14aae9b861cb9a0f5e923996809564e9d123f5dc269ac390
3
+ metadata.gz: 723fdf502a13203f171cbaf1d228a9e0774d2cb157af55113f6b5c768a3e03b5
4
+ data.tar.gz: 0422fb4583d5e2a5e05cedd0bf89c707e2e4534492df962a9c2db01b7441542f
5
5
  SHA512:
6
- metadata.gz: 9d72d3a13f0e6c0ef7e364dee30edd17e5b6e0d62f3c5035fe6a18aecac6e53ef7340c2460dec6a30b6bc95f05e54233ff631fa9952043d40bca85443bef23a7
7
- data.tar.gz: ea014bc26d4242b7e26ca4ea7fc3db6be1696f9f8a5391f955c34e844a39a1bb7b391d37ca36e9394b1888807f44f219287577e2a6913a9b55f8189e31674885
6
+ metadata.gz: a8f5231dec93c33da16d4a561f4009ad7a6ee71e9dddf1723930dbb844d6981299b0e58c764454f8cf4c3d406669520bab1ad607d54e5f0d43d67bcdb1607b75
7
+ data.tar.gz: d45af3b090a655e8de37e8099a983a72c243a4198de6cdd753013e274189f0f400a1a3ee8d3174163bd249225609e3fd1792c8fdd647f460775b04b1d7d2c53f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.2.0] - 2025-07-16
4
+
5
+ - Refactor: Refactoring
6
+ - Test: Update test
7
+ - Other: Update README.md
8
+
9
+ ## [1.1.0] - 2025-07-15
10
+
11
+ - New: Add `permanent_id` and `organization` to auth hash
12
+ - Test: Update test
13
+ - Other: Update README.md
14
+
3
15
  ## [1.0.0] - 2025-07-15
4
16
 
5
17
  - New: Use pessimistic versioning and add oauth2 dependency
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
 
@@ -92,9 +92,11 @@ After successful authentication, the auth hash will be available in `request.env
92
92
  info: {
93
93
  name: 'John Doe',
94
94
  nickname: 'example_qiita_user_john_doe',
95
+ permanent_id: 1234567890,
95
96
  image: 'https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/...',
96
97
  description: 'Software Developer',
97
98
  location: 'Tokyo, Japan',
99
+ organization: 'Example Inc.',
98
100
  followees_count: 50,
99
101
  followers_count: 100,
100
102
  items_count: 30,
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module QiitaV2
5
- VERSION = '1.0.0'
5
+ VERSION = '1.2.0'
6
6
  end
7
7
  end
@@ -28,10 +28,12 @@ module OmniAuth
28
28
  prune!({
29
29
  name: raw_info['name'],
30
30
  nickname: raw_info['id'],
31
+ permanent_id: raw_info['permanent_id'],
31
32
  email: nil, # Qiita API v2 does not provide email
32
33
  description: raw_info['description'],
33
34
  image: raw_info['profile_image_url'],
34
35
  location: raw_info['location'],
36
+ organization: raw_info['organization'],
35
37
  followees_count: raw_info['followees_count'],
36
38
  followers_count: raw_info['followers_count'],
37
39
  items_count: raw_info['items_count'],
@@ -87,7 +89,7 @@ module OmniAuth
87
89
  end
88
90
 
89
91
  def callback_url
90
- options[:redirect_uri] || (full_host + script_name + callback_path)
92
+ options[:redirect_uri] || (full_host + callback_path)
91
93
  end
92
94
 
93
95
  def authorize_params
@@ -100,6 +102,12 @@ module OmniAuth
100
102
  end
101
103
  end
102
104
 
105
+ protected
106
+
107
+ def build_access_token
108
+ client.get_token(base_params.merge(token_params_from_options).merge(deep_symbolize(options.auth_token_params)))
109
+ end
110
+
103
111
  private
104
112
 
105
113
  def prune!(hash)
@@ -109,30 +117,14 @@ module OmniAuth
109
117
  end
110
118
  end
111
119
 
112
- def build_access_token
113
- client.get_token(access_token_params)
114
- rescue ::OAuth2::Error => e
115
- log :error, "Failed to build access token: #{e.message}"
116
- fail!(:invalid_credentials, e)
117
- rescue ::Timeout::Error, ::Errno::ETIMEDOUT => e
118
- log :error, "Timeout during token exchange: #{e.message}"
119
- fail!(:timeout, e)
120
- end
121
-
122
- def access_token_params
123
- base_params
124
- .merge(token_params_from_options)
125
- .merge(deep_symbolize(options.auth_token_params))
126
- end
127
-
128
120
  def base_params
129
121
  {
130
122
  headers: {
131
123
  'Content-Type' => 'application/json'
132
124
  },
133
- redirect_uri: callback_url,
134
125
  client_id: options.client_id,
135
126
  client_secret: options.client_secret,
127
+ redirect_uri: callback_url,
136
128
  code: request.params['code']
137
129
  }
138
130
  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.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro
@@ -66,15 +66,15 @@ files:
66
66
  - lib/omniauth-qiita-v2.rb
67
67
  - lib/omniauth/qiita_v2/version.rb
68
68
  - lib/omniauth/strategies/qiita_v2.rb
69
- homepage: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v1.0.0
69
+ homepage: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v1.2.0
70
70
  licenses:
71
71
  - MIT
72
72
  metadata:
73
- homepage_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v1.0.0
74
- source_code_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v1.0.0
75
- changelog_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/blob/v1.0.0/CHANGELOG.md
73
+ homepage_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v1.2.0
74
+ source_code_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v1.2.0
75
+ changelog_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/blob/v1.2.0/CHANGELOG.md
76
76
  bug_tracker_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/issues
77
- documentation_uri: https://rubydoc.info/gems/omniauth-qiita-v2/1.0.0
77
+ documentation_uri: https://rubydoc.info/gems/omniauth-qiita-v2/1.2.0
78
78
  funding_uri: https://patreon.com/CadenzaTech
79
79
  rubygems_mfa_required: 'true'
80
80
  rdoc_options: []
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  - !ruby/object:Gem::Version
92
92
  version: '0'
93
93
  requirements: []
94
- rubygems_version: 3.6.7
94
+ rubygems_version: 3.6.9
95
95
  specification_version: 4
96
96
  summary: Qiita strategy for OmniAuth
97
97
  test_files: []