Class: Kailash::Mcp::OAuth2Client

Inherits:
Object
  • Object
show all
Defined in:
lib/kailash/mcp.rb

Overview

OAuth2Client block-based lifecycle.

Kailash::Mcp::OAuth2Client.open(client_id: "...", token_endpoint: "...") do |oauth|
# ... use oauth ...
end

Class Method Summary collapse

Class Method Details

.open(**kwargs, &_block) ⇒ Object



181
182
183
184
185
186
187
188
189
190
# File 'lib/kailash/mcp.rb', line 181

def self.open(**kwargs, &_block)
  oauth = new(kwargs)
  return oauth unless block_given?

  begin
    yield oauth
  ensure
    oauth.close
  end
end