
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
JRPC Request, JRPC Notification, JRPC Response, JRPC Error Response, JRPC Object Builder and JRPC Error Codes in Object Oriented Way.
gem 'jsonrpc_interface'
bundle install
# --- or ---
gem install jsonrpc_interface
require 'jsonrpc_interface'
JSONRPC::ERRORS
# =>
{
parse_error: { code: -32_700, message: 'Parse Error' },
invalid_request: { code: -32_600, message: 'Invalid Request' },
method_not_found: { code: -32_601, message: 'Method Not Found' },
invalid_params: { code: -32_602, message: 'Invalid Params' },
internal_error: { code: -32_603, message: 'Internal Error' },
unauthorized: { code: -33_001, message: 'Unauthorized' },
application_error: { code: -33_002, message: 'Application Error' },
jsonrpc_specification_violation: { code: -33_003, message: 'JSONRPC Specification Violation' }
}
JSONRPC::Request
JSONRPC::Request.new(jsonrpc: '2.0', method: 'some.method', params: { some: 'params' }, id: 'sOmEiD')
JSONRPC::Request#jsonrpc (String)
JSONRPC::Request#method (String)
JSONRPC::Request#params (Hash)
JSONRPC::Request#id (String)
schema do
required(:jsonrpc).type(:string).filled
required(:method).type(:string).filled
required(:params).type(:hash).filled
required(:id).type(:string).filled
end
JSONRPC::Notification
JSONRPC::Notification.new(jsonrpc: '2.0', method: 'some.method', params: { some: 'params' })
JSONRPC::Notification#jsonrpc (String)
JSONRPC::Notification#method (String)
JSONRPC::Notification#params (Hash)
schema do
required(:jsonrpc).type(:string).filled
required(:method).type(:string).filled
required(:params).type(:hash).filled
end
JSONRPC::Response
JSONRPC::Response.new(jsonrpc: '2.0', result: { some: 'result' }, id: 'sOmEiD')
JSONRPC::Response#jsonrpc (String)
JSONRPC::Response#result (Hash)
JSONRPC::Response#id (String)
JSONRPC::ErrorResponse
JSONRPC::ErrorResponse.new(jsonrpc: '2.0', method: 'some.method', params: { some: 'params' }, id: nil)
JSONRPC::ErrorResponse.new(jsonrpc: '2.0', method: 'some.method', params: { some: 'params' }, id: 'sOmEiD')
JSONRPC::ErrorResponse#jsonrpc (String)
JSONRPC::ErrorResponse#error (Hash)
JSONRPC::ErrorResponse#id (String, NilClass)
JSONRPC::ErrorResponse#error
# signature =>
{ code: Integer, message: String, data: Hash }
schema do
required(:code).type(:integer).filled
required(:message).type(:string).filled
required(:data).type(:hash).filled
end
JSONRPC::RPCObject.response(
{ some: 'data' },
request_id: SecureRandom.uuid
) # => JSONRPC::Response
JSONRPC::RPCObject.request(
method: 'some.method',
params: { some: 'params' },
request_id: SecureRandom.uuid
) # => JSONRPC::Request
JSONRPC::RPCObject.notification(
method: 'some.method',
params: { some: 'params' }
) # => JSONRPC::Notification
JSONRPC::RPCObject.invalid_request_error({ some: 'data' })
JSONRPC::RPCObject.invalid_request_error({ some: 'data' }, request_id: SecureRandom.uuid)
JSONRPC::ErrorResponse#error
# error hash signature =>
{ code: -32_600, message: 'Invalid Request', data: { some: 'data' } }
JSONRPC::RPCObject.parse_error
JSONRPC::ErrorResponse#error
# error hash signature =>
{ code: -32_700, message: 'Parse Error', data: {} }
JSONRPC::RPCObject.jsonrpc_specification_violation_error
JSONRPC::RPCObject.jsonrpc_specification_violation_error(request_id: SecureRandom.uuid)
JSONRPC::ErrorResponse#error
# error hash signature =>
{ code: -33_003, message: 'JSONRPC Specification Violation', data: {} }
JSONRPC::RPCObject.method_not_found_error
JSONRPC::RPCObject.method_not_found_error(request_id: SecureRandom.uuid)
JSONRPC::ErrorResponse#error
# error hash signature =>
{ code: -32_601, message: 'Method Not Found', data: {} }
JSONRPC::RPCObject.invalid_params_error
JSONRPC::RPCObject.invalid_params_error(request_id: SecureRandom.uuid)
JSONRPC::ErrorResponse#error
# error hash signature =>
{ code: -32_602, message: 'Invalid Params', data: {} }
JSONRPC::RPCObject.internal_error('some', 'error', 'code', error_context: { some: 'context' })
JSONRPC::RPCObject.internal_error('some', 'error', 'code', error_context: { some: 'context' }, request_id: SecureRandom.uuid)
JSONRPC::RPCObject.internal_error
JSONRPC::RPCObject.internal_error(request_id: SecureRandom.uuid)
JSONRPC::ErrorResponse#error
# error hash signature =>
{
code: -32_603,
message: 'Internal Error',
data: {
error_codes: ['some', 'error', 'code'],
error_cotnext: { some: 'context' }
}
}
JSONRPC::RPCObject.detailed_internal_error(exception)
JSONRPC::RPCObject.detailed_internal_error(exception, request_id: SecureRandom.uuid)
JSONRPC::ErrorResponse#error
# signature =>
{
code: -32_603,
message: 'Internal Error',
data: {
error_codes: [],
error_cotnext: {
error_class: # => exception.class,
error_message: # => exception.message,
error_backtrace: # => exception.backtrace,
error_object: # => exception
}
}
}
steep
=> rubocop
=> rspec
)bundle exec rake
rubocop
):bundle exec rake rubocop
steep
):bundle exec rake steep
rspec
):bundle exec rake rspec
Released under MIT License.
FAQs
Unknown package
We found that jsonrpc_interface demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.