source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | piotrmurach/tty-table | https://github.com/piotrmurach/tty-table | lib/tty/table/operation/wrapped.rb | Ruby | mit | 204 | master | 912 | # frozen_string_literal: true
require "strings"
module TTY
class Table
module Operation
# A class responsible for wrapping text.
#
# @api private
class Wrapped
attr_reader :widths
# Initialize a Wrapped
#
# @api public
def initialize(widths)
... |
github | piotrmurach/tty-table | https://github.com/piotrmurach/tty-table | lib/tty/table/operation/escape.rb | Ruby | mit | 204 | master | 694 | # frozen_string_literal: true
module TTY
class Table
module Operation
# A class responsible for escaping special chars in a table field
#
# @api private
class Escape
# Escape special characters in a table field
#
# @param [TTY::Table::Field] field
#
... |
github | piotrmurach/tty-table | https://github.com/piotrmurach/tty-table | benchmarks/speed.rb | Ruby | mit | 204 | master | 980 | # coding: utf-8
require 'benchmark'
require 'benchmark/ips'
require_relative '../lib/tty-table'
header = [:name, :color]
rows = (1..100).map { |n| ["row#{n}", "red"] }
table = TTY::Table.new(header, rows)
# Benchmark speed of table operations
Benchmark.ips do |r|
r.report("Ruby #to_s") do
rows.to_s
end
... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | Rakefile | Ruby | mit | 205 | master | 648 | # frozen_string_literal: true
require "bundler/gem_tasks"
require "rake/testtask"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"]
t.warning = false
end
namespace :test do
desc "Run unit tests"
Rake::TestTask.new(:unit) do |t|
t.libs << "t... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | mcp-rb.gemspec | Ruby | mit | 205 | master | 1,030 | require_relative "lib/mcp/version"
Gem::Specification.new do |spec|
spec.name = "mcp-rb"
spec.version = MCP::VERSION
spec.authors = ["funwarioisii"]
spec.email = ["kazuyukihashimoto2006@gmail.com"]
spec.summary = "A lightweight Ruby framework for implementing MCP (Model Context Protocol) servers"
spec.des... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | Gemfile | Ruby | mit | 205 | master | 304 | # frozen_string_literal: true
source "https://rubygems.org"
gemspec
gem "json"
group :development, :test do
gem "rake"
gem "minitest"
gem "minitest-reporters"
# For snapshot testing of client/server interactions
gem "minitest-snapshots"
end
gem "standardrb", "~> 1.0", group: :development |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | examples/client_example.rb | Ruby | mit | 205 | master | 454 | #!/usr/bin/env ruby
# frozen_string_literal: true
require_relative "../lib/mcp"
begin
client = MCP::Client.new(
command: "ruby",
args: ["examples/hello_world.rb"]
)
client.connect
tools = client.list_tools
puts "available tools:"
puts tools.inspect
# execute greet tool
result = client.call_t... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | examples/hello_world.rb | Ruby | mit | 205 | master | 1,872 | #!/usr/bin/env ruby
# frozen_string_literal: true
require_relative "../lib/mcp"
name "hello-world"
version "1.0.0"
tool "greet" do
description "Greet someone by name"
argument :name, String, required: true, description: "Name to greet"
call do |args|
"Hello, #{args[:name]}!"
end
end
tool "nested_greet"... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | examples/cosense_example.rb | Ruby | mit | 205 | master | 3,618 | #!/usr/bin/env ruby
# frozen_string_literal: true
require "json"
require "net/http"
require_relative "../lib/mcp"
project_name = ENV["COSENSE_PROJECT_NAME"] || "funwarioisii"
cosense_sid = ENV["COSENSE_SID"]
# Cosense API Client
module CosenseClient
BASE_URL = "https://scrapbox.io/api"
TIMEOUT = 5 # seconds
d... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | test/test_helper.rb | Ruby | mit | 205 | master | 918 | # frozen_string_literal: true
require "minitest/autorun"
require "minitest/reporters"
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
require_relative "../lib/mcp"
module MCPTest
class TestCase < Minitest::Test
protected
def build_test_server
MCP::Server.new(name: "test_server")
e... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | test/snapshots_test.rb | Ruby | mit | 205 | master | 2,324 | require "io/wait"
require "minitest/snapshots"
require_relative "test_helper"
class SnapshotsTest < MCPTest::TestCase
def test_hello_world_server_interaction
with_started_server("examples/hello_world.rb") do |server_io|
client_messages = [
# Initialize request
'{"jsonrpc": "2.0", "method":... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | test/mcp/server_test.rb | Ruby | mit | 205 | master | 8,359 | # frozen_string_literal: true
require_relative "../test_helper"
module MCP
class ServerTest < MCPTest::TestCase
def test_basic_server_info
prepare_server(name: "special_test_server", version: "1.4.1")
assert_equal "special_test_server", @server.name
assert_equal "1.4.1", @server.version
e... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | test/mcp/delegator_test.rb | Ruby | mit | 205 | master | 4,066 | # frozen_string_literal: true
require_relative "../test_helper"
module MCP
class DelegatorTest < MCPTest::TestCase
def test_server_version
server = build_test_server
server.version "1.2.3"
assert_equal "1.2.3", server.version
initialize_response = initialize_server(server)
assert... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | test/mcp/client_test.rb | Ruby | mit | 205 | master | 5,239 | # frozen_string_literal: true
require_relative "../test_helper"
require "stringio"
module MCP
class ClientTest < MCPTest::TestCase
class MockServer
attr_reader :input, :output, :error
def initialize
reset_streams
end
def reset_streams
@input = StringIO.new
@outp... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | test/mcp/message_validator_test.rb | Ruby | mit | 205 | master | 1,220 | # frozen_string_literal: true
require_relative "../test_helper"
module MCP
class MessageValidatorTest < MCPTest::TestCase
def test_invalid_message
validator = MessageValidator.new
invalid_message = valid_mcp_message.except("jsonrpc")
assert_raises(MessageValidator::InvalidMessage) do
... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | test/mcp/app/resource_template_test.rb | Ruby | mit | 205 | master | 4,042 | # frozen_string_literal: true
require_relative "../../test_helper"
module MCP
class App
class ResourceTemplateTest < MCPTest::TestCase
def setup
@app = App.new
end
def test_extract_variables
@app.register_resource_template("/test/{param1}/{param2}") do
name "test_tem... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | test/mcp/app/resource_test.rb | Ruby | mit | 205 | master | 3,239 | # frozen_string_literal: true
require_relative "../../test_helper"
module MCP
class App
class ResourceTest < MCPTest::TestCase
def setup
@app = App.new
end
def test_register_and_list_resources
@app.register_resource("/test") do
name "test_resource"
descript... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | test/mcp/app/tool_test.rb | Ruby | mit | 205 | master | 11,463 | # frozen_string_literal: true
require_relative "../../test_helper"
module MCP
class App
class ToolTest < MCPTest::TestCase
def setup
@app = App.new
end
def test_tools_pagination
10.times do |i|
@app.register_tool("tool#{i}") do
description "Tool #{i}"
... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | lib/mcp.rb | Ruby | mit | 205 | master | 990 | # frozen_string_literal: true
require "English"
require "json"
require_relative "mcp/version"
require_relative "mcp/constants"
require_relative "mcp/app"
require_relative "mcp/server"
require_relative "mcp/delegator"
require_relative "mcp/client"
module MCP
class << self
attr_reader :server
def initialize... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | lib/mcp/app.rb | Ruby | mit | 205 | master | 233 | # frozen_string_literal: true
require_relative "app/resource"
require_relative "app/resource_template"
require_relative "app/tool"
module MCP
class App
include Resource
include ResourceTemplate
include Tool
end
end |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | lib/mcp/constants.rb | Ruby | mit | 205 | master | 812 | # frozen_string_literal: true
module MCP
module Constants
JSON_RPC_VERSION = "2.0"
SUPPORTED_PROTOCOL_VERSIONS = %w[2024-11-05].freeze
PROTOCOL_VERSION = SUPPORTED_PROTOCOL_VERSIONS.max
module ErrorCodes
NOT_INITIALIZED = -32_002
ALREADY_INITIALIZED = -32_002
PARSE_ERROR = -32_700... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | lib/mcp/message_validator.rb | Ruby | mit | 205 | master | 3,988 | # frozen_string_literal: true
require "json_schemer"
module MCP
class MessageValidator
SCHEMA_ROOT_PATH = File.expand_path(File.join("..", "..", "schemas"), __dir__)
# Initializes a new validator for messages according to the specified protocol version
#
# @param protocol_version [String] The versi... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | lib/mcp/client.rb | Ruby | mit | 205 | master | 2,817 | # frozen_string_literal: true
require "json"
require "open3"
require "securerandom"
require_relative "constants"
module MCP
class Client
attr_reader :command, :args, :process, :stdin, :stdout, :stderr, :wait_thread
def initialize(command:, args: [], name: "mcp-client", version: VERSION)
@command = co... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | lib/mcp/server.rb | Ruby | mit | 205 | master | 7,970 | # frozen_string_literal: true
require "json"
require "English"
require "uri"
require_relative "constants"
require_relative "message_validator"
require_relative "server/client_connection"
require_relative "server/stdio_client_connection"
module MCP
class Server
attr_writer :name, :version
def initialize(nam... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | lib/mcp/delegator.rb | Ruby | mit | 205 | master | 616 | # frozen_string_literal: true
module MCP
module Delegator
def self.delegate(*methods)
methods.each do |method_name|
define_method(method_name) do |*args, **kwargs, &block|
# name が呼ばれたら Server インスタンスを生成
# もうすこしいい感じにしたい
if method_name == :name && !MCP.server
... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | lib/mcp/server/client_connection.rb | Ruby | mit | 205 | master | 1,108 | # frozen_string_literal: true
module MCP
class Server
# @abstract
# Represents a connection to a MCP client via a particular transport.
# Each transport should implement a class implementing this interface.
#
# Connection setup and teardown should be handled outside of the server.
# Once this... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | lib/mcp/server/stdio_client_connection.rb | Ruby | mit | 205 | master | 543 | # frozen_string_literal: true
module MCP
class Server
# Implementation of the stdio transport for the MCP server.
# @see ClientConnection
class StdioClientConnection
include ClientConnection
def initialize
# Ensure output is flushed immediately
$stdout.sync = true
end
... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | lib/mcp/app/resource_template.rb | Ruby | mit | 205 | master | 4,435 | # frozen_string_literal: true
require_relative "resource"
module MCP
class App
module ResourceTemplate
def resource_templates
@resource_templates ||= {}
end
class ResourceTemplateBuilder
attr_reader :uri_template, :name, :description, :mime_type, :handler
def initiali... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | lib/mcp/app/resource.rb | Ruby | mit | 205 | master | 3,901 | # frozen_string_literal: true
module MCP
class App
module Resource
def resources
@resources ||= {}
end
class ResourceBuilder
attr_reader :uri, :name, :description, :mime_type, :handler
def initialize(uri)
raise ArgumentError, "Resource URI cannot be nil or em... |
github | funwarioisii/mcp-rb | https://github.com/funwarioisii/mcp-rb | lib/mcp/app/tool.rb | Ruby | mit | 205 | master | 6,080 | # frozen_string_literal: true
module MCP
class App
module Tool
def tools
@tools ||= {}
end
# Builds schemas for arguments, supporting simple types, nested objects, and arrays
class SchemaBuilder
def initialize
@schema = nil
@properties = {}
@... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | Gemfile | Ruby | mit | 204 | master | 409 | source 'https://rubygems.org'
# Specify your gem's dependencies in auth0.gemspec
gemspec
group :development do
gem 'terminal-notifier-guard', require: false unless ENV['CIRCLECI']
gem 'rubocop', require: false
gem 'rubocop-rails', require: false
end
group :test do
gem 'webmock', require: false
gem 'vcr', r... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | auth0.gemspec | Ruby | mit | 204 | master | 1,395 | # -*- encoding: utf-8 -*-
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
require 'auth0/version'
Gem::Specification.new do |s|
s.name = 'auth0'
s.version = Auth0::VERSION
s.authors = ['Auth0', 'Jose Romaniello', 'Ivan Petroe', 'Patrik Ragnarsson']
s.email = ['support@auth0.com']
s.... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | Guardfile | Ruby | mit | 204 | master | 1,207 | scope group: :unit_test
group :unit_test do
guard 'rspec', cmd:
"bundle exec rspec -P \"spec/lib/auth0/**/*#{ENV['PATTERN']}*_spec.rb\"--drb --format Fuubar --color" do
# run every updated spec file
watch(%r{^spec/.+_spec\.rb$})
# run the lib specs when a file in lib/ changes
watch(%r{^lib/(.+)\.... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | Rakefile | Ruby | mit | 204 | master | 707 | #!/usr/bin/env rake
require 'bundler/gem_tasks'
begin
require 'rubocop/rake_task'
require 'rspec/core/rake_task'
desc 'Run Rubocop'
RuboCop::RakeTask.new(:rubocop)
desc 'Run Integration Tests'
RSpec::Core::RakeTask.new(:integration) do |t|
t.pattern = FileList["spec/integration/**/*#{ENV['PATTERN']}... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/client_assertion.rb | Ruby | mit | 204 | master | 1,581 | # frozen_string_literal: true
require 'jwt'
module Auth0
module ClientAssertion
CLIENT_ASSERTION_TYPE = 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer'.freeze
# Adds keys into the supplied hash for either the client secret, or client assertion. If `client_assertion_signing_key` is not nil,
# i... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/exception.rb | Ruby | mit | 204 | master | 2,644 | module Auth0
# Default exception in namespace of Auth0
# if you want to catch all exceptions, then you should use this one.
# Network exceptions are not included
class Exception < StandardError
attr_reader :error_data
def initialize(message,error_data={})
super(message)
@error_data = error_d... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/mixins.rb | Ruby | mit | 204 | master | 647 | require 'base64'
require 'rest-client'
require 'uri'
require 'auth0/mixins/access_token_struct'
require 'auth0/mixins/api_token_struct'
require 'auth0/mixins/headers'
require 'auth0/mixins/httpproxy'
require 'auth0/mixins/initializer'
require 'auth0/mixins/permission_struct'
require 'auth0/mixins/validation'
require '... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/authentication_endpoints.rb | Ruby | mit | 204 | master | 20,115 | # frozen_string_literal: true
# rubocop:disable Metrics/ModuleLength
require 'jwt'
require_relative '../client_assertion'
module Auth0
module Api
# {https://auth0.com/docs/api/authentication}
# Methods to use the Authentication API
module AuthenticationEndpoints
include Auth0::ClientAssertion
... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2.rb | Ruby | mit | 204 | master | 2,133 | require 'auth0/api/v2/grants'
require 'auth0/api/v2/actions'
require 'auth0/api/v2/anomaly'
require 'auth0/api/v2/blacklists'
require 'auth0/api/v2/branding'
require 'auth0/api/v2/clients'
require 'auth0/api/v2/client_grants'
require 'auth0/api/v2/connections'
require 'auth0/api/v2/device_credentials'
require 'auth0/ap... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/rules.rb | Ruby | mit | 204 | master | 4,991 | module Auth0
module Api
module V2
# Methods to use the rules endpoints
module Rules
attr_reader :rules_path
# Retrieves a list of all rules. Accepts a list of fields to include or exclude.
# The enabled parameter can be specified to get enabled or disabled rules.
# The... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/blacklists.rb | Ruby | mit | 204 | master | 1,464 | module Auth0
module Api
module V2
# Methods to use the blacklist endpoints
module Blacklists
attr_reader :blacklists_path
# Retrieves the jti and aud of all tokens in the blacklist.
# @see https://auth0.com/docs/api/v2#!/Blacklists/get_tokens
# @param aud [string] The ... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/tickets.rb | Ruby | mit | 204 | master | 4,874 | module Auth0
module Api
module V2
# Methods to use the tickets endpoints
module Tickets
attr_reader :tickets_path
# Create an email verification ticket
# @see https://auth0.com/docs/api/v2#!/Tickets/post_email_verification
# @param user_id [string] The user_id of for w... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/organizations.rb | Ruby | mit | 204 | master | 21,836 | module Auth0
module Api
module V2
# Methods to use the organizations endpoints
module Organizations
include Auth0::Mixins::Validation
attr_reader :organizations_path
# Get all organizations.
# @see https://auth0.com/docs/api/management/v2/#!/Organizations/get_organiza... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/guardian.rb | Ruby | mit | 204 | master | 5,989 | module Auth0
module Api
module V2
# Methods to use the guardian endpoints
module Guardian
include Auth0::Mixins::Validation
# Retrieves a list of Guardian factors.
# @see https://auth0.com/docs/api/management/v2#!/Guardian/get_factors
# @return [json] Returns the list ... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/resource_servers.rb | Ruby | mit | 204 | master | 4,199 | module Auth0
module Api
module V2
# Methods to use the resource servers endpoints
module ResourceServers
attr_reader :resource_servers_path
# Retrieves a list of all resource servers.
# @see https://auth0.com/docs/api/management/v2#!/Resource_servers/get_resource_servers
... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/user_blocks.rb | Ruby | mit | 204 | master | 2,317 | module Auth0
module Api
module V2
# Methods to use the User Blocks endpoints
module UserBlocks
attr_reader :user_blocks_path
# Retrieves the user blocks
# @see https://auth0.com/docs/api/management/v2#!/User_Blocks/get_user_blocks
# @param identifier [string] Should b... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/jobs.rb | Ruby | mit | 204 | master | 6,214 | module Auth0
module Api
module V2
# Methods to use the jobs endpoints
module Jobs
# Retrieves a job. Useful to check its status.
# @see https://auth0.com/docs/api/v2#!/Jobs/get_jobs_by_job_id
# @param job_id [string] The ID of the job.
#
# @return [json] Returns... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/attack_protection.rb | Ruby | mit | 204 | master | 3,679 | module Auth0
module Api
module V2
# Methods to use the attack-protection endpoints
module AttackProtection
attr_reader :attack_protection_path
# Get breached password detection settings
# @see https://auth0.com/docs/api/management/v2#!/Attack_Protection/get_breached_password_d... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/anomaly.rb | Ruby | mit | 204 | master | 1,160 | module Auth0
module Api
module V2
# Methods to use the anomaly endpoints
module Anomaly
# Use this route to determine if a given IP is currently blocked
# by the failed login to multiple user accounts trigger.
# @see https://auth0.com/docs/api/management/v2#!/Anomaly/get_ips_by... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/prompts.rb | Ruby | mit | 204 | master | 2,651 | module Auth0
module Api
module V2
module Prompts
attr_reader :prompts_path
# Get prompts settings.
# @see https://auth0.com/docs/api/management/v2#!/Prompts/get_prompts
# @return [json] Returns the prompts setting.
def prompts
get(prompts_path)
end
... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/logs.rb | Ruby | mit | 204 | master | 2,907 | # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
module Auth0
module Api
module V2
# Methods to use the logs endpoints
module Logs
attr_reader :logs_path
# Retrieves log entries that match the specified search criteria.
# @see https://auth0.com/docs/api/v2#!/Logs/get_lo... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/tenants.rb | Ruby | mit | 204 | master | 1,403 | module Auth0
module Api
module V2
# Methods to use the Tenants endpoints
module Tenants
attr_reader :tenant_path
# Gets tenants settings.
# @see https://auth0.com/docs/api/v2#!/Tenants/get_settings
# @param fields [string] A comma separated list of fields to include or... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/stats.rb | Ruby | mit | 204 | master | 1,165 | module Auth0
module Api
module V2
# Methods to use the stats endpoints
module Stats
attr_reader :stats_path
# Gets the active users count (logged in during the last 30 days).
# @see https://auth0.com/docs/api/v2#!/Stats/get_active_users
#
# @return [integer] Re... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/device_credentials.rb | Ruby | mit | 204 | master | 4,252 | module Auth0
module Api
module V2
# Methods to use the device credentials endpoints
module DeviceCredentials
attr_reader :device_credentials_path
# Retrieves log entries that match the specified search criteria.
# @see https://auth0.com/docs/api/v2#!/device_credentials/get_dev... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/roles.rb | Ruby | mit | 204 | master | 7,302 | module Auth0
module Api
module V2
# Methods to use the Roles endpoints
module Roles
include Auth0::Mixins::Validation
# Get all Roles
# Required scope: "read:roles"
# @see https://auth0.com/docs/api/management/v2#!/Roles/get_roles
#
# @param options [ha... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/emails.rb | Ruby | mit | 204 | master | 2,063 | module Auth0
module Api
module V2
# Methods to use the connections endpoints
module Emails
attr_reader :email_path
# Get all the email providers.
# @see https://auth0.com/docs/api/v2#!/Emails/get_provider
# @param fields [string] A comma separated list of fields to inc... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/refresh_tokens.rb | Ruby | mit | 204 | master | 1,037 | # frozen_string_literal: true
module Auth0
module Api
module V2
# Methods to use the Refresh Token endpoints
module RefreshTokens
# Retrieve refresh token information.
# @see https://auth0.com/docs/api/management/v2/refresh-tokens/get-refresh-token
# @param id [string] The id ... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/grants.rb | Ruby | mit | 204 | master | 2,033 | module Auth0
module Api
module V2
module Grants
attr_reader :grants_path
# Retrieve the grants associated with your account.
# @see https://auth0.com/docs/api/management/v2#!/Grants/get_grants
# @param client_id [string] The client_id of the grants to retrieve.
# @pa... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/connections.rb | Ruby | mit | 204 | master | 5,510 | module Auth0
module Api
module V2
# Methods to use the connections endpoints
module Connections
attr_reader :connections_path
# Retrieves every connection matching the specified strategy. All connections are retrieved if no strategy is
# being specified. Accepts a list of fiel... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/clients.rb | Ruby | mit | 204 | master | 6,187 | module Auth0
module Api
module V2
# Methods to use the client endpoints
module Clients
attr_reader :clients_path
# Retrieves a list of all client applications. Accepts a list of fields to include or exclude.
# @see https://auth0.com/docs/api/management/v2#!/Clients/get_clients... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/sessions.rb | Ruby | mit | 204 | master | 1,444 | # frozen_string_literal: true
module Auth0
module Api
module V2
# Methods to use the Session endpoints
module Sessions
# Retrieve session information by id
# @see https://auth0.com/docs/api/management/v2/sessions/get-session
# @param id [string] The id of the session to retrie... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/users_by_email.rb | Ruby | mit | 204 | master | 1,345 | module Auth0
module Api
module V2
# Methods to use the Users By Email endpoints
module UsersByEmail
attr_reader :users_by_email_path
# Retrieves a list of existing users by their email.
# @see https://auth0.com/docs/api/v2#!/Users/get_users
# @see https://auth0.com/doc... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/users.rb | Ruby | mit | 204 | master | 27,654 | module Auth0
module Api
module V2
# Methods to use the users' endpoints
module Users
include Auth0::Mixins::Validation
attr_reader :users_path
# Retrieves a list of Auth0 users.
# @see https://auth0.com/docs/api/management/v2#!/Users/get_users
# @param options... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/log_streams.rb | Ruby | mit | 204 | master | 3,230 | module Auth0
module Api
module V2
# Methods to use the log streams endpoints
module LogStreams
attr_reader :log_streams_path
# Retrieves a list of all log streams.
# @see https://auth0.com/docs/api/management/v2#!/Log_Streams/get_log_streams
# @return [json] Returns th... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/branding.rb | Ruby | mit | 204 | master | 2,213 | module Auth0
module Api
module V2
# Methods to use the branding endpoints
module Branding
attr_reader :branding_path
# Retrieve branding settings.
# @see https://auth0.com/docs/api/management/v2/#!/Branding/get_branding
#
# @return [json] Returns branding setti... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/client_grants.rb | Ruby | mit | 204 | master | 4,408 | module Auth0
module Api
module V2
# Methods to use the client grants endpoints
module ClientGrants
attr_reader :client_grants_path
# Retrieves a list of all client grants.
# @see https://auth0.com/docs/api/management/v2#!/client_grants/get_client_grants
# @param client... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/api/v2/actions.rb | Ruby | mit | 204 | master | 9,811 | module Auth0
module Api
module V2
# Methods to use the actions endpoints
module Actions
include Auth0::Mixins::Validation
attr_reader :actions_path
# Get all actions.
# @see https://auth0.com/docs/api/management/v2#!/Actions/get_actions
# @param trigger_id [st... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/mixins/headers.rb | Ruby | mit | 204 | master | 752 | require 'json'
module Auth0
module Mixins
# Module to provide necessary headers for API requests.
module Headers
def telemetry
telemetry_hash = {
name: 'ruby-auth0',
version: Auth0::VERSION,
env: {
ruby: RUBY_VERSION
}
}
if Ge... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/mixins/access_token_struct.rb | Ruby | mit | 204 | master | 319 | Auth0::AccessToken = Struct.new(
:access_token,
:expires_in,
:refresh_token,
:id_token
) do
def self.from_response(response)
new(
response['access_token'],
response['expires_in'],
response['refresh_token'],
response['id_token']
)
end
def token
access_token
end
end |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/mixins/initializer.rb | Ruby | mit | 204 | master | 2,516 | require 'json'
module Auth0
module Mixins
# Help class where Auth0::Client initialization described
module Initializer
# Default initialization mechanism, moved here to keep Auth0::Client clear
# accepts hash as parameter
# you can get all required fields from here: https://auth0.com/docs/... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/mixins/httpproxy.rb | Ruby | mit | 204 | master | 5,668 | # frozen_string_literal: true
require 'addressable/uri'
require 'retryable'
require_relative '../exception'
module Auth0
module Mixins
# here's the proxy for Rest calls based on rest-client, we're building all request on that gem
# for now, if you want to feel free to use your own http client
module HTT... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/mixins/token_management.rb | Ruby | mit | 204 | master | 1,002 | module Auth0
module Mixins
module TokenManagement
private
def initialize_token(options)
@token = options[:access_token] || options[:token]
# default expiry to an hour if a token was given but no expires_at
@token_expires_at = @token ? options[:token_expires_at] || Time.... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | lib/auth0/mixins/validation.rb | Ruby | mit | 204 | master | 14,447 | require 'zache'
class Zache
def last(key)
@hash[key][:value] if @hash.key?(key)
end
end
module Auth0
module Mixins
# Module to provide validation for specific data structures.
module Validation
# Check a roles array
def validate_strings_array(strings)
raise Auth0::InvalidParamet... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/spec_helper.rb | Ruby | mit | 204 | master | 1,872 | require 'faker'
require 'json'
require 'auth0'
if RUBY_VERSION >= '2.7.2'
# NOTE: https://bugs.ruby-lang.org/issues/17000
Warning[:deprecated] = true
end
require 'simplecov'
SimpleCov.start
if ENV['CI'] == 'true'
require 'simplecov-cobertura'
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
end... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/client_spec.rb | Ruby | mit | 204 | master | 6,068 | require 'spec_helper'
describe Auth0::Client do
shared_examples_for 'v2 API client' do
it { should be_a Auth0::Api::V2 }
it { should be_a Auth0::Api::V2::Blacklists }
it { should be_a Auth0::Api::V2::Clients }
it { should be_a Auth0::Api::V2::ClientGrants }
it { should be_a Auth0::Api::V2::Connec... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/mixins/validation_spec.rb | Ruby | mit | 204 | master | 31,597 | # rubocop:disable Metrics/BlockLength
require 'spec_helper'
require 'jwt'
RSA_PUB_KEY_JWK_1 = { 'kty': "RSA", 'use': 'sig', 'n': "uGbXWiK3dQTyCbX5xdE4yCuYp0AF2d15Qq1JSXT_lx8CEcXb9RbDddl8jGDv-spi5qPa8qEHiK7FwV2KpRE983wGPnYsAm9BxLFb4YrLYcDFOIGULuk2FtrPS512Qea1bXASuvYXEpQNpGbnTGVsWXI9C-yjHztqyL2h8P6mlThPY9E9ue2fCqdgixfTF... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/mixins/token_management_spec.rb | Ruby | mit | 204 | master | 3,963 | require 'spec_helper'
require 'timecop'
describe Auth0::Mixins::TokenManagement do
let(:client_id) { 'test-client-id' }
let(:client_secret) { 'test-client-secret' }
let(:api_identifier) { 'test-audience' }
let(:domain) { 'samples.auth0.com' }
let(:payload) { {
grant_type: 'client_credentials',
clien... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/mixins/httpproxy_spec.rb | Ruby | mit | 204 | master | 30,817 | require 'json'
require 'spec_helper'
describe Auth0::Mixins::HTTPProxy do
before :each do
dummy_instance = DummyClassForProxy.new
dummy_instance.extend(Auth0::Mixins::HTTPProxy)
dummy_instance.base_uri = "https://auth0.com"
dummy_instance.retry_count = 0
@instance = dummy_instance
@exception... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/mixins/initializer_spec.rb | Ruby | mit | 204 | master | 5,477 | require 'spec_helper'
require 'timecop'
class MockClass
attr_reader :token
include Auth0::Mixins::Initializer
include Auth0::Mixins::HTTPProxy
include Auth0::Mixins::Headers
include Auth0::Mixins::TokenManagement
end
describe Auth0::Mixins::Initializer do
let(:params) { { namespace: 'samples.auth0.com' } ... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/authentication_endpoints_spec.rb | Ruby | mit | 204 | master | 26,101 | require 'spec_helper'
require 'timecop'
describe Auth0::Api::AuthenticationEndpoints do
let(:client_id) { 'test-client-id' }
let(:client_secret) { 'test-client-secret' }
let(:api_identifier) { 'test-audience' }
let(:domain) { 'samples.auth0.com' }
let(:request_uri) { 'urn:ietf:params:oauth:request_uri:the.re... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/v2/tickets_spec.rb | Ruby | mit | 204 | master | 5,294 | require 'spec_helper'
describe Auth0::Api::V2::Tickets do
before :all do
@instance = DummyClass.new.extend(Auth0::Api::V2::Tickets)
end
context '.post_email_verification' do
it { expect(@instance).to respond_to(:post_email_verification) }
it 'expect client to send post to /api/v2/tickets/email-verifi... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/v2/guardian_spec.rb | Ruby | mit | 204 | master | 5,936 | require 'spec_helper'
describe Auth0::Api::V2::Guardian do
before :all do
dummy_instance = DummyClass.new
dummy_instance.extend(Auth0::Api::V2::Guardian)
@instance = dummy_instance
end
context '.guardian_factors' do
it 'is expected to respond to a guardian_factors method' do
expect(@instanc... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/v2/organizations_spec.rb | Ruby | mit | 204 | master | 26,048 | require 'spec_helper'
describe Auth0::Api::V2::Organizations do
before :all do
dummy_instance = DummyClass.new
dummy_instance.extend(Auth0::Api::V2::Organizations)
@instance = dummy_instance
end
context '.organizations' do
it 'is expected to respond to a organizations method' do
expect(@ins... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/v2/user_blocks_spec.rb | Ruby | mit | 204 | master | 2,291 | require 'spec_helper'
describe Auth0::Api::V2::UserBlocks do
before :all do
dummy_instance = DummyClass.new
dummy_instance.extend(Auth0::Api::V2::UserBlocks)
@instance = dummy_instance
end
context '.user_blocks' do
it { expect(@instance).to respond_to(:user_blocks) }
it 'is expected to call /... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/v2/users_spec.rb | Ruby | mit | 204 | master | 30,100 | require 'spec_helper'
describe Auth0::Api::V2::Users do
before :all do
dummy_instance = DummyClass.new
dummy_instance.extend(Auth0::Api::V2::Users)
@instance = dummy_instance
end
context '.users' do
it 'is expected to respond to a users method' do
expect(@instance).to respond_to(:users)
... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/v2/log_streams_spec.rb | Ruby | mit | 204 | master | 3,442 | require 'spec_helper'
describe Auth0::Api::V2::LogStreams do
before :all do
dummy_instance = DummyClass.new
dummy_instance.extend(Auth0::Api::V2::LogStreams)
dummy_instance.extend(Auth0::Mixins::Initializer)
@instance = dummy_instance
end
context '.log_streams' do
it { expect(@instance).to re... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/v2/emails_spec.rb | Ruby | mit | 204 | master | 2,235 | require 'spec_helper'
describe Auth0::Api::V2::Emails do
before :all do
dummy_instance = DummyClass.new
dummy_instance.extend(Auth0::Api::V2::Emails)
@instance = dummy_instance
end
context '.get_email' do
it { expect(@instance).to respond_to(:get_provider) }
it 'expect client to send get to /... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/v2/stats_spec.rb | Ruby | mit | 204 | master | 852 | require 'spec_helper'
describe Auth0::Api::V2::Stats do
before :all do
dummy_instance = DummyClass.new
dummy_instance.extend(Auth0::Api::V2::Stats)
@instance = dummy_instance
end
context '.active_users' do
it { expect(@instance).to respond_to(:active_users) }
it 'expect client to send get to /... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/v2/blacklists_spec.rb | Ruby | mit | 204 | master | 985 | require 'spec_helper'
describe Auth0::Api::V2::Blacklists do
before :all do
dummy_instance = DummyClass.new
dummy_instance.extend(Auth0::Api::V2::Blacklists)
@instance = dummy_instance
end
context '.blacklisted_tokens' do
it { expect(@instance).to respond_to(:blacklisted_tokens) }
it 'is expe... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/v2/refresh_tokens_spec.rb | Ruby | mit | 204 | master | 1,454 | # frozen_string_literal: true
require 'spec_helper'
describe Auth0::Api::V2::RefreshTokens do
before :all do
dummy_instance = DummyClass.new
dummy_instance.extend(Auth0::Api::V2::RefreshTokens)
@instance = dummy_instance
end
describe '.refresh_token' do
it 'is expected to respond to a refresh_t... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/v2/anomaly_spec.rb | Ruby | mit | 204 | master | 1,109 | require 'spec_helper'
describe Auth0::Api::V2::Anomaly do
before :all do
dummy_instance = DummyClass.new
dummy_instance.extend(Auth0::Api::V2::Anomaly)
@instance = dummy_instance
end
context '.check_if_ip_is_blocked' do
it { expect(@instance).to respond_to(:check_if_ip_is_blocked) }
it 'expec... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/v2/clients_spec.rb | Ruby | mit | 204 | master | 6,251 | require 'spec_helper'
describe Auth0::Api::V2::Clients do
before :all do
dummy_instance = DummyClass.new
dummy_instance.extend(Auth0::Api::V2::Clients)
@instance = dummy_instance
end
context '.clients' do
it { expect(@instance).to respond_to(:clients) }
it { expect(@instance).to respond_to(:g... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/v2/actions_spec.rb | Ruby | mit | 204 | master | 10,291 | require 'spec_helper'
describe Auth0::Api::V2::Actions do
before :all do
dummy_instance = DummyClass.new
dummy_instance.extend(Auth0::Api::V2::Actions)
@instance = dummy_instance
end
context '.actions' do
it 'is expected to respond to a actions method' do
expect(@instance).to respond_to(:ac... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/v2/rules_spec.rb | Ruby | mit | 204 | master | 3,382 | require 'spec_helper'
describe Auth0::Api::V2::Rules do
before :all do
dummy_instance = DummyClass.new
dummy_instance.extend(Auth0::Api::V2::Rules)
dummy_instance.extend(Auth0::Mixins::Initializer)
@instance = dummy_instance
end
context '.rules' do
it { expect(@instance).to respond_to(:rules)... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/v2/branding_spec.rb | Ruby | mit | 204 | master | 2,647 | require 'spec_helper'
describe Auth0::Api::V2::Branding do
before :all do
dummy_instance = DummyClass.new
dummy_instance.extend(Auth0::Api::V2::Branding)
dummy_instance.extend(Auth0::Mixins::Initializer)
@instance = dummy_instance
end
context '.branding' do
it { expect(@instance).to respond_t... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/v2/roles_spec.rb | Ruby | mit | 204 | master | 11,215 | require 'spec_helper'
describe Auth0::Api::V2::Roles do
before :all do
dummy_instance = DummyClass.new
dummy_instance.extend(Auth0::Api::V2::Roles)
@instance = dummy_instance
end
context '.get_roles' do
it 'is expected to exist' do
expect(@instance).to respond_to(:get_roles)
end
it... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/v2/resource_servers_spec.rb | Ruby | mit | 204 | master | 3,820 | require 'spec_helper'
describe Auth0::Api::V2::ResourceServers do
before :all do
dummy_instance = DummyClass.new
dummy_instance.extend(Auth0::Api::V2::ResourceServers)
dummy_instance.extend(Auth0::Mixins::Initializer)
@instance = dummy_instance
end
context '.resource_servers' do
it { expect(@... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/v2/logs_spec.rb | Ruby | mit | 204 | master | 1,597 | require 'spec_helper'
describe Auth0::Api::V2::Logs do
before :all do
dummy_instance = DummyClass.new
dummy_instance.extend(Auth0::Api::V2::Logs)
@instance = dummy_instance
end
context '.logs' do
it { expect(@instance).to respond_to(:logs) }
it { expect(@instance).to respond_to(:get_logs) }
... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/v2/grants_spec.rb | Ruby | mit | 204 | master | 2,916 | require 'spec_helper'
describe Auth0::Api::V2::Grants do
before :all do
dummy_instance = DummyClass.new
dummy_instance.extend(Auth0::Api::V2::Grants)
@instance = dummy_instance
end
context '.grants' do
it { expect(@instance).to respond_to(:grants) }
it { expect(@instance).to respond_to(:get_a... |
github | auth0/ruby-auth0 | https://github.com/auth0/ruby-auth0 | spec/lib/auth0/api/v2/sessions_spec.rb | Ruby | mit | 204 | master | 1,976 | # frozen_string_literal: true
require 'spec_helper'
describe Auth0::Api::V2::Sessions do
before :all do
dummy_instance = DummyClass.new
dummy_instance.extend(Auth0::Api::V2::Sessions)
@instance = dummy_instance
end
context '.session' do
it 'is expected to respond to a session method' do
e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.