Class: YandexClient::Passport

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

Overview

tech.yandex.ru/passport/doc/dg/reference/request-docpage/

Example:

YandexClient::Passport::Client[Token.first.access_token].info

Constant Summary collapse

ACTION_URL =
'https://login.yandex.ru/info'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Configurable

included

Constructor Details

#initialize(token) ⇒ Passport

Returns a new instance of Passport.



24
25
26
# File 'lib/yandex_client/passport.rb', line 24

def initialize(token)
  @token = token
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



14
15
16
# File 'lib/yandex_client/passport.rb', line 14

def token
  @token
end

Class Method Details

.with_token(token) ⇒ Object Also known as: []



17
18
19
# File 'lib/yandex_client/passport.rb', line 17

def with_token(token)
  new(token)
end

Instance Method Details

#infoObject



28
29
30
31
# File 'lib/yandex_client/passport.rb', line 28

def info
  process_response \
    with_config.get(ACTION_URL, headers: auth_headers)
end