Class: RosettAi::Mcp::HttpSecurityConfig::RateLimitConfig

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

Overview

Rate limiting sub-configuration.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRateLimitConfig

Returns a new instance of RateLimitConfig.



133
134
135
136
137
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 133

def initialize
  @enabled = true
  @unauthenticated_rpm = 60
  @authenticated_rpm = 300
end

Instance Attribute Details

#authenticated_rpmObject

Returns the value of attribute authenticated_rpm.



131
132
133
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 131

def authenticated_rpm
  @authenticated_rpm
end

#enabledObject

Returns the value of attribute enabled.



131
132
133
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 131

def enabled
  @enabled
end

#unauthenticated_rpmObject

Returns the value of attribute unauthenticated_rpm.



131
132
133
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 131

def unauthenticated_rpm
  @unauthenticated_rpm
end

Instance Method Details

#apply(hash) ⇒ void

This method returns an undefined value.

Apply rate limit configuration from a hash.

Parameters:

  • hash (Hash)

    configuration values



143
144
145
146
147
148
149
# File 'lib/rosett_ai/mcp/http_security_config.rb', line 143

def apply(hash)
  return unless hash.is_a?(Hash)

  @enabled = hash['enabled'] if hash.key?('enabled')
  @unauthenticated_rpm = hash['unauthenticated_rpm'] if hash['unauthenticated_rpm']
  @authenticated_rpm = hash['authenticated_rpm'] if hash['authenticated_rpm']
end