Class: Pago::V2026_04::Services::Oauth2

Inherits:
Service
  • Object
show all
Defined in:
lib/pago/v2026_04/services/oauth2.rb,
sig/pago/v2026_04/generated.rbs

Defined Under Namespace

Classes: Clients

Instance Attribute Summary

Attributes inherited from Service

#client

Instance Method Summary collapse

Methods inherited from Service

#initialize

Constructor Details

This class inherits a constructor from Pago::Service

Instance Method Details

#authorizeModels::AuthorizeResponseUser, Models::AuthorizeResponseOrganization

Returns:

Raises:



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/pago/v2026_04/services/oauth2.rb', line 12

def authorize()
  data = client.request(
    http_method: "GET",
    path: "/v1/oauth2/authorize",
    path_params: {},
    query: {},
    response_type: :json,
    errors: {  }
  )
  ::Pago::Serde.union(data, discriminator: "sub_type", mapping: { "organization" => Models::AuthorizeResponseOrganization, "user" => Models::AuthorizeResponseUser }, variants: [Models::AuthorizeResponseUser, Models::AuthorizeResponseOrganization])
end

#clientsClients

Returns:



8
# File 'lib/pago/v2026_04/services/oauth2.rb', line 8

def clients = @clients ||= Clients.new(client)

#introspect_tokenModels::IntrospectTokenResponse

Get information about an access token.

Returns:

Raises:



60
61
62
63
64
65
66
67
68
69
70
# File 'lib/pago/v2026_04/services/oauth2.rb', line 60

def introspect_token()
  data = client.request(
    http_method: "POST",
    path: "/v1/oauth2/introspect",
    path_params: {},
    query: {},
    response_type: :json,
    errors: {  }
  )
  Models::IntrospectTokenResponse.from_json(data)
end

#request_tokenModels::TokenResponse

Request an access token using a valid grant.

Returns:

Raises:



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/pago/v2026_04/services/oauth2.rb', line 28

def request_token()
  data = client.request(
    http_method: "POST",
    path: "/v1/oauth2/token",
    path_params: {},
    query: {},
    response_type: :json,
    errors: {  }
  )
  Models::TokenResponse.from_json(data)
end

#revoke_tokenModels::RevokeTokenResponse

Revoke an access token or a refresh token.

Returns:

Raises:



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/pago/v2026_04/services/oauth2.rb', line 44

def revoke_token()
  data = client.request(
    http_method: "POST",
    path: "/v1/oauth2/revoke",
    path_params: {},
    query: {},
    response_type: :json,
    errors: {  }
  )
  Models::RevokeTokenResponse.from_json(data)
end

#userinfoModels::UserInfoUser, Models::UserInfoOrganization

Get information about the authenticated user.

Returns:

Raises:



76
77
78
79
80
81
82
83
84
85
86
# File 'lib/pago/v2026_04/services/oauth2.rb', line 76

def userinfo()
  data = client.request(
    http_method: "GET",
    path: "/v1/oauth2/userinfo",
    path_params: {},
    query: {},
    response_type: :json,
    errors: {  }
  )
  ::Pago::Serde.union(data, variants: [Models::UserInfoUser, Models::UserInfoOrganization])
end