Class: YandexClient::Auth

Inherits:
Object
  • Object
show all
Includes:
Configurable, ErrorHandler
Defined in:
lib/yandex_client/auth.rb

Overview

Constant Summary collapse

ACTION_URL =
'https://oauth.yandex.ru/token'

Instance Method Summary collapse

Methods included from Configurable

included

Instance Method Details

#create_token(code) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/yandex_client/auth.rb', line 20

def create_token(code)
  process_response with_config.post(
    ACTION_URL,
    headers: common_headers,
    body: URI.encode_www_form(
      request_body_for('authorization_code').merge!(code: code)
    )
  )
end

#refresh_token(refresh_token) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/yandex_client/auth.rb', line 30

def refresh_token(refresh_token)
  process_response with_config.post(
    ACTION_URL,
    headers: common_headers,
    body: URI.encode_www_form(
      request_body_for('refresh_token').merge!(refresh_token: refresh_token)
    )
  )
end