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
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/code_hunk.rb
Ruby
mit
83
master
1,294
module Airbrake # Represents a small hunk of code consisting of a base line and a couple lines # around it # @api private class CodeHunk # @return [Integer] the maximum length of a line MAX_LINE_LEN = 200 # @return [Integer] how many lines should be read around the base line NLINES = 2 inc...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/timed_trace.rb
Ruby
mit
83
master
1,222
module Airbrake # TimedTrace represents a chunk of code performance of which was measured and # stored under a label. The chunk is called a "span". # # @example # timed_trace = TimedTrace.new # timed_trace.span('http request') do # http.get('example.com') # end # timed_trace.spans #=> { 'h...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/remote_settings/callback.rb
Ruby
mit
83
master
1,214
module Airbrake class RemoteSettings # Callback is a class that provides a callback for the config poller, which # updates the local config according to the data. # # @api private # @since v5.0.2 class Callback def initialize(config) @config = config @orig_error_notificat...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/remote_settings/settings_data.rb
Ruby
mit
83
master
3,344
module Airbrake class RemoteSettings # SettingsData is a container, which wraps JSON payload returned by the # remote settings API. It exposes the payload via convenient methods and # also ensures that in case some data from the payload is missing, a default # value would be returned instead. # ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/config/validator.rb
Ruby
mit
83
master
2,869
module Airbrake class Config # Validator validates values of {Airbrake::Config} options. A valid config # is a config that guarantees that data can be sent to Airbrake given its # configuration. # # @api private # @since v1.5.0 class Validator # @return [Array<Class>] the list of all...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/config/processor.rb
Ruby
mit
83
master
2,414
module Airbrake class Config # Processor is a helper class, which is responsible for setting default # config values, default notifier filters and remote configuration changes. # # @since v5.0.0 # @api private class Processor # @param [Airbrake::Config] config # @return [Airbrake::...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/filters/root_directory_filter.rb
Ruby
mit
83
master
667
module Airbrake module Filters # Replaces root directory with a label. # @api private class RootDirectoryFilter # @return [String] PROJECT_ROOT_LABEL = '/PROJECT_ROOT'.freeze # @return [Integer] attr_reader :weight def initialize(root_directory) @root_directory = ro...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/filters/dependency_filter.rb
Ruby
mit
83
master
749
module Airbrake module Filters # Attaches loaded dependencies to the notice object. # # @api private # @since v2.10.0 class DependencyFilter def initialize @weight = 117 end # @macro call_filter def call(notice) deps = {} Gem.loaded_specs.map.with_o...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/filters/sql_filter.rb
Ruby
mit
83
master
4,245
module Airbrake module Filters # SqlFilter filters out sensitive data from {Airbrake::Query}. Sensitive # data is everything that is not table names or fields (e.g. column values # and such). # # Supports the following SQL dialects: # * PostgreSQL # * MySQL # * SQLite # * Cassandra...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/filters/git_repository_filter.rb
Ruby
mit
83
master
1,984
module Airbrake module Filters # Attaches git repository URL to `context`. # @api private # @since v2.12.0 class GitRepositoryFilter # @return [Integer] attr_reader :weight # @param [String] root_directory def initialize(root_directory) @git_path = File.join(root_direc...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/filters/keys_allowlist.rb
Ruby
mit
83
master
1,264
module Airbrake module Filters # A default Airbrake notice filter. Filters everything in the payload of a # notice, but specified keys. # # @example # filter = Airbrake::Filters::KeysAllowlist.new( # [:email, /credit/i, 'password'] # ) # airbrake.add_filter(filter) # ai...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/filters/git_revision_filter.rb
Ruby
mit
83
master
1,665
module Airbrake module Filters # Attaches current git revision to `context`. # @api private # @since v2.11.0 class GitRevisionFilter # @return [Integer] attr_reader :weight # @return [String] PREFIX = 'ref: '.freeze # @param [String] root_directory def initialize(...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/filters/git_last_checkout_filter.rb
Ruby
mit
83
master
2,325
require 'date' module Airbrake module Filters # Attaches git checkout info to `context`. The info includes: # * username # * email # * revision # * time # # This information is used to track deploys automatically. # # @api private # @since v2.12.0 class GitLastChec...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/filters/keys_filter.rb
Ruby
mit
83
master
4,525
module Airbrake # Namespace for all standard filters. Custom filters can also go under this # namespace. module Filters # This is a filter helper that endows a class ability to filter notices' # payload based on the return value of the +should_filter?+ method that a # class that includes this module m...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/filters/context_filter.rb
Ruby
mit
83
master
622
module Airbrake module Filters # Adds user context to the notice object. Clears the context after it's # attached. # # @api private # @since v2.9.0 class ContextFilter # @return [Integer] attr_reader :weight def initialize @weight = 119 @mutex = Mutex.new ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/filters/keys_blocklist.rb
Ruby
mit
83
master
1,322
module Airbrake module Filters # A default Airbrake notice filter. Filters only specific keys listed in the # list of parameters in the payload of a notice. # # @example # filter = Airbrake::Filters::KeysBlocklist.new( # [:email, /credit/i, 'password'] # ) # airbrake.add_filt...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/filters/gem_root_filter.rb
Ruby
mit
83
master
850
module Airbrake module Filters # Replaces paths to gems with a placeholder. # @api private class GemRootFilter # @return [String] GEM_ROOT_LABEL = '/GEM_ROOT'.freeze # @return [Integer] attr_reader :weight def initialize @weight = 120 end # @macro call_...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/filters/thread_filter.rb
Ruby
mit
83
master
2,301
module Airbrake module Filters # Attaches thread & fiber local variables along with general thread # information. # @api private class ThreadFilter # @return [Integer] attr_reader :weight # @return [Array<Class>] the list of classes that can be safely converted # to JSON ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/filters/exception_attributes_filter.rb
Ruby
mit
83
master
1,167
module Airbrake module Filters # ExceptionAttributesFilter attempts to call `#to_airbrake` on the stashed # exception and attaches returned data to the notice object. # # @api private # @since v2.10.0 class ExceptionAttributesFilter include Loggable def initialize @weight ...
github
airbrake/airbrake-ruby
https://github.com/airbrake/airbrake-ruby
lib/airbrake-ruby/filters/system_exit_filter.rb
Ruby
mit
83
master
511
module Airbrake module Filters # Skip over SystemExit exceptions, because they're just noise. # @api private class SystemExitFilter # @return [String] SYSTEM_EXIT_TYPE = 'SystemExit'.freeze # @return [Integer] attr_reader :weight def initialize @weight = 130 e...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
Rakefile
Ruby
mit
83
master
426
# frozen_string_literal: true require "bundler/gem_tasks" require "rspec/core/rake_task" require "appraisal" desc "Default: run specs." task :default => :spec desc "Run all specs" RSpec::Core::RakeTask.new(:spec) namespace :doorkeeper do desc "Install doorkeeper in dummy app" task :install do cd "spec/dummy...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
doorkeeper-grants_assertion.gemspec
Ruby
mit
83
master
1,630
# coding: utf-8 # frozen_string_literal: true lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "doorkeeper/grants_assertion/version" Gem::Specification.new do |s| s.name = 'doorkeeper-grants_assertion' s.version = Doorkeeper::GrantsAssertion::V...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
lib/doorkeeper/grants_assertion.rb
Ruby
mit
83
master
989
# frozen_string_literal: true require "doorkeeper/request/assertion" require "doorkeeper/grants_assertion/railtie" require "doorkeeper/grants_assertion/omniauth" require "doorkeeper/grants_assertion/devise/omniauth" module Doorkeeper module GrantsAssertion def resource_owner_from_assertion instance_eval(...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
lib/doorkeeper/grants_assertion/railtie.rb
Ruby
mit
83
master
407
# frozen_string_literal: true module Doorkeeper module GrantsAssertion class Railtie < ::Rails::Railtie initializer "doorkeeper.grants_assertion.params.filter" do |app| app.config.filter_parameters << "assertion" end initializer "doorkeeper.grants_assertion" do Doorkeeper::Help...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
lib/doorkeeper/grants_assertion/omniauth.rb
Ruby
mit
83
master
950
# frozen_string_literal: true module Doorkeeper module GrantsAssertion module OmniAuth class << self def oauth2_wrapper( provider:, strategy_class:, client_id:, client_secret:, client_options:, assertion:, expires_at: nil, ...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
lib/doorkeeper/grants_assertion/devise/omniauth.rb
Ruby
mit
83
master
1,019
# frozen_string_literal: true module Doorkeeper module GrantsAssertion module Devise module OmniAuth class << self def auth_hash(provider:, assertion:) devise_config = ::Devise.omniauth_configs[provider.to_sym] fail("Invalid Assertion Provider") if devise_config.ni...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
lib/doorkeeper/request/assertion.rb
Ruby
mit
83
master
1,039
# frozen_string_literal: true module Doorkeeper module Request class Assertion < Strategy delegate :credentials, :resource_owner_from_assertion, :parameters, to: :server def request @request ||= build_request end def authorize request.authorize end private ...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/spec_helper.rb
Ruby
mit
83
master
4,592
# frozen_string_literal: true require "webmock/rspec" require "rails" require "omniauth-oauth2" require "omniauth-facebook" require "omniauth-google-oauth2" require "devise" require "doorkeeper" require "doorkeeper/grants_assertion" WebMock.disable_net_connect! FACEBOOK_INVALID_TOKEN = "invalid_token_ABCDEFGHIJKLM...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/spec_helper_integration.rb
Ruby
mit
83
master
793
ENV['RAILS_ENV'] ||= 'test' $LOAD_PATH.unshift File.dirname(__FILE__) require 'dummy/config/environment' require 'rspec/rails' require 'database_cleaner' Rails.logger.info "====> Doorkeeper.orm = #{Doorkeeper.configuration.orm.inspect}" Rails.logger.info "====> Rails version: #{Rails.version}" Rails.logger.info "===...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/dummy/config/application.rb
Ruby
mit
83
master
1,848
require File.expand_path('../boot', __FILE__) require 'action_controller/railtie' require 'sprockets/railtie' Bundler.require :default require "active_record/railtie" module Dummy class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Applic...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/dummy/config/routes.rb
Ruby
mit
83
master
1,475
Rails.application.routes.draw do use_doorkeeper scope 'inner_space' do use_doorkeeper scope: 'scope' do controllers authorizations: 'custom_authorizations', tokens: 'custom_authorizations', applications: 'custom_authorizations', token_info: 'custom_au...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/dummy/config/environments/test.rb
Ruby
mit
83
master
2,136
Dummy::Application.configure do # Settings specified here will take precedence over those in config/application.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test su...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/dummy/config/environments/development.rb
Ruby
mit
83
master
1,007
Dummy::Application.configure do # Settings specified here will take precedence over those in config/application.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web ser...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/dummy/config/initializers/secret_token.rb
Ruby
mit
83
master
544
# Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attac...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/dummy/config/initializers/devise.rb
Ruby
mit
83
master
14,151
# frozen_string_literal: true # Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| # The secret key used by Devise. Devise uses this key to generate # random tokens. Changing this key will render inv...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/dummy/config/initializers/doorkeeper.rb
Ruby
mit
83
master
5,251
Doorkeeper.configure do # Change the ORM that doorkeeper will use (needs plugins) orm :active_record # This block will be called to check whether the resource owner is authenticated or not. resource_owner_authenticator do # Put your resource owner authentication logic here. # Example implementation: ...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/dummy/db/schema.rb
Ruby
mit
83
master
2,883
# encoding: UTF-8 # 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. # # Note that this schema.rb definition is the authoritative sou...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/dummy/db/migrate/20130902165751_create_doorkeeper_tables.rb
Ruby
mit
83
master
1,376
class CreateDoorkeeperTables < ActiveRecord::Migration def change create_table :oauth_applications do |t| t.string :name, null: false t.string :uid, null: false t.string :secret, null: false t.string :redirect_uri, null: false, limit: 2048 t.timestamps ...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/dummy/db/migrate/20130902175349_add_owner_to_application.rb
Ruby
mit
83
master
274
class AddOwnerToApplication < ActiveRecord::Migration def change add_column :oauth_applications, :owner_id, :integer, null: true add_column :oauth_applications, :owner_type, :string, null: true add_index :oauth_applications, [:owner_id, :owner_type] end end
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/dummy/app/models/user.rb
Ruby
mit
83
master
222
class User < ActiveRecord::Base if ::Rails.version.to_i < 4 attr_accessible :name, :password, :assertion end def self.authenticate!(name, password) User.where(name: name, password: password).first end end
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/dummy/app/controllers/home_controller.rb
Ruby
mit
83
master
382
class HomeController < ApplicationController def index end def sign_in session[:user_id] = if Rails.env.development? User.first || User.create!(name: 'Joe', password: 'sekret') else User.first end redirect...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/dummy/app/controllers/metal_controller.rb
Ruby
mit
83
master
272
class MetalController < ActionController::Metal include AbstractController::Callbacks include ActionController::Head include Doorkeeper::Helpers::Controller before_action :doorkeeper_authorize! def index self.response_body = { ok: true }.to_json end end
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/dummy/app/controllers/custom_authorizations_controller.rb
Ruby
mit
83
master
201
class CustomAuthorizationsController < ::ApplicationController %w(index show new create edit update destroy).each do |action| define_method action do render nothing: true end end end
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/dummy/app/controllers/semi_protected_resources_controller.rb
Ruby
mit
83
master
228
class SemiProtectedResourcesController < ApplicationController before_action :doorkeeper_authorize!, only: [:index] def index render text: 'protected index' end def show render text: 'protected show' end end
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/doorkeeper/grants_assertion/omniauth_spec.rb
Ruby
mit
83
master
7,331
# frozen_string_literal: true require "spec_helper" describe ::Doorkeeper::GrantsAssertion::OmniAuth do describe ".oauth2_wrapper" do subject { described_class.oauth2_wrapper(params) } context "OAuth2 strategy" do let(:params) { { provider: "test-provider", strategy_class:...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/doorkeeper/requests/flows/assertion_spec.rb
Ruby
mit
83
master
9,767
# frozen_string_literal: true require 'spec_helper_integration' describe 'Resource Owner Assertion Flow inproperly set up', type: :request do before do config_is_set(:resource_owner_from_assertion) { nil } client_exists create_resource_owner end context 'with valid user assertion' do it "should...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/support/shared/models_shared_examples.rb
Ruby
mit
83
master
1,393
shared_examples 'an accessible token' do describe :accessible? do it 'is accessible if token is not expired' do allow(subject).to receive(:expired?).and_return(false) should be_accessible end it 'is not accessible if token is expired' do allow(subject).to receive(:expired?).and_return(t...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/support/shared/controllers_shared_context.rb
Ruby
mit
83
master
1,562
shared_context 'valid token', token: :valid do let :token_string do '1A2B3C4D' end let :token do double(Doorkeeper::AccessToken, accessible?: true) end before :each do allow(Doorkeeper::AccessToken).to receive(:authenticate).with(token_string).and_return(token) end end shared_context 'invalid...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/support/helpers/model_helper.rb
Ruby
mit
83
master
1,439
module ModelHelper def client_exists(client_attributes = {}) @client = FactoryBot.create(:application, client_attributes) end def create_resource_owner @resource_owner = User.create!( name: "Joe", password: "sekret", assertion: "assertion", email: "u123456789@mail.com" ) end...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/support/helpers/url_helper.rb
Ruby
mit
83
master
851
module UrlHelper def assertion_endpoint_url(options = {}) parameters = { code: options[:code], client_id: options[:client_id] || options[:client].uid, client_secret: options[:client_secret] || options[:client].secret, redirect_uri: options[:redirect_uri] || options[:clie...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/support/helpers/config_helper.rb
Ruby
mit
83
master
291
module ConfigHelper def config_is_set(setting, value = nil, &block) setting_ivar = "@#{setting}" value = block_given? ? block : value Doorkeeper.configuration.instance_variable_set(setting_ivar, value) end end RSpec.configuration.send :include, ConfigHelper, type: :request
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/support/helpers/request_spec_helper.rb
Ruby
mit
83
master
1,789
module RequestSpecHelper def i_should_see(content) expect(page).to have_content(content) end def i_should_not_see(content) expect(page).to have_no_content(content) end def i_should_be_on(path) expect(current_path).to eq(path) end def url_should_have_param(param, value) expect(current_pa...
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/factories/application.rb
Ruby
mit
83
master
211
# frozen_string_literal: true FactoryBot.define do factory :application, class: Doorkeeper::Application do sequence(:name) { |n| "Application #{n}" } redirect_uri 'https://app.com/callback' end end
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/factories/access_grant.rb
Ruby
mit
83
master
269
# frozen_string_literal: true FactoryBot.define do factory :access_grant, class: Doorkeeper::AccessGrant do sequence(:resource_owner_id) { |n| n } application redirect_uri 'https://app.com/callback' expires_in 100 scopes 'public write' end end
github
doorkeeper-gem/doorkeeper-grants_assertion
https://github.com/doorkeeper-gem/doorkeeper-grants_assertion
spec/factories/access_token.rb
Ruby
mit
83
master
274
# frozen_string_literal: true FactoryBot.define do factory :access_token, class: Doorkeeper::AccessToken do sequence(:resource_owner_id) { |n| n } application expires_in 2.hours factory :clientless_access_token do application nil end end end
github
igorkasyanchuk/new_google_recaptcha
https://github.com/igorkasyanchuk/new_google_recaptcha
new_google_recaptcha.gemspec
Ruby
mit
83
master
1,081
$:.push File.expand_path("lib", __dir__) # Maintain your gem's version: require "new_google_recaptcha/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "new_google_recaptcha" s.version = NewGoogleRecaptcha::VERSION s.authors = ["Igor Kasyanchuk", "r...
github
igorkasyanchuk/new_google_recaptcha
https://github.com/igorkasyanchuk/new_google_recaptcha
Rakefile
Ruby
mit
83
master
555
begin require 'bundler/setup' rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end require 'rdoc/task' RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' rdoc.title = 'NewGoogleRecaptcha' rdoc.options << '--line-numbers' rdoc.rdoc_files.include('README.m...
github
igorkasyanchuk/new_google_recaptcha
https://github.com/igorkasyanchuk/new_google_recaptcha
Gemfile
Ruby
mit
83
master
800
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } # Declare your gem's dependencies in new_google_recaptcha.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec ...
github
igorkasyanchuk/new_google_recaptcha
https://github.com/igorkasyanchuk/new_google_recaptcha
test/test_helper.rb
Ruby
mit
83
master
951
# Configure Rails Environment ENV["RAILS_ENV"] = "test" require_relative "../test/dummy/config/environment" ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)] require "rails/test_help" require "webmock/minitest" require "support/recaptcha_stubs" # Filter out Minitest bac...
github
igorkasyanchuk/new_google_recaptcha
https://github.com/igorkasyanchuk/new_google_recaptcha
test/dummy/config/application.rb
Ruby
mit
83
master
574
require_relative 'boot' require 'rails/all' Bundler.require(*Rails.groups) require "new_google_recaptcha" module Dummy class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 5.2 # Settings in config/environments/* take pr...
github
igorkasyanchuk/new_google_recaptcha
https://github.com/igorkasyanchuk/new_google_recaptcha
test/dummy/config/initializers/new_google_recaptcha.rb
Ruby
mit
83
master
261
if Object.const_defined?('NewGoogleRecaptcha') NewGoogleRecaptcha.setup do |config| config.site_key = "6LfBqncUAAAAAAEpwtSx3rh0FsurqYnmkBVA0-MX" config.secret_key = "6LfBqncUAAAAAHmiRgYzEIieu5n3XiHRpBTWfDrC" config.minimum_score = 0.5 end end
github
igorkasyanchuk/new_google_recaptcha
https://github.com/igorkasyanchuk/new_google_recaptcha
test/dummy/db/schema.rb
Ruby
mit
83
master
1,170
# 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. # # Note that this schema.rb definition is the authoritative source for your # dat...
github
igorkasyanchuk/new_google_recaptcha
https://github.com/igorkasyanchuk/new_google_recaptcha
test/dummy/db/migrate/20190711152953_create_books.rb
Ruby
mit
83
master
206
class CreateBooks < ActiveRecord::Migration[5.2] def change create_table :books do |t| t.string :title t.string :author t.float :humanity_score t.timestamps end end end
github
igorkasyanchuk/new_google_recaptcha
https://github.com/igorkasyanchuk/new_google_recaptcha
test/dummy/app/controllers/posts_controller.rb
Ruby
mit
83
master
1,421
class PostsController < ApplicationController before_action :set_post, only: [:show, :edit, :update, :destroy] # GET /posts def index @posts = Post.all end # GET /posts/1 def show end # GET /posts/new def new @post = Post.new end # GET /posts/1/edit def edit end # POST /posts ...
github
igorkasyanchuk/new_google_recaptcha
https://github.com/igorkasyanchuk/new_google_recaptcha
test/dummy/app/controllers/books_controller.rb
Ruby
mit
83
master
1,628
class BooksController < ApplicationController before_action :set_book, only: [:show, :edit, :update, :destroy] # GET /books def index @books = Book.all end # GET /books/1 def show end # GET /books/new def new @book = Book.new end # GET /books/1/edit def edit end # book /books ...
github
igorkasyanchuk/new_google_recaptcha
https://github.com/igorkasyanchuk/new_google_recaptcha
test/dummy/test/controllers/books_controller_test.rb
Ruby
mit
83
master
2,059
require 'test_helper' class BooksControllerTest < ActionDispatch::IntegrationTest fixtures :books setup do @book = books(:one) end test "should create book with recaptcha success and store score in Book" do stub_book_recaptcha_success assert_difference('Book.count', 1) do post books_url, p...
github
igorkasyanchuk/new_google_recaptcha
https://github.com/igorkasyanchuk/new_google_recaptcha
test/dummy/test/controllers/posts_controller_test.rb
Ruby
mit
83
master
1,910
require 'test_helper' class PostsControllerTest < ActionDispatch::IntegrationTest fixtures :posts setup do @post = posts(:one) end test "should create post with recaptcha success" do stub_post_recaptcha_success assert_difference('Post.count', 1) do post posts_url, params: { post: { body: @...
github
igorkasyanchuk/new_google_recaptcha
https://github.com/igorkasyanchuk/new_google_recaptcha
test/support/recaptcha_stubs.rb
Ruby
mit
83
master
2,566
def stub_post_recaptcha_success stub_request( :get, "https://www.google.com/recaptcha/api/siteverify?secret=#{NewGoogleRecaptcha.secret_key}&response=" ).to_return( status: 200, body: { "success": true, "challenge_ts": "2018-12-31T15:36:25Z", "hostname": "localh...
github
igorkasyanchuk/new_google_recaptcha
https://github.com/igorkasyanchuk/new_google_recaptcha
lib/new_google_recaptcha.rb
Ruby
mit
83
master
1,518
require "new_google_recaptcha/railtie" module NewGoogleRecaptcha mattr_accessor :site_key mattr_accessor :secret_key mattr_accessor :minimum_score def self.setup yield(self) end def self.human?(token, action, minimum_score = self.minimum_score, model = nil) is_valid = NewGoogleRecaptcha::Va...
github
igorkasyanchuk/new_google_recaptcha
https://github.com/igorkasyanchuk/new_google_recaptcha
lib/generators/new_google_recaptcha_generator.rb
Ruby
mit
83
master
240
class NewGoogleRecaptchaGenerator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) def copy_initializer template 'new_google_recaptcha.rb', 'config/initializers/new_google_recaptcha.rb' end end
github
igorkasyanchuk/new_google_recaptcha
https://github.com/igorkasyanchuk/new_google_recaptcha
lib/new_google_recaptcha/validator.rb
Ruby
mit
83
master
799
require 'net/http' module NewGoogleRecaptcha class Validator attr_reader :score attr_reader :token, :action, :minimum_score def initialize(token:, action:, minimum_score:) @token = token @action = action @minimum_score = minimum_score end def call uri =...
github
igorkasyanchuk/new_google_recaptcha
https://github.com/igorkasyanchuk/new_google_recaptcha
lib/new_google_recaptcha/railtie.rb
Ruby
mit
83
master
251
module NewGoogleRecaptcha class Railtie < ::Rails::Railtie initializer 'new_google_recaptcha.helpers' do ActiveSupport.on_load :action_view do ActionView::Base.send :include, NewGoogleRecaptcha::ViewExt end end end end
github
igorkasyanchuk/new_google_recaptcha
https://github.com/igorkasyanchuk/new_google_recaptcha
lib/new_google_recaptcha/view_ext.rb
Ruby
mit
83
master
1,432
module NewGoogleRecaptcha module ViewExt include ActionView::Helpers::TagHelper def include_recaptcha_js(opts = {}) badge = opts[:badge] ? "&badge=#{opts[:badge]}" : "" generate_recaptcha_callback + javascript_include_tag( "https://www.google.com/recaptcha/api.js?render=#{NewGoo...
github
propublica/transcribable
https://github.com/propublica/transcribable
Rakefile
Ruby
mit
83
master
579
begin require 'bundler/setup' rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end require 'rdoc/task' RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' rdoc.title = 'Transcribable' rdoc.options << '--line-numbers' rdoc.rdoc_files.include('README.rdoc')...
github
propublica/transcribable
https://github.com/propublica/transcribable
transcribable.gemspec
Ruby
mit
83
master
815
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "transcribable/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "transcribable" s.version = Transcribable::VERSION s.authors = ["Al Shaw"] s.email = ["almsh...
github
propublica/transcribable
https://github.com/propublica/transcribable
Gemfile
Ruby
mit
83
master
538
source "https://rubygems.org" # Declare your gem's dependencies in transcribable.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec # Declare any dependencies that are still in development here instead o...
github
propublica/transcribable
https://github.com/propublica/transcribable
test/transcribable_test.rb
Ruby
mit
83
master
2,206
require 'test_helper' class TranscribableTest < ActiveSupport::TestCase test "truth" do assert_kind_of Module, Transcribable end test "transcribable table is set" do assert_equal "filings", Transcribable.table end test "transcribable attrs are set" do h = {"buyer"=>:string, "amount"=>:integer, ...
github
propublica/transcribable
https://github.com/propublica/transcribable
test/dummy/config/application.rb
Ruby
mit
83
master
887
require File.expand_path('../boot', __FILE__) require 'rails/all' Bundler.require(*Rails.groups) require "transcribable" module Dummy class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in con...
github
propublica/transcribable
https://github.com/propublica/transcribable
test/dummy/config/initializers/secret_token.rb
Ruby
mit
83
master
659
# Be sure to restart your server when you modify this file. # Your secret key is used for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to diction...
github
propublica/transcribable
https://github.com/propublica/transcribable
test/dummy/db/schema.rb
Ruby
mit
83
master
401
ActiveRecord::Schema.define(version: 20130710175855) do create_table "filings", force: true do |t| t.string "url" t.string "buyer" t.integer "amount" t.boolean "verified" t.text "notes" end create_table "transcriptions", force: true do |t| t.string "buyer" t.integer "amount" ...
github
propublica/transcribable
https://github.com/propublica/transcribable
test/dummy/app/models/transcription.rb
Ruby
mit
83
master
311
class Transcription < ActiveRecord::Base belongs_to :user belongs_to :filing Transcribable.transcribable_attrs.select {|k,v| [:integer, :float, :decimal].include?(v) }.keys.each do |k| define_method("#{k}=") do |val| write_attribute k.to_sym, val.to_s.gsub(/[^0-9\.]/,"").to_f end end end
github
propublica/transcribable
https://github.com/propublica/transcribable
lib/transcribable.rb
Ruby
mit
83
master
4,823
# adds to Filing require 'uuid' module Transcribable require 'transcribable/railtie' extend ActiveSupport::Concern mattr_accessor :table mattr_accessor :transcribable_attrs included do set_verification_threshhold end def self.table # transcribable_attrs() "discovers" the columns # and tabl...
github
propublica/transcribable
https://github.com/propublica/transcribable
lib/tasks/harvester.rake
Ruby
mit
83
master
1,421
namespace :transcribable do desc "Harvest documents to transcribe from DocumentCloud" task :harvest => :environment do require 'rest-client' klass = Kernel.const_get(Transcribable.table.classify) dc = YAML.load(File.read("#{Rails.root.to_s}/config/documentcloud.yml")) dc_project = JSON.parse(RestCli...
github
propublica/transcribable
https://github.com/propublica/transcribable
lib/generators/transcribable_generator.rb
Ruby
mit
83
master
1,883
require "rails/generators" require "rails/generators/active_record" require "transcribable" class TranscribableGenerator < ActiveRecord::Generators::Base include Transcribable desc "Generates transcriptions table" # to get around AR Generators requiring a NAME param argument :name, type: :string, default: 'r...
github
propublica/transcribable
https://github.com/propublica/transcribable
lib/generators/templates/model.rb
Ruby
mit
83
master
330
class Transcription < ActiveRecord::Base belongs_to :user belongs_to :<%= @table.singularize %> Transcribable.transcribable_attrs.select {|k,v| [:integer, :float, :decimal].include?(v) }.keys.each do |k| define_method("#{k}=") do |val| write_attribute k.to_sym, val.to_s.gsub(/[^0-9\.]/,"").to_f end...
github
propublica/transcribable
https://github.com/propublica/transcribable
lib/generators/templates/migration.rb
Ruby
mit
83
master
413
class CreateTranscriptionsTable < ActiveRecord::Migration def self.up create_table :transcriptions do |t| <% transcribable_attrs.each do |name, type| %> t.<%= type.to_s %> :<%= name %> <% end %> t.integer :<%= @table.singularize %>_id t.string :user_id # by default, this will be a ...
github
propublica/transcribable
https://github.com/propublica/transcribable
lib/generators/templates/migration_add_columns.rb
Ruby
mit
83
master
359
class <%= @migration_name.camelize %> < ActiveRecord::Migration def self.up <% new_columns.each do |name, type| %> add_column :transcriptions, :<%= name %>, :<%= type.to_s %> <% end %> end def self.down <% new_columns.each do |name, type| %> remove_column :transcriptions, :<%= name %>, :<...
github
propublica/transcribable
https://github.com/propublica/transcribable
lib/generators/templates/controller.rb
Ruby
mit
83
master
1,704
class TranscriptionsController < ActionController::Base layout "simple_frame" def new @<%= @table.singularize %> = <%= @table.classify %>.assign!(current_user) # if we're able to assign a filing # that the user hasn't done and hasn't been verified if @<%= @table.singularize %>.nil? redirect_t...
github
pepabo/furik
https://github.com/pepabo/furik
furik.gemspec
Ruby
mit
83
master
1,065
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'furik/version' Gem::Specification.new do |spec| spec.name = "furik" spec.version = Furik::VERSION spec.authors = ["linyows", "SHIBATA Hiroshi"] spec.email = [...
github
pepabo/furik
https://github.com/pepabo/furik
test/pull_requests_test.rb
Ruby
mit
83
master
1,327
require 'test_helper' class PullRequestsTest < Minitest::Test def test_all_repo_names stub_get 'user' stub_get 'user/repos?per_page=100' stub_get 'user/orgs?per_page=100' stub_get 'orgs/github/repos?per_page=100' instance = Furik::PullRequests.new(Furik.gh_client) assert_equal instance.all_r...
github
pepabo/furik
https://github.com/pepabo/furik
test/furik_test.rb
Ruby
mit
83
master
592
require 'test_helper' class FurikTest < Minitest::Test def test_that_it_has_a_version_number refute_nil ::Furik::VERSION end def test_gh_client_returns_octokit_client assert_equal Furik.gh_client.class, Octokit::Client end def test_ghe_client_returns_octokit_client assert_equal Furik.ghe_client...
github
pepabo/furik
https://github.com/pepabo/furik
test/test_helper.rb
Ruby
mit
83
master
874
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'furik' require 'minitest/autorun' require 'webmock/minitest' module Furik::Configurable class << self def token_by_pit(host = 'github.com') 'x' * 40 end end end ENV['GITHUB_ENTERPRISE_HOST'] = 'your.domain.com' def fixture_path ...
github
pepabo/furik
https://github.com/pepabo/furik
lib/furik.rb
Ruby
mit
83
master
1,202
require 'octokit' require 'furik/core_ext/string' require 'furik/configurable' require 'furik/pull_requests' require 'furik/events' require "furik/version" module Furik class << self def gh_client Octokit::Client.new Configurable.github_octokit_options end def ghe_client Octokit::Client.new ...
github
pepabo/furik
https://github.com/pepabo/furik
lib/furik/configurable.rb
Ruby
mit
83
master
1,780
require 'yaml' require 'pit' module Furik module Configurable class << self def hub_config_path ENV['HUB_CONFIG_PATH'] || "#{Dir.home}/.config/hub" end def token_generate_path '/settings/tokens/new' end def token_by_hub(host = 'github.com') return unless Fi...
github
pepabo/furik
https://github.com/pepabo/furik
lib/furik/pull_requests.rb
Ruby
mit
83
master
2,099
require 'octokit' module Furik class PullRequests def initialize(client) @client = client @login = client.login end def request_manager limit = @client.rate_limit if !limit.limit.zero? && limit.remaining.zero? puts "Oops! #{limit}" sleep limit.resets_in end ...
github
pepabo/furik
https://github.com/pepabo/furik
lib/furik/cli.rb
Ruby
mit
83
master
3,667
require "furik" require 'thor' module Furik class Cli < Thor desc 'pulls', 'show pull requests' method_option :gh, type: :boolean, aliases: '-g', default: true method_option :ghe, type: :boolean, aliases: '-l' method_option :start_date, type: :string, aliases: '-s' method_option :end_date, type: ...
github
pepabo/furik
https://github.com/pepabo/furik
lib/furik/events.rb
Ruby
mit
83
master
780
module Furik class Events def initialize(client) @client = client @login = client.login end def events_with_grouping(from, to, &block) @client.user_events(@login).each.with_object({}) { |event, memo| if event && aggressives.include?(event.type) if from <= event.created...
github
pepabo/furik
https://github.com/pepabo/furik
lib/furik/core_ext/string.rb
Ruby
mit
83
master
603
class String def underscore self.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr('-', '_'). downcase end def plain self.gsub("\r\n", ' ').gsub(/[\s\-_=]{2,}/, ' ').strip end def cut(size = 50, options = {}) text = self.dup o...
github
mattetti/mimetype-fu
https://github.com/mattetti/mimetype-fu
mimetype-fu.gemspec
Ruby
mit
83
master
1,540
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{mimetype-fu} s.version = "0.1.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Josh French"] s.date = %q{2009-06-24} s.description = %q{get the mimetype of a file dir...
github
mattetti/mimetype-fu
https://github.com/mattetti/mimetype-fu
Rakefile
Ruby
mit
83
master
1,467
require 'rake' require 'rake/testtask' require 'rake/rdoctask' require 'spec/rake/spectask' begin require 'jeweler' Jeweler::Tasks.new do |gem| gem.name = "mimetype-fu" gem.summary = "get the mimetype of a file directly in Ruby" gem.description = "get the mimetype of a file directly in Ruby" gem.em...