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 | flyerhzm/resque-restriction | https://github.com/flyerhzm/resque-restriction | lib/resque/restriction/config.rb | Ruby | mit | 86 | master | 1,081 | module Resque
module Restriction
def self.configure
yield config
end
def self.config
@config ||= Config.new
end
class Config
def initialize
@max_queue_peek = nil
end
def max_queue_peek=(value_or_callable)
if value_or_callable.respond_to?(:call)
... |
github | adamlogic/showoff | https://github.com/adamlogic/showoff | Rakefile | Ruby | mit | 86 | master | 560 | require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the showoff plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documentation for the sho... |
github | adamlogic/showoff | https://github.com/adamlogic/showoff | lib/generators/showoff/install/install_generator.rb | Ruby | mit | 86 | master | 813 | module Showoff
module Generators
class InstallGenerator < Rails::Generators::Base
source_root File.expand_path(File.dirname(__FILE__) + '/templates')
def install_showoff
empty_directory 'app/views/mockups/basic'
copy_file 'sample_mockup.html.erb', 'app/views/mockups/sample_mockup.ht... |
github | adamlogic/showoff | https://github.com/adamlogic/showoff | app/controllers/mockups_controller.rb | Ruby | mit | 86 | master | 1,191 | class MockupsController < ApplicationController
unloadable
LAYOUTS = Dir.glob(File.join(Rails.root, 'app', 'views', 'layouts', '*.html.*')).map do |file|
File.basename(file).split('.').first
end
def frameset
render :layout => false
end
def index
@entries = []
@directories = ActiveSuppor... |
github | adamlogic/showoff | https://github.com/adamlogic/showoff | app/helpers/mockups_helper.rb | Ruby | mit | 86 | master | 255 | module MockupsHelper
def mockup_path_from_session
if session[:parent_dir]
mockup_path(session[:template_name], :parent_dir => session[:parent_dir])
elsif session[:template_name]
mockup_path(session[:template_name])
end
end
end |
github | pocke/gry | https://github.com/pocke/gry | gry.gemspec | Ruby | apache-2.0 | 86 | master | 1,672 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'gry/version'
Gem::Specification.new do |spec|
spec.name = "gry"
spec.version = Gry::VERSION
spec.authors = ["Masataka Kuwabara"]
spec.email = ["p.ck.t22@gmail... |
github | pocke/gry | https://github.com/pocke/gry | Guardfile | Ruby | apache-2.0 | 86 | master | 1,942 | # A sample Guardfile
# More info at https://github.com/guard/guard#readme
## Uncomment and set this to only include directories you want to watch
# directories %w(app lib config test spec features) \
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
## Note: if you are using the `direct... |
github | pocke/gry | https://github.com/pocke/gry | spec/spec_helper.rb | Ruby | apache-2.0 | 86 | master | 5,356 | require 'rspec-power_assert'
if ENV['CI']
require 'simplecov'
require 'coveralls'
Coveralls.wear!
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
SimpleCov.add_filter '/spec/'
SimpleCov.start
end
require 'gry'
# This file was generated by the `rspec --init` command. Conventionally, all
# specs l... |
github | pocke/gry | https://github.com/pocke/gry | spec/gry/cli_spec.rb | Ruby | apache-2.0 | 86 | master | 1,193 | require 'stringio'
describe Gry::CLI do
describe '#run' do
include_context :chdir
let(:cli){Gry::CLI.new(args)}
let(:out){StringIO.new}
subject(:run){cli.run(out)}
shared_examples 'writes yaml' do
it 'write a yaml' do
run
result = out.string
is_asserted_by{ !result... |
github | pocke/gry | https://github.com/pocke/gry | spec/gry/congress_spec.rb | Ruby | apache-2.0 | 86 | master | 3,719 | describe Gry::Congress do
describe '#discuss' do
subject(:discuss) do
Gry::Congress.new(
max_count: max_count,
min_difference: min_difference,
metrics_percentile: metrics_percentile,
).discuss(name, bill)
end
let(:max_count){10}
let(:min_difference){10}
let(:met... |
github | pocke/gry | https://github.com/pocke/gry | spec/gry/formatter_spec.rb | Ruby | apache-2.0 | 86 | master | 5,979 | describe Gry::Formatter do
let(:fmt){Gry::Formatter.new(display_disabled_cops: display_disabled_cops)}
let(:display_disabled_cops){false}
describe '.format' do
def offenses(count)
[{'message' => 'hoge'}] * count
end
context 'simple' do
it 'retrns a YAML' do
bill = {
{
... |
github | pocke/gry | https://github.com/pocke/gry | spec/gry/rubocop_adapter_spec.rb | Ruby | apache-2.0 | 86 | master | 3,808 | describe Gry::RubocopAdapter do
describe '.default_config' do
it 'returns a RuboCop::Config' do
expect(Gry::RubocopAdapter.default_config).to be_a RuboCop::Config
end
end
describe '.configurable_cops' do
it 'returns a Array of String' do
cops = Gry::RubocopAdapter.configurable_cops
... |
github | pocke/gry | https://github.com/pocke/gry | spec/gry/pilot_study_spec.rb | Ruby | apache-2.0 | 86 | master | 11,690 | describe Gry::PilotStudy do
describe '#analyze' do
break if ENV['DONT_RUN_SLOW_SPEC']
include_context :chdir
shared_examples 'returns_a_valid_rubocop_yml' do
it 'returns a valid .rubocop.yml' do
result = analyze
expect(result).to be_a Hash
result.keys.each do |key|
... |
github | pocke/gry | https://github.com/pocke/gry | spec/gry/rubocop_runner_spec.rb | Ruby | apache-2.0 | 86 | master | 1,435 | describe Gry::RubocopRunner do
describe '.new' do
it 'sets @setting' do
setting_arg = {
'Style/AndOr' => {
'EnforcedStyle' => 'always',
'Enabled' => true,
}
}
runner = Gry::RubocopRunner.new(['Style/AndOr'], setting_arg)
setting = runner.instance_variab... |
github | pocke/gry | https://github.com/pocke/gry | lib/gry.rb | Ruby | apache-2.0 | 86 | master | 746 | require 'fileutils'
require 'tempfile'
require 'yaml'
require 'json'
require 'optparse'
require 'open3'
require 'pathname'
require 'digest/sha1'
require 'rubocop'
require 'parallel'
require "gry/version"
require 'gry/rubocop_runner'
require 'gry/congress'
require 'gry/law'
require 'gry/pilot_study'
require "gry/optio... |
github | pocke/gry | https://github.com/pocke/gry | lib/gry/rubocop_adapter.rb | Ruby | apache-2.0 | 86 | master | 2,250 | module Gry
module RubocopAdapter
module_function
def default_config
RuboCop::ConfigLoader.default_configuration
end
def configurable_cops
conf = RuboCop::ConfigLoader.default_configuration.to_h
conf
.select{|key, cop_conf| !enforced_styles(cop_conf).empty? || metrics_cop?(k... |
github | pocke/gry | https://github.com/pocke/gry | lib/gry/congress.rb | Ruby | apache-2.0 | 86 | master | 1,909 | module Gry
class Congress
def initialize(max_count:, min_difference:, metrics_percentile:)
@max_count = max_count
@min_difference = min_difference
@metrics_percentile = metrics_percentile
end
# @param name [String] cop name
# @param bill [Hash{Hash => Array}] rubocop results
# ... |
github | pocke/gry | https://github.com/pocke/gry | lib/gry/cli.rb | Ruby | apache-2.0 | 86 | master | 1,963 | module Gry
class CLI
CACHE_DIR = Pathname(ENV['XDG_CACHE_HOME'] || '~/.cache').expand_path / 'gry'
def initialize(argv)
@argv = argv
end
def run(writer)
opt = Option.new(@argv)
if opt.version
rubocop_version, = *Open3.capture3('rubocop', '--verbose-version')
writer.... |
github | pocke/gry | https://github.com/pocke/gry | lib/gry/pilot_study.rb | Ruby | apache-2.0 | 86 | master | 3,291 | module Gry
class PilotStudy
# @param cops [Array<String>] cop names. e.g.) ['Style/EmptyElse']
def initialize(cops, process:)
@cops = cops
@process = process == 1 ? 0 : process
end
def analyze
configs = @cops.map{|cop_name| cop_configs(cop_name)}
max = configs.max_by(&:size).s... |
github | pocke/gry | https://github.com/pocke/gry | lib/gry/formatter.rb | Ruby | apache-2.0 | 86 | master | 1,266 | module Gry
class Formatter
def initialize(display_disabled_cops:)
@display_disabled_cops = display_disabled_cops
end
# @param gry_result [Array<Law>]
# @return [String] a yaml string
def format(laws)
confs = laws.map do |law|
if law.letter
letter = {law.name => law.l... |
github | pocke/gry | https://github.com/pocke/gry | lib/gry/rubocop_runner.rb | Ruby | apache-2.0 | 86 | master | 1,477 | module Gry
# Run RuboCop with specific cops and config
class RubocopRunner
# @param cops [Array<String>] cop names. e.g.) ['Style/EmptyElse']
# @param setting [Hash] e.g.) {'Style/EmptyElse' => {'EnforcedStyle' => 'both'}}
def initialize(cops, setting)
@cops = cops
setting_base = RubocopAdap... |
github | pocke/gry | https://github.com/pocke/gry | lib/gry/option.rb | Ruby | apache-2.0 | 86 | master | 1,449 | module Gry
class Option
attr_reader :args, :process, :version, :fast, :max_count, :min_difference, :display_disabled_cops, :metrics_percentile, :cache, :raw
def initialize(argv)
opt = OptionParser.new
@version = false
@process = Parallel.processor_count
@fast = true
@max_count =... |
github | pond/scimitar | https://github.com/pond/scimitar | scimitar.gemspec | Ruby | mit | 86 | main | 2,011 | $:.push File.expand_path('../lib', __FILE__)
require 'scimitar/version'
Gem::Specification.new do |s|
s.name = 'scimitar'
s.version = Scimitar::VERSION
s.date = Scimitar::DATE
s.summary = 'SCIM v2 for Rails'
s.description = 'SCIM v2 support for Users and Groups in Ruby On Rails'
s.aut... |
github | pond/scimitar | https://github.com/pond/scimitar | Rakefile | Ruby | mit | 86 | main | 328 | require 'rake'
require 'rspec/core/rake_task'
require 'rdoc/task'
RSpec::Core::RakeTask.new(:default) do | t |
end
Rake::RDocTask.new do | rd |
rd.rdoc_files.include('README.md', 'lib/**/*.rb', 'app/**/*.rb')
rd.title = 'Scimitar'
rd.main = 'README.md'
rd.rdoc_dir = 'docs/rdoc'
rd.generator = 'rd... |
github | pond/scimitar | https://github.com/pond/scimitar | app/controllers/scimitar/active_record_backed_resources_controller.rb | Ruby | mit | 86 | main | 9,276 | module Scimitar
# An ActiveRecord-centric subclass of Scimitar::ResourcesController. See that
# class's documentation first, as it describes things that your subclass must
# do which apply equally to subclasses of this ActiveRecord-focused code.
#
# In addition to requirements mentioned above, your subclass ... |
github | pond/scimitar | https://github.com/pond/scimitar | app/controllers/scimitar/resource_types_controller.rb | Ruby | mit | 86 | main | 918 | module Scimitar
class ResourceTypesController < ApplicationController
def index
resource_types = Scimitar::Engine.resources.map do |resource|
resource.resource_type(scim_resource_type_url(name: resource.resource_type_id))
end
render json: {
schemas: [
'urn:ietf:param... |
github | pond/scimitar | https://github.com/pond/scimitar | app/controllers/scimitar/application_controller.rb | Ruby | mit | 86 | main | 7,454 | module Scimitar
class ApplicationController < ActionController::Base
rescue_from StandardError, with: :handle_unexpected_error
rescue_from ActionDispatch::Http::Parameters::ParseError, with: :handle_bad_json_error # Via "ActionDispatch::Request.parameter_parsers" block in lib/s... |
github | pond/scimitar | https://github.com/pond/scimitar | app/controllers/scimitar/resources_controller.rb | Ruby | mit | 86 | main | 7,336 | module Scimitar
# A Rails controller which is mostly idiomatic, with #index, #show, #create
# and #destroy methods mapping to the conventional HTTP methods in Rails.
# The #update method is used for partial-update PATCH calls, while the
# #replace method is used for whole-update PUT calls.
#
# Subclass thi... |
github | pond/scimitar | https://github.com/pond/scimitar | app/controllers/scimitar/service_provider_configurations_controller.rb | Ruby | mit | 86 | main | 340 | module Scimitar
class ServiceProviderConfigurationsController < ApplicationController
def show
service_provider_configuration = Scimitar.service_provider_configuration(location: request.url).as_json
service_provider_configuration.delete("uses_defaults")
render json: service_provider_configuratio... |
github | pond/scimitar | https://github.com/pond/scimitar | app/controllers/scimitar/schemas_controller.rb | Ruby | mit | 86 | main | 18,052 | module Scimitar
class SchemasController < ApplicationController
def index
schemas = Scimitar::Engine.schemas
schemas.each do |schema|
schema.meta.location = scim_schemas_url(name: schema.id)
end
schemas_by_id = schemas.reduce({}) do |hash, schema|
hash[schema.id] = schema... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/authentication_scheme.rb | Ruby | mit | 86 | main | 511 | module Scimitar
class AuthenticationScheme
include ActiveModel::Model
attr_accessor :type, :name, :description
def self.basic
new type: 'httpbasic',
name: 'HTTP Basic',
description: 'Authentication scheme using the HTTP Basic Standard'
end
def self.bearer
... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/filter.rb | Ruby | mit | 86 | main | 214 | module Scimitar
# Used to configure filters via
# app/models/scimitar/service_provider_configuration.rb.
#
class Filter < Supportable
MAX_RESULTS_DEFAULT = 100
attr_accessor :maxResults
end
end |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/service_provider_configuration.rb | Ruby | mit | 86 | main | 1,501 | module Scimitar
# Represents the service provider info. Used by the /ServiceProviderConfig
# endpoint to provide specification compliance, authentication schemes and
# data models. Renders to JSON as a SCIM ServiceProviderConfig type.
#
# See config/initializers/scimitar.rb for more information.
#
class ... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/resource_type.rb | Ruby | mit | 86 | main | 946 | module Scimitar
# Provides info about a resource type. Instances of this class are used to provide info through the /ResourceTypes endpoint of a SCIM service provider.
class ResourceType
include ActiveModel::Model
attr_accessor :meta, :endpoint, :schema, :schemas, :id, :name, :schemaExtensions
def init... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/supportable.rb | Ruby | mit | 86 | main | 227 | module Scimitar
class Supportable
include ActiveModel::Model
attr_accessor :supported
def self.supported
new(supported: true)
end
def self.unsupported
new(supported: false)
end
end
end |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/resource_invalid_error.rb | Ruby | mit | 86 | main | 244 | module Scimitar
class ResourceInvalidError < ErrorResponse
def initialize(error_message)
super(status: 400, scimType: 'invalidValue', detail: "Operation failed since record has become invalid: #{error_message}")
end
end
end |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/filter_error.rb | Ruby | mit | 86 | main | 536 | module Scimitar
# Raised when an invalid query is attempted, either by being malformed or by
# being unsupported in some way.
#
class FilterError < ErrorResponse
def initialize(message = nil)
detail = 'The specified filter syntax was invalid, or the specified attribute and filter comparison combinati... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/error_response.rb | Ruby | mit | 86 | main | 908 | module Scimitar
class ErrorResponse < StandardError
include ActiveModel::Model
attr_accessor :status,
:detail,
:scimType
def as_json(options = {})
data = {
'schemas': ['urn:ietf:params:scim:api:messages:2.0:Error'],
'detail': detail,
'sta... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/engine_configuration.rb | Ruby | mit | 86 | main | 931 | module Scimitar
# Scimitar general configuration.
#
# See config/initializers/scimitar.rb for more information.
#
class EngineConfiguration
include ActiveModel::Model
attr_accessor(
:uses_defaults,
:basic_authenticator,
:token_authenticator,
:custom_authenticator,
:cust... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/errors.rb | Ruby | mit | 86 | main | 374 | module Scimitar
module Errors
def add_errors_from_hash(errors_hash:, prefix: nil)
errors_hash.each_pair do |key, value|
new_key = prefix.nil? ? key : "#{prefix}.#{key}".to_sym
if value.is_a?(Array)
value.each {|error| errors.add(new_key, error)}
else
errors.add(ne... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/resources/base.rb | Ruby | mit | 86 | main | 7,699 | module Scimitar
module Resources
# The base class for all SCIM resources.
class Base
include ActiveModel::Model
include Scimitar::Schema::DerivedAttributes
include Scimitar::Errors
attr_accessor :id, :externalId, :meta
attr_reader :errors
validate :validate_resource
... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/resources/mixin.rb | Ruby | mit | 86 | main | 76,283 | module Scimitar
module Resources
# The mixin included by any class in your application which is to be mapped
# to and exposed via a SCIM interface. Any one such class must have one
# corresponding ResourcesController subclass declaring its association to
# that model.
#
# Your class becomes r... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/schema/base.rb | Ruby | mit | 86 | main | 3,628 | module Scimitar
module Schema
# The base class that each schema class must inherit from.
# These classes represent the schema of a SCIM resource or a complex type that could be used in a resource.
class Base
include ActiveModel::Model
attr_accessor :id, :name, :description, :scim_attributes, :... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/schema/user.rb | Ruby | mit | 86 | main | 2,543 | module Scimitar
module Schema
# Represents the schema for the User resource
# See also Scimitar::Resources::User
class User < Base
def initialize(options = {})
super(name: 'User',
id: self.class.id,
description: 'Represents a User',
scim_attributes:... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/schema/address.rb | Ruby | mit | 86 | main | 790 | module Scimitar
module Schema
# Represents the schema for the Address complex type.
#
# See also Scimitar::ComplexTypes::Address
#
class Address < Base
def self.scim_attributes
@scim_attributes ||= [
Attribute.new(name: 'type', type: 'string'),
Attribut... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/schema/reference_group.rb | Ruby | mit | 86 | main | 803 | module Scimitar
module Schema
# Represents the schema for the ReferenceGroup complex type,
# referring to a group of which a user is a member - used in
# a User SCIM resource's "groups" array.
#
# These are always read-only, with no ability to change the
# membership list through a User. Chan... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/schema/derived_attributes.rb | Ruby | mit | 86 | main | 458 | module Scimitar
module Schema
module DerivedAttributes
extend ActiveSupport::Concern
class_methods do
def set_schema(schema)
@schema = schema
derive_attributes_from_schema(schema)
schema
end
def derive_attributes_from_schema(schema)
att... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/schema/group.rb | Ruby | mit | 86 | main | 745 | module Scimitar
module Schema
# Represents the schema for the Group resource
# See also Scimitar::Resources::Group
class Group < Base
def initialize(options = {})
super(name: 'Group',
id: self.class.id,
description: 'Represents a Group',
scim_attrib... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/schema/vdtp.rb | Ruby | mit | 86 | main | 619 | module Scimitar
module Schema
# Represents a common schema for a few complex types; base class DRYs up
# code. "Vdtp" - Value, Display, Type, Primary.
#
class Vdtp < Base
def self.scim_attributes
@scim_attributes ||= [
Attribute.new(name: 'value', type: 'string', required: S... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/schema/entitlement.rb | Ruby | mit | 86 | main | 202 | module Scimitar
module Schema
# Represents the schema for the Entitlement complex type.
#
# See also Scimitar::ComplexTypes::Entitlement
#
class Entitlement < Vdtp; end
end
end |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/schema/x509_certificate.rb | Ruby | mit | 86 | main | 700 | module Scimitar
module Schema
# Represents the schema for the X509Certificate complex type.
# The 'value' holds the certificate data.
#
# Similar to the Vdtp class, but the "value" field is of type "binary".
#
# See also Scimitar::ComplexTypes::X509Certificate
#
class X509Certificate ... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/schema/name.rb | Ruby | mit | 86 | main | 656 | module Scimitar
module Schema
# Represents the schema for the Name complex type
# See also Scimitar::ComplexTypes::Name
class Name < Base
def self.scim_attributes
@scim_attributes ||= [
Attribute.new(name: 'familyName', type: 'string'),
Attribute.new(name: 'givenNa... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/schema/reference_member.rb | Ruby | mit | 86 | main | 756 | module Scimitar
module Schema
# Represents the schema for the ReferenceMember complex type,
# referring to a member of a group (where members can themselves
# be Users or Groups, identified by the "type" attribute). Used
# by the Group SCIM resource's "members" array.
#
# See also Scimitar::C... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/schema/phone_number.rb | Ruby | mit | 86 | main | 202 | module Scimitar
module Schema
# Represents the schema for the PhoneNumber complex type.
#
# See also Scimitar::ComplexTypes::PhoneNumber
#
class PhoneNumber < Vdtp; end
end
end |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/schema/attribute.rb | Ruby | mit | 86 | main | 4,363 | module Scimitar
module Schema
# Represents an attribute of a SCIM resource that is declared in its
# schema.
#
# Attributes can be simple or complex. A complex attribute needs to have
# its own schema that is passed to the initialize method when the attribute
# is instantiated.
#
# Ex... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/lists/query_parser.rb | Ruby | mit | 86 | main | 37,212 | module Scimitar
module Lists
# Simple SCIM filter support.
#
# This is currently an extremely limited query parser supporting only a
# single "name-operator-value" query, no boolean operations or precedence
# operators and it assumes "(I)LIKE" and "%" as wildcards in SQL for any
# operators w... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/lists/count.rb | Ruby | mit | 86 | main | 1,711 | module Scimitar
module Lists
class Count
include ActiveModel::Model
attr_accessor :limit, :start_index, :total
attr_reader :offset
def initialize(*args)
@limit = 100
@start_index = 1
super(*args)
end
# Set a limit (page size) value.
#
... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/complex_types/name.rb | Ruby | mit | 86 | main | 209 | module Scimitar
module ComplexTypes
# Represents the complex Name type.
#
# See also Scimitar::Schema::Name
#
class Name < Base
set_schema Scimitar::Schema::Name
end
end
end |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/complex_types/x509_certificate.rb | Ruby | mit | 86 | main | 253 | module Scimitar
module ComplexTypes
# Represents the complex X509Certificate type.
#
# See also Scimitar::Schema::X509Certificate
#
class X509Certificate < Base
set_schema Scimitar::Schema::X509Certificate
end
end
end |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/complex_types/photo.rb | Ruby | mit | 86 | main | 213 | module Scimitar
module ComplexTypes
# Represents the complex Photo type.
#
# See also Scimitar::Schema::Photo
#
class Photo < Base
set_schema Scimitar::Schema::Photo
end
end
end |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/complex_types/email.rb | Ruby | mit | 86 | main | 213 | module Scimitar
module ComplexTypes
# Represents the complex Email type.
#
# See also Scimitar::Schema::Email
#
class Email < Base
set_schema Scimitar::Schema::Email
end
end
end |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/complex_types/phone_number.rb | Ruby | mit | 86 | main | 237 | module Scimitar
module ComplexTypes
# Represents the complex PhoneNumber type.
#
# See also Scimitar::Schema::PhoneNumber
#
class PhoneNumber < Base
set_schema Scimitar::Schema::PhoneNumber
end
end
end |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/complex_types/role.rb | Ruby | mit | 86 | main | 209 | module Scimitar
module ComplexTypes
# Represents the complex Role type.
#
# See also Scimitar::Schema::Role
#
class Role < Base
set_schema Scimitar::Schema::Role
end
end
end |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/complex_types/reference_member.rb | Ruby | mit | 86 | main | 256 | module Scimitar
module ComplexTypes
# Represents the complex reference-a-member type.
#
# See also Scimitar::Schema::ReferenceMember
#
class ReferenceMember < Base
set_schema Scimitar::Schema::ReferenceMember
end
end
end |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/complex_types/reference_group.rb | Ruby | mit | 86 | main | 252 | module Scimitar
module ComplexTypes
# Represents the complex reference-a-group type.
#
# See also Scimitar::Schema::ReferenceGroup
#
class ReferenceGroup < Base
set_schema Scimitar::Schema::ReferenceGroup
end
end
end |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/complex_types/entitlement.rb | Ruby | mit | 86 | main | 237 | module Scimitar
module ComplexTypes
# Represents the complex Entitlement type.
#
# See also Scimitar::Schema::Entitlement
#
class Entitlement < Base
set_schema Scimitar::Schema::Entitlement
end
end
end |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/complex_types/base.rb | Ruby | mit | 86 | main | 3,054 | require 'set'
module Scimitar
module ComplexTypes
# This class represents complex types that could be used inside SCIM
# resources. Each complex type must inherit from this class. They also need
# to have their own schema defined. For example:
#
# module Scimitar
# module ComplexTy... |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/complex_types/ims.rb | Ruby | mit | 86 | main | 219 | module Scimitar
module ComplexTypes
# Represents the complex Instant Messaging type.
#
# See also Scimitar::Schema::Ims
#
class Ims < Base
set_schema Scimitar::Schema::Ims
end
end
end |
github | pond/scimitar | https://github.com/pond/scimitar | app/models/scimitar/complex_types/address.rb | Ruby | mit | 86 | main | 221 | module Scimitar
module ComplexTypes
# Represents the complex Address type.
#
# See also Scimitar::Schema::Address
#
class Address < Base
set_schema Scimitar::Schema::Address
end
end
end |
github | pond/scimitar | https://github.com/pond/scimitar | lib/scimitar.rb | Ruby | mit | 86 | main | 952 | require 'scimitar/version'
require 'scimitar/support/hash_with_indifferent_case_insensitive_access'
require 'scimitar/support/utilities'
require 'scimitar/engine'
module Scimitar
def self.service_provider_configuration=(custom_configuration)
if @service_provider_configuration.nil? || ! custom_configuration.uses_... |
github | pond/scimitar | https://github.com/pond/scimitar | lib/scimitar/engine.rb | Ruby | mit | 86 | main | 3,371 | require 'rails/engine'
module Scimitar
class Engine < ::Rails::Engine
isolate_namespace Scimitar
config.autoload_once_paths = %W(
#{root}/app/controllers
#{root}/app/models
)
Mime::Type.register 'application/scim+json', :scim
ActionDispatch::Request.parameter_parsers[Mime::Type.loo... |
github | pond/scimitar | https://github.com/pond/scimitar | lib/scimitar/version.rb | Ruby | mit | 86 | main | 265 | module Scimitar
# Gem version. If this changes, be sure to re-run "bundle install" or
# "bundle update".
#
VERSION = '2.15.0'
# Date for VERSION. If this changes, be sure to re-run "bundle install"
# or "bundle update".
#
DATE = '2026-03-06'
end |
github | pond/scimitar | https://github.com/pond/scimitar | lib/scimitar/support/hash_with_indifferent_case_insensitive_access.rb | Ruby | mit | 86 | main | 7,995 | require 'active_support/hash_with_indifferent_access'
class Hash
# Converts this Hash to an instance of
# Scimitar::Support::HashWithIndifferentCaseInsensitiveAccess, which is
# a subclass of ActiveSupport::HashWithIndifferentAccess with the addition of
# case-insensitive lookup.
#
# Note that this is mor... |
github | pond/scimitar | https://github.com/pond/scimitar | lib/scimitar/support/utilities.rb | Ruby | mit | 86 | main | 4,654 | module Scimitar
# Namespace containing various chunks of Scimitar support code that don't
# logically fit into other areas.
#
module Support
# A namespace that contains various stand-alone utility methods which act
# as helpers for other parts of the code base, without risking namespace
# pollutio... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/spec_helper_spec.rb | Ruby | mit | 86 | main | 1,012 | # Self-test. Sometimes tests call into utility methods in spec_helper.rb;
# if those aren't doing what they should, then the tests might give false
# positive passes.
#
require 'spec_helper'
RSpec.describe 'spec_helper.rb self-test' do
context '#spec_helper_hupcase' do
it 'converts a flat Hash, preserving data t... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/spec_helper.rb | Ruby | mit | 86 | main | 3,026 | # ============================================================================
# PREAMBLE
# ============================================================================
# Get code coverage reports:
#
# https://github.com/colszowka/simplecov#getting-started
#
# "Load and launch SimpleCov at the very top of your test/te... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/support/hash_with_indifferent_case_insensitive_access_spec.rb | Ruby | mit | 86 | main | 4,935 | require 'spec_helper'
RSpec.describe Scimitar::Support::HashWithIndifferentCaseInsensitiveAccess do
shared_examples 'an indifferent access, case insensitive Hash' do
context 'where keys set as strings' do
it 'can be retrieved via any case' do
subject()['foo'] = 1
expect(subject()['FOO']).t... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/apps/dummy/db/schema.rb | Ruby | mit | 86 | main | 2,032 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rai... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/apps/dummy/db/migrate/20210304014602_create_mock_users.rb | Ruby | mit | 86 | main | 651 | class CreateMockUsers < ActiveRecord::Migration[6.1]
def change
create_table :mock_users, id: :uuid, primary_key: :primary_key do |t|
t.timestamps
# Support part of the core schema
#
t.text :scim_uid
t.text :username
t.text :password
t.text :first_name
t.text :last... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/apps/dummy/db/migrate/20210308020313_create_mock_groups.rb | Ruby | mit | 86 | main | 200 | class CreateMockGroups < ActiveRecord::Migration[6.1]
def change
create_table :mock_groups do |t|
t.text :scim_uid
t.text :display_name
t.references :parent
end
end
end |
github | pond/scimitar | https://github.com/pond/scimitar | spec/apps/dummy/db/migrate/20210308044214_create_join_table_mock_groups_mock_users.rb | Ruby | mit | 86 | main | 589 | class CreateJoinTableMockGroupsMockUsers < ActiveRecord::Migration[6.1]
def change
create_table :mock_groups_users, id: false do | t |
t.references :mock_group, foreign_key: true, type: :int8, index: true, null: false
t.references :mock_user, type: :uuid, index: true, null: false, ... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/apps/dummy/config/application.rb | Ruby | mit | 86 | main | 669 | require_relative 'boot'
require 'rails'
require 'active_model/railtie'
require 'active_record/railtie'
require 'action_controller/railtie'
require 'action_view/railtie'
Bundler.require(*Rails.groups)
require 'scimitar'
module Dummy
class Application < Rails::Application
config.load_defaults 7.0
# Silence... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/apps/dummy/config/routes.rb | Ruby | mit | 86 | main | 2,259 | # This test app mounts everything at the root level, but you'd usually be doing
# more in your Rails app than just SCIM! Wrapping with 'namespace :foo do' is
# strongly recommended to avoid routing namespace collisions. See README.md for
# an example.
#
Rails.application.routes.draw do
mount Scimitar::Engine, at: '/'... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/apps/dummy/config/environments/test.rb | Ruby | mit | 86 | main | 1,317 | require 'active_support/core_ext/integer/time'
Rails.application.configure do
config.cache_classes = true
config.eager_load = false
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
'Cache-Control' ... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/apps/dummy/config/initializers/scimitar.rb | Ruby | mit | 86 | main | 2,814 | # Test app configuration.
#
# Note that as a result of https://github.com/pond/scimitar/issues/48,
# tests include a custom extension of the core User schema. A shortcoming of
# some of the code from which Scimitar was originally built is that those
# extensions are done with class-level ivars, so it is largely impossi... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/apps/dummy/app/models/mock_group_batch.rb | Ruby | mit | 86 | main | 525 | class MockGroupBatch < MockGroup
def self.scim_attributes_map
{
id: :id,
externalId: :scim_uid,
displayName: :display_name,
members: [
{
list: :scim_users_and_groups,
using: { value: :id },
# Minimal mock: assume user-only entries (type ... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/apps/dummy/app/models/mock_user.rb | Ruby | mit | 86 | main | 3,822 | class MockUser < ActiveRecord::Base
self.primary_key = :primary_key
# ===========================================================================
# TEST ATTRIBUTES - see db/migrate/20210304014602_create_mock_users.rb etc.
# ===========================================================================
READWRI... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/apps/dummy/app/models/mock_group.rb | Ruby | mit | 86 | main | 2,725 | class MockGroup < ActiveRecord::Base
# ===========================================================================
# TEST ATTRIBUTES - see db/migrate/20210308020313_create_mock_groups.rb etc.
# ===========================================================================
READWRITE_ATTRS = %w{
id
scim_ui... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/apps/dummy/app/controllers/custom_destroy_mock_users_controller.rb | Ruby | mit | 86 | main | 535 | # For tests only - uses custom 'destroy' implementation which passes a block to
# Scimitar::ActiveRecordBackedResourcesController#destroy.
#
class CustomDestroyMockUsersController < Scimitar::ActiveRecordBackedResourcesController
NOT_REALLY_DELETED_USERNAME_INDICATOR = 'not really deleted'
def destroy
super d... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/apps/dummy/app/controllers/custom_create_mock_users_controller.rb | Ruby | mit | 86 | main | 499 | # For tests only - uses custom 'create' implementation which passes a block to
# Scimitar::ActiveRecordBackedResourcesController#create.
#
class CustomCreateMockUsersController < Scimitar::ActiveRecordBackedResourcesController
OVERRIDDEN_NAME = SecureRandom.uuid
def create
super do | resource |
resource... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/apps/dummy/app/controllers/custom_save_mock_users_controller.rb | Ruby | mit | 86 | main | 546 | # For tests only - uses custom 'save!' implementation which passes a block to
# Scimitar::ActiveRecordBackedResourcesController#save!.
#
class CustomSaveMockUsersController < Scimitar::ActiveRecordBackedResourcesController
CUSTOM_SAVE_BLOCK_USERNAME_INDICATOR = 'Custom save-block invoked'
protected
def save!... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/apps/dummy/app/controllers/custom_replace_mock_users_controller.rb | Ruby | mit | 86 | main | 502 | # For tests only - uses custom 'replace' implementation which passes a block to
# Scimitar::ActiveRecordBackedResourcesController#create.
#
class CustomReplaceMockUsersController < Scimitar::ActiveRecordBackedResourcesController
OVERRIDDEN_NAME = SecureRandom.uuid
def replace
super do | resource |
resou... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/apps/dummy/app/controllers/custom_update_mock_users_controller.rb | Ruby | mit | 86 | main | 499 | # For tests only - uses custom 'update' implementation which passes a block to
# Scimitar::ActiveRecordBackedResourcesController#create.
#
class CustomUpdateMockUsersController < Scimitar::ActiveRecordBackedResourcesController
OVERRIDDEN_NAME = SecureRandom.uuid
def update
super do | resource |
resource... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/apps/dummy/app/controllers/custom_request_verifiers_controller.rb | Ruby | mit | 86 | main | 598 | # For tests only - uses custom 'index' implementation which returns information
# from the Rails 'request' object in its response.
#
class CustomRequestVerifiersController < Scimitar::ActiveRecordBackedResourcesController
def index
render json: {
request: {
is_scim: request.format == :scim,
... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/apps/dummy/app/controllers/mock_batch_groups_controller.rb | Ruby | mit | 86 | main | 208 | class MockBatchGroupsController < Scimitar::ActiveRecordBackedResourcesController
protected
def storage_class
MockGroupBatch
end
def storage_scope
MockGroupBatch.all
end
end |
github | pond/scimitar | https://github.com/pond/scimitar | spec/controllers/scimitar/application_controller_spec.rb | Ruby | mit | 86 | main | 17,040 | require 'spec_helper'
RSpec.describe Scimitar::ApplicationController do
context 'basic authentication' do
before do
Scimitar.engine_configuration = Scimitar::EngineConfiguration.new(
basic_authenticator: Proc.new do | username, password |
username == 'A' && password == 'B'
end
... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/controllers/scimitar/schemas_controller_spec.rb | Ruby | mit | 86 | main | 15,863 | require 'spec_helper'
RSpec.describe Scimitar::SchemasController do
routes { Scimitar::Engine.routes }
before(:each) { allow(controller).to receive(:authenticated?).and_return(true) }
controller do
def index
super
end
end
context '#index' do
shared_examples 'a Schema list which' do
... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/controllers/scimitar/service_provider_configurations_controller_spec.rb | Ruby | mit | 86 | main | 721 | require 'spec_helper'
RSpec.describe Scimitar::ServiceProviderConfigurationsController do
before(:each) { allow(controller).to receive(:authenticated?).and_return(true) }
controller do
def show
super
end
end
context '#show' do
it 'renders the servive provider configurations' do
get :s... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/controllers/scimitar/resources_controller_spec.rb | Ruby | mit | 86 | main | 7,638 | require 'spec_helper'
RSpec.describe Scimitar::ResourcesController do
class FakeGroup
include ActiveModel::Model
attr_accessor :scim_id
attr_accessor :display_name
attr_accessor :member_names
def self.scim_resource_type
return Scimitar::Resources::Group
end
def self.scim_attribut... |
github | pond/scimitar | https://github.com/pond/scimitar | spec/controllers/scimitar/resource_types_controller_spec.rb | Ruby | mit | 86 | main | 3,270 | require 'spec_helper'
RSpec.describe Scimitar::ResourceTypesController do
routes { Scimitar::Engine.routes }
before(:each) { allow(controller).to receive(:authenticated?).and_return(true) }
context 'GET index' do
it 'renders the resource type for user' do
get :index, format: :scim
response_hash... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.