Class: Yandex360::SessionsResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/yandex360/resources/sessions.rb

Overview

Session cookie lifetime for the organization, and forced sign-out.

See https://yandex.ru/dev/api360/doc/ru/ref/DomainSessionsService/

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Yandex360::Resource

Instance Method Details

#info(org_id:) ⇒ Object



8
9
10
11
# File 'lib/yandex360/resources/sessions.rb', line 8

def info(org_id:)
  validate_required_params({org_id: org_id}, [:org_id])
  DomainSession.new get("/security/v1/org/#{org_id}/domain_sessions").body
end

#logout(org_id:, user_id:) ⇒ Object

Signs the user out everywhere. The endpoint takes no body.



21
22
23
24
# File 'lib/yandex360/resources/sessions.rb', line 21

def logout(org_id:, user_id:)
  validate_required_params({org_id: org_id, user_id: user_id}, i[org_id user_id])
  Response.new put("/security/v1/org/#{org_id}/domain_sessions/users/#{user_id}/logout", body: {}).body
end

#update(org_id:, auth_ttl:) ⇒ Object

auth_ttl is in seconds. Zero means sessions never expire.



14
15
16
17
18
# File 'lib/yandex360/resources/sessions.rb', line 14

def update(org_id:, auth_ttl:)
  validate_required_params({org_id: org_id, auth_ttl: auth_ttl}, i[org_id auth_ttl])
  body = {authTTL: auth_ttl}
  DomainSession.new post("/security/v1/org/#{org_id}/domain_sessions", body: body).body
end