authkeeper 0.1.26 → 0.1.28

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: a299b6ba8215f0f45740988570057aace8f727572f647868af2a7e33cd288021
4
- data.tar.gz: 69a089fda3bc8a4aa1d8a7d252f745f23fd6a3438804b06095975fec4c5c8a83
3
+ metadata.gz: 9d6e8bb0f657638eb4551de52d7f344bf1682cc1d5a80cdd5920cbb5f35cbc4d
4
+ data.tar.gz: b4c45bbc2fcd7d99f4bead86ad62464aeb981cd1373021cad52f211ff3421730
5
5
  SHA512:
6
- metadata.gz: 36903b7238ae02388a8754192bf3b33cc019ec7c7cc1661299a4bac743710a4fa18562fc4ba27231ce09486d149173c383f7f89b895fdc9e640cc43754abc014
7
- data.tar.gz: c627570972ad3a5110797aa585b64f9f65abb06c69208d751ecbe5481908e9b42aba08e92fb5975d0e4115f953bc0981afe340fb6a5d9eda21a78ddf37d32c9c
6
+ metadata.gz: 2d16ff5dd4c99133daaf4c428884856896873d22cc801d553712f92b463a17eb43b9ef876f1c92e49f20430e29897f9fb03b749a82725dbc5ffafea5b19ca2be
7
+ data.tar.gz: 4483fae3e7215ec1d7e41d3e6e43ccc53aca71d1007fda192418e04b22204a508b63028d9208b3bba33b244577c50c746d6bc3d382f0aac81dbe9dc1280bfcc2
@@ -11,6 +11,7 @@ module Authkeeper
11
11
  when :yandex then yandex_oauth_link
12
12
  when :vk then vk_oauth_link(oauth_data)
13
13
  when :vk_ads then vk_ads_oauth_link(oauth_data)
14
+ when :avito then avito_oauth_link(oauth_data)
14
15
  end
15
16
  end
16
17
 
@@ -44,6 +45,10 @@ module Authkeeper
44
45
  def vk_ads_oauth_link(oauth_data)
45
46
  "https://ads.vk.ru/hq/settings/access?action=oauth2&response_type=code&client_id=#{oauth_data[:client_id]}&redirect_uri=#{oauth_data[:redirect_url]}&scope=#{oauth_data[:scope]}&state=#{oauth_data[:state]}"
46
47
  end
48
+
49
+ def avito_oauth_link(oauth_data)
50
+ "https://avito.ru/oauth?response_type=code&client_id=#{oauth_data[:client_id]}&scope=#{oauth_data[:scope]}&state=#{oauth_data[:state]}"
51
+ end
47
52
  # rubocop: enable Layout/LineLength
48
53
 
49
54
  def value(provider, key)
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Authkeeper
4
+ module AvitoAuthApi
5
+ class Client < Authkeeper::HttpService::Client
6
+ include Requests::AccessToken
7
+
8
+ BASE_URL = 'https://api.avito.ru/'
9
+
10
+ option :url, default: proc { BASE_URL }
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Authkeeper
4
+ module AvitoAuthApi
5
+ module Requests
6
+ module AccessToken
7
+ def fetch_access_token(client_id:, client_secret:, code:, return_raw_response: false)
8
+ form_post(
9
+ path: 'token',
10
+ body: {
11
+ grant_type: 'authorization_code',
12
+ client_id: client_id,
13
+ client_secret: client_secret,
14
+ code: code
15
+ },
16
+ headers: {
17
+ 'Content-Type' => 'application/x-www-form-urlencoded'
18
+ },
19
+ return_raw_response: return_raw_response
20
+ )
21
+ end
22
+
23
+ def refresh_access_token(client_id:, client_secret:, refresh_token:, return_raw_response: false)
24
+ form_post(
25
+ path: 'token',
26
+ body: {
27
+ grant_type: 'refresh_token',
28
+ client_id: client_id,
29
+ client_secret: client_secret,
30
+ refresh_token: refresh_token
31
+ },
32
+ headers: {
33
+ 'Content-Type' => 'application/x-www-form-urlencoded'
34
+ },
35
+ return_raw_response: return_raw_response
36
+ )
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -29,6 +29,7 @@ module Authkeeper
29
29
  register('api.yandex.client') { Authkeeper::YandexApi::Client.new }
30
30
  register('api.vk.auth_client') { Authkeeper::VkAuthApi::Client.new }
31
31
  register('api.vk.ads_auth_client') { Authkeeper::VkAdsAuthApi::Client.new }
32
+ register('api.avito.auth_client') { Authkeeper::AvitoAuthApi::Client.new }
32
33
 
33
34
  register('services.providers.github') { Authkeeper::Providers::Github.new }
34
35
  register('services.providers.gitlab') { Authkeeper::Providers::Gitlab.new }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Authkeeper
4
- VERSION = '0.1.26'
4
+ VERSION = '0.1.28'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authkeeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.26
4
+ version: 0.1.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bogdanov Anton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-07-12 00:00:00.000000000 Z
11
+ date: 2026-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,6 +38,8 @@ files:
38
38
  - app/controllers/authkeeper/omniauth_callbacks_controller.rb
39
39
  - app/helpers/authkeeper/application_helper.rb
40
40
  - app/jobs/authkeeper/application_job.rb
41
+ - app/lib/authkeeper/avito_auth_api/client.rb
42
+ - app/lib/authkeeper/avito_auth_api/requests/access_token.rb
41
43
  - app/lib/authkeeper/discord_api/client.rb
42
44
  - app/lib/authkeeper/discord_api/requests/user.rb
43
45
  - app/lib/authkeeper/discord_auth_api/client.rb