Class: RubyLLM::MCP::Auth::ResourceMetadata

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

Overview

OAuth Protected Resource Metadata (RFC 9728) Used for authorization server delegation

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource:, authorization_servers:) ⇒ ResourceMetadata

Returns a new instance of ResourceMetadata.



279
280
281
282
# File 'lib/ruby_llm/mcp/auth.rb', line 279

def initialize(resource:, authorization_servers:)
  @resource = resource
  @authorization_servers = authorization_servers
end

Instance Attribute Details

#authorization_serversObject (readonly)

Returns the value of attribute authorization_servers.



277
278
279
# File 'lib/ruby_llm/mcp/auth.rb', line 277

def authorization_servers
  @authorization_servers
end

#resourceObject (readonly)

Returns the value of attribute resource.



277
278
279
# File 'lib/ruby_llm/mcp/auth.rb', line 277

def resource
  @resource
end

Class Method Details

.from_h(data) ⇒ ResourceMetadata

Deserialize from hash

Parameters:

  • data (Hash)

    resource metadata

Returns:



296
297
298
299
300
301
# File 'lib/ruby_llm/mcp/auth.rb', line 296

def self.from_h(data)
  new(
    resource: data[:resource] || data["resource"],
    authorization_servers: data[:authorization_servers] || data["authorization_servers"]
  )
end

Instance Method Details

#to_hHash

Serialize to hash

Returns:

  • (Hash)

    resource metadata



286
287
288
289
290
291
# File 'lib/ruby_llm/mcp/auth.rb', line 286

def to_h
  {
    resource: @resource,
    authorization_servers: @authorization_servers
  }
end