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
akm/schema_comments
https://github.com/akm/schema_comments
spec/migrations/005_change_products_name.rb
Ruby
mit
46
master
228
# -*- coding: utf-8 -*- class ChangeProductsName < ActiveRecord::Migration def self.up change_column "products", 'name', :string, :limit => 50 end def self.down change_column "products", 'name', :string end end
github
akm/schema_comments
https://github.com/akm/schema_comments
spec/migrations/009_rename_product_type_cd_to_category_cd.rb
Ruby
mit
46
master
326
# -*- coding: utf-8 -*- class RenameProductTypeCdToCategoryCd < ActiveRecord::Migration def self.up rename_column :products, :product_type_cd, :category_cd, comment: 'カテゴリーコード' end def self.down rename_column :products, :category_cd, :product_type_cd, comment: 'カテゴリコード' end end
github
akm/schema_comments
https://github.com/akm/schema_comments
spec/schema_comments/schema_dumper_spec.rb
Ruby
mit
46
master
3,401
# -*- coding: utf-8 -*- require File.join(File.dirname(__FILE__), '../spec_helper') describe ActiveRecord::SchemaDumper do let(:migration_path){ File.expand_path('../../migrations', __FILE__) } let(:ignored_tables){ %w(schema_migrations) } before(:each) do SchemaComments.yaml_path = File.expand_path(File.jo...
github
akm/schema_comments
https://github.com/akm/schema_comments
spec/schema_comments/schema_comment_spec.rb
Ruby
mit
46
master
3,646
# -*- coding: utf-8 -*- require File.join(File.dirname(__FILE__), '../spec_helper') describe SchemaComments::SchemaComment do let(:migration_path){ File.expand_path('../../migrations', __FILE__) } let(:ignored_tables){ %w(schema_migrations) } before(:each) do SchemaComments.yaml_path = File.expand_path(Fi...
github
akm/schema_comments
https://github.com/akm/schema_comments
spec/support/swap_output.rb
Ruby
mit
46
master
473
module SwapOutput module_function STDOUT_LOG_PATH = File.expand_path('../../../log/stdout.log', __FILE__) STDERR_LOG_PATH = File.expand_path('../../../log/stderr.log', __FILE__) def stdout $stdout, backup = open(STDOUT_LOG_PATH, 'a'), $stdout begin yield ensure $stdout = backup end...
github
akm/schema_comments
https://github.com/akm/schema_comments
spec/dummy/config/application.rb
Ruby
mit
46
master
1,274
require File.expand_path('../boot', __FILE__) # Pick the frameworks you want: require "active_record/railtie" require "action_controller/railtie" require "action_mailer/railtie" require "action_view/railtie" # require "sprockets/railtie" require "rails/test_unit/railtie" Bundler.require(*Rails.groups) require "schema...
github
shuber/svnignore
https://github.com/shuber/svnignore
Rakefile
Ruby
mit
46
master
845
require 'rubygems' require 'rake' require 'rake/testtask' Rake::TestTask.new(:test) do |test| test.libs << 'lib' << 'test' test.pattern = 'test/**/*_test.rb' test.verbose = true end begin require 'rcov/rcovtask' Rcov::RcovTask.new do |test| test.libs << 'test' test.pattern = 'test/**/*_test.rb' ...
github
shuber/svnignore
https://github.com/shuber/svnignore
svnignore.gemspec
Ruby
mit
46
master
1,558
Gem::Specification.new do |s| s.name = %q{svnignore} s.version = "0.0.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Sean Huber"] s.date = %q{2010-01-22} s.default_executable = %q{svnignore} s.description = %q{git style ignores wit...
github
shuber/svnignore
https://github.com/shuber/svnignore
test/test_helper.rb
Ruby
mit
46
master
1,592
require 'rubygems' require 'test/unit' require 'shoulda' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'svnignore' Svnignore.class_eval do def self.execute(command = nil) @commands ||= [] @commands << command unless command.nil? @co...
github
shuber/svnignore
https://github.com/shuber/svnignore
test/svnignore_test.rb
Ruby
mit
46
master
1,508
require 'test_helper' class SvnignoreTest < Test::Unit::TestCase should 'have a TEMPFILE_PREFIX' do assert Svnignore.const_defined?('TEMPFILE_PREFIX') assert !Svnignore::TEMPFILE_PREFIX.nil? assert !Svnignore::TEMPFILE_PREFIX.empty? end should 'parse the correct ignore rules from file' do ass...
github
shuber/svnignore
https://github.com/shuber/svnignore
lib/svnignore.rb
Ruby
mit
46
master
2,583
require 'tempfile' class Svnignore TEMPFILE_PREFIX = 'svnignore-' def self.default_options @default_options ||= { :file => '.svnignore', :recursive => true } end def self.ignore(current_working_directory, options = {}) options = default_options.merge(options) files = find_files_with_ignore...
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
Guardfile
Ruby
mit
46
master
257
# A sample Guardfile # More info at https://github.com/guard/guard#readme guard 'rspec', cmd: "bundle exec rspec" do watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } watch(%r{^spec/(.+)\.rb$}) watch('spec/spec_helper.rb') { "spec" } end
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
echonest-ruby-api.gemspec
Ruby
mit
46
master
1,163
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'echonest-ruby-api/version' Gem::Specification.new do |gem| gem.name = "echonest-ruby-api" gem.version = Echonest::VERSION gem.authors = ["Max Woolf"] gem.em...
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
Gemfile
Ruby
mit
46
master
231
source 'https://rubygems.org' # Specify your gem's dependencies in echonest-ruby-api.gemspec gemspec gem 'rake' group :development, :test do gem 'rspec' gem 'mocha', require: 'mocha/api' gem 'simplecov', require: false end
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
lib/echonest-ruby-api.rb
Ruby
mit
46
master
231
require "echonest-ruby-api/version" require 'echonest-ruby-api/artist' require 'echonest-ruby-api/song' require 'echonest-ruby-api/error' require 'echonest-ruby-api/playlist' require 'echonest-ruby-api/genre' module Echonest end
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
lib/echonest-ruby-api/playlist.rb
Ruby
mit
46
master
687
require "rubygems" require "bundler/setup" require_relative 'base' module Echonest class Playlist < Echonest::Base def initialize(api_key, artist) @api_key = api_key @artist = artist @type = 'artist-radio' response = get('playlist/dynamic/create', { artist: @artist, type: @t...
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
lib/echonest-ruby-api/base.rb
Ruby
mit
46
master
2,520
require 'httparty' require 'multi_json' module Echonest class Base class EchonestConnectionError < Exception; end def initialize(api_key) @api_key = api_key @base_uri = "http://developer.echonest.com/api/v4/" end def get_response(options = {}) get(endpoint, options) end d...
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
lib/echonest-ruby-api/song.rb
Ruby
mit
46
master
1,761
require "rubygems" require "bundler/setup" require 'httparty' require 'multi_json' require_relative 'base' module Echonest class Song < Echonest::Base def initialize(api_key) @api_key = api_key end def search(options = {}) defaults = { api_key: @api_key } response = get_response(optio...
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
lib/echonest-ruby-api/video.rb
Ruby
mit
46
master
311
module Echonest class Video attr_accessor :title, :site, :url, :date_found, :image_url def initialize(options = {}) @title = options[:title] @site = options[:site] @url = options[:url] @date_found = options[:date_found] @image_url = options[:image_url] end end end
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
lib/echonest-ruby-api/foreign_id.rb
Ruby
mit
46
master
427
module Echonest class ForeignId attr_accessor :catalog, :foreign_id, :catalog_id def initialize(options = {}) @catalog = options[:catalog] @foreign_id = options[:foreign_id] @catalog_id = foreign_id.split(":").last end def self.parse_array(array = []) foreign_ids = [] ...
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
lib/echonest-ruby-api/blog.rb
Ruby
mit
46
master
269
module Echonest class Blog attr_accessor :name, :summary, :url, :date_posted def initialize(options = {}) @name = options[:name] @summary = options[:summary] @url = options[:url] @date_posted = options[:date_posted] end end end
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
lib/echonest-ruby-api/artist.rb
Ruby
mit
46
master
3,951
require "rubygems" require "bundler/setup" require_relative 'base' require_relative 'blog' require_relative 'biography' require_relative 'video' require_relative 'foreign_id' module Echonest class Artist < Echonest::Base attr_accessor :id, :name, :foreign_ids def initialize(api_key, name = nil, foreign_id...
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
lib/echonest-ruby-api/genre.rb
Ruby
mit
46
master
724
require 'rubygems' require 'bundler/setup' require_relative 'base' module Echonest class Genre < Echonest::Base attr_accessor :name def initialize(api_key, name = nil) @api_key = api_key @name = name end def artists(options = {}) get_response(options.merge(name: @name)) end ...
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
lib/echonest-ruby-api/error.rb
Ruby
mit
46
master
945
module Echonest class Error < Exception attr_reader :error_code, :response ERRORS = { '-1' => 'Unknown Error', '0' => 'Success', '1' => 'Invalid/Missing API Key', '2' => 'This API key is not allowed to call that method', '3' => 'Rate limit exceeded...
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
lib/echonest-ruby-api/biography.rb
Ruby
mit
46
master
209
module Echonest class Biography attr_accessor :text, :site, :url def initialize(options = {}) @text = options[:text] @site = options[:site] @url = options[:url] end end end
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
spec/spec_helper.rb
Ruby
mit
46
master
537
require 'simplecov' SimpleCov.start require 'rubygems' require 'bundler/setup' require_relative '../lib/echonest-ruby-api/base.rb' require 'echonest-ruby-api' require 'vcr' require 'webmock/rspec' require 'coveralls' #require 'mocha/api' Coveralls.wear! RSpec.configure do |config| config.mock_with :mocha end VCR.c...
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
spec/playlist_spec.rb
Ruby
mit
46
master
1,067
require 'spec_helper' describe Echonest::Playlist do describe '#initialize' do it 'should iniaitlize with an API key and an artist ' do VCR.use_cassette('playlist') do seed = Echonest::Playlist.new('BNOAEBT3IZYZI6WXI', 'Weezer') seed.should be end end end describe '#sessio...
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
spec/song_spec.rb
Ruby
mit
46
master
4,526
require 'spec_helper' require 'mocha/setup' describe Echonest::Song do it 'should initialize correct' do a = Echonest::Song.new('abc234') a.should be_a Echonest::Song end describe "#profile" do it "should return the song for a given id" do VCR.use_cassette('song_profile') do a = Echon...
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
spec/artist_spec.rb
Ruby
mit
46
master
10,108
require 'spec_helper' describe Echonest::Artist do def create_valid_artist @a = Echonest::Artist.new('BNOAEBT3IZYZI6WXI', 'Weezer') end def create_valid_artist_with_id @a = Echonest::Artist.new('BNOAEBT3IZYZI6WXI', nil, nil, 'ARH6W4X1187B99274F') end it 'should allow an Artist to have a name' do ...
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
spec/foreign_id_spec.rb
Ruby
mit
46
master
549
require 'spec_helper' describe Echonest::ForeignId do it 'should parse the catalog id' do foreign_id = Echonest::ForeignId.new(catalog: "musicbrainz", foreign_id: "musicbrainz:artist:6fe07aa5-fec0-4eca-a456-f29bff451b04") foreign_id.catalog_id.should eq("6fe07aa5-fec0-4eca-a456-f29bff451b04") end ...
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
spec/error_spec.rb
Ruby
mit
46
master
380
require 'spec_helper' describe Echonest::Error do describe '#initialize' do it 'should accept an error code as the only parameter' do err = Echonest::Error.new(3) end end describe '#description' do it 'should return the errors description' do err = Echonest::Error.new(5) err.de...
github
maxehmookau/echonest-ruby-api
https://github.com/maxehmookau/echonest-ruby-api
spec/genre_spec.rb
Ruby
mit
46
master
2,301
require 'spec_helper' describe Echonest::Genre do it 'should accept name for creation' do g = Echonest::Genre.new('BNOAEBT3IZYZI6WXI', 'folk rock') expect(g.name).to eq 'folk rock' end describe 'instance methods' do context 'with valid api key and name' do before :all do @genre = Echo...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
owasp-esapi-ruby.gemspec
Ruby
bsd-3-clause
46
master
6,973
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{owasp-esapi-ruby} s.version = "0.30.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :requi...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
Rakefile
Ruby
bsd-3-clause
46
master
1,892
require 'rubygems' require 'rake' begin require 'jeweler' Jeweler::Tasks.new do |gem| gem.name = "owasp-esapi-ruby" gem.summary = %Q{Owasp Enterprise Security APIs for Ruby language} gem.description = File.read(File.join(File.dirname(__FILE__), 'README')) gem.email = "thesp0nge@owasp.org" gem.v...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/file_scanner.rb
Ruby
bsd-3-clause
46
master
611
module Owasp module Esapi # FileScanner # This is class is unique to Esapi for Ruby # Users should developer thier own scanner class and configure esapi with the implmentation # The purpose of this class is to scan a file for encoding/viruses/etc # child classes only need to implment the scan meth...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/intrustion_detector.rb
Ruby
bsd-3-clause
46
master
1,128
module Owasp module Esapi class IntrustionDetector def add_exception(exception) return unless Esapi.security_config.ids? if exception.is_a?(EnterpriseSecurityException) # log a security failure warning, with th log message and exception else # log a security fail...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/validator.rb
Ruby
bsd-3-clause
46
master
13,991
require 'validator/validator_error_list' require 'validator/base_rule' require 'validator/string_rule' require 'validator/date_rule' require 'validator/integer_rule' require 'validator/float_rule' require 'validator/html_rule' module Owasp module Esapi module Validator # Encoder to use for the validator ...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/exceptions.rb
Ruby
bsd-3-clause
46
master
1,254
# Various exception used by Esapi module Owasp module Esapi # Base Exception class for SecurityExceptions class EnterpriseSecurityException < Exception attr_reader :log_message, :cause def initialize(user_msg, log_msg,cause) super(user_msg) @log_message = log_msg @cause = ...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/esapi.rb
Ruby
bsd-3-clause
46
master
2,197
# # Class loading mechanism, we use this to create new instances of objects based # on config data. This allows a user to set their own config for instance to use thier # own implmentation of a given class. ClassLoader based on Rails constantize # class ClassLoader def self.load_class(class_name) # we are using r...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/executor.rb
Ruby
bsd-3-clause
46
master
472
# Executor implmentation # # Provide a safe execute command, that wll ensure paths and args are escaped properly # and check for expansions of the command # module Owasp module Esapi # Executor class class Executor # Wrapper for Process#spawn # it sanitizes the parames and validates paths before...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/validator/html_rule.rb
Ruby
bsd-3-clause
46
master
2,717
require 'antisamy' module Owasp module Esapi module Validator # A validator performs syntax and possibly semantic validation of a single # piece of data from an untrusted source. This rule invokes AntiSamy sanitization class HTMLRule < BaseRule # Setup the HTML rule def initial...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/validator/validator_error_list.rb
Ruby
bsd-3-clause
46
master
1,333
module Owasp module Esapi module Validator # List of Validation exceptions # this list is indexed by the context class ValidatorErrorList # Create a new list def initialize() @errors = {} end # Add an error to the list. We will raise ArgumentException ...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/validator/float_rule.rb
Ruby
bsd-3-clause
46
master
2,819
module Owasp module Esapi module Validator class FloatRule < BaseRule attr_accessor :min, :max def initialize(type,encoder=nil,min=nil,max=nil) super(type,encoder) @min = min @max = max @min = Float::MIN if min.nil? @max = Float::MAX if max....
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/validator/base_rule.rb
Ruby
bsd-3-clause
46
master
2,804
# Expand Integer to add Min and Max values class Integer #:nodoc: N_BYTES = [42].pack('i').size N_BITS = N_BYTES * 8 MAX = 2 ** (N_BITS - 2) - 1 MIN = -MAX - 1 end module Owasp module Esapi module Validator # A ValidationRule performs syntax and possibly semantic validation of a single # pie...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/validator/date_rule.rb
Ruby
bsd-3-clause
46
master
3,364
require 'date' # DateTime now has a to_time method injected in class DateTime def to_time self.offset == 0 ? ::Time.utc(year, month, day, hour, min, sec) : self end end module Owasp module Esapi module Validator # A validator performs syntax and possibly semantic validation of a single # pi...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/validator/string_rule.rb
Ruby
bsd-3-clause
46
master
5,410
require 'stringio' module Owasp module Esapi module Validator # A validator performs syntax and possibly semantic validation of a single # piece of string data from an untrusted source. class StringRule < BaseRule attr_writer :min,:max,:canonicalize # Create an instance of the...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/validator/integer_rule.rb
Ruby
bsd-3-clause
46
master
2,158
module Owasp module Esapi module Validator class IntegerRule < BaseRule attr_accessor :min, :max def initialize(type,encoder=nil,min=nil,max=nil) super(type,encoder) @min = min @max = max @min = Integer::MIN if min.nil? @max = Integer::MAX i...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/codec/pushable_string.rb
Ruby
bsd-3-clause
46
master
3,061
# The pushback string is used by Codecs to allow them to push decoded characters back onto a string # for further decoding. This is necessary to detect double-encoding. module Owasp module Esapi module Codec class PushableString attr :index # # Setup a pushable string # str...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/codec/os_codec.rb
Ruby
bsd-3-clause
46
master
2,205
require 'rbconfig' # Operating system codec for escape characters for HOST commands # We look at Unix style (max, linux) and Windows style module Owasp module Esapi module Codec class OsCodec < BaseCodec # Window Host flag WINDOWS_HOST = :Windows # Unix Host flag UNIX_HOST =...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/codec/html_codec.rb
Ruby
bsd-3-clause
46
master
11,457
# Implementation of the Codec interface for HTML entity encoding. module Owasp module Esapi module Codec class HtmlCodec < BaseCodec def initialize @longest_key = 0 @lookup_map = {} ENTITY_MAP.each_key do |k| if k.size > @longest_key @longest_k...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/codec/percent_codec.rb
Ruby
bsd-3-clause
46
master
1,375
# Implementation of the Codec interface for percent encoding (aka URL encoding). module Owasp module Esapi module Codec class PercentCodec < BaseCodec # Encode a character for URLs def encode_char(immune,input) return input if input =~ /[a-zA-Z0-9_.-]/ # RFC compliance ...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/codec/mysql_codec.rb
Ruby
bsd-3-clause
46
master
3,751
# # Codec to provide for MySQL string support # http://mirror.yandex.ru/mirrors/ftp.mysql.com/doc/refman/5.0/en/string-syntax.html for details module Owasp module Esapi module Codec class MySQLCodec < BaseCodec MYSQL_MODE = 0 # MySQL standard mode ANSI_MODE = 1; # ANSI escape mode ...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/codec/javascript_codec.rb
Ruby
bsd-3-clause
46
master
3,792
module Owasp module Esapi module Codec class JavascriptCodec < BaseCodec # Returns backslash encoded numeric format. Does not use backslash character escapes # such as, \" or \' as these may cause parsing problems. For example, if a javascript # attribute, such as onmouseover, conta...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/codec/xml_codec.rb
Ruby
bsd-3-clause
46
master
4,992
# Implementation of the Codec interface for XML entity encoding. # This differes from HTML entity encoding in that only the following # named entities are predefined: # * lt # * gt # * amp # * apos # * quot # # However, the XML Specification 1.0 states in section 4.6 "Predefined # Entities" that these should still be d...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/codec/vbscript_codec.rb
Ruby
bsd-3-clause
46
master
1,997
# Implementation of the Codec interface for 'quote' encoding from VBScript. module Owasp module Esapi module Codec class VbScriptCodec < BaseCodec # Encode a String so that it can be safely used in a specific context. def encode(immune, input) encoded_string = '' encodin...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/codec/base_codec.rb
Ruby
bsd-3-clause
46
master
2,952
# The Codec interface defines a set of methods for encoding and decoding application level encoding schemes, # * such as HTML entity encoding and percent encoding (aka URL encoding). Codecs are used in output encoding # * and canonicalization. The design of these codecs allows for character-by-character decoding, whic...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/codec/oracle_codec.rb
Ruby
bsd-3-clause
46
master
1,290
# # Codec to provide for Oracle string support # see http://oraqa.com/2006/03/20/how-to-escape-single-quotes-in-strings for details # This will only prevent SQLinjection in the case of user data being placed within an # Oracle quoted string such as select * from table where field = ' USERDATA ' module Owasp module Es...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/codec/css_codec.rb
Ruby
bsd-3-clause
46
master
6,038
# # Implementation of the Codec interface for backslash encoding used in CSS. module Owasp module Esapi module Codec class CssCodec < BaseCodec # Returns backslash encoded character. def encode_char(immune, input) # check immune return input if immune.include?(input) ...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
lib/codec/encoder.rb
Ruby
bsd-3-clause
46
master
14,655
# The Encoder interface contains a number of methods for decoding input and encoding output # so that it will be safe for a variety of interpreters. To prevent # double-encoding, callers should make sure input does not already contain encoded characters # by calling canonicalize. Validator implementations should call c...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
spec/owasp_esapi_encoder_spec.rb
Ruby
bsd-3-clause
46
master
7,486
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') module Owasp module Esapi describe Encoder do # Setup some encoders let (:encoder) { Owasp::Esapi.encoder } let (:jsencoder) {Owasp::Esapi::Encoder.new([Owasp::Esapi::Codec::JavascriptCodec.new])} let (:cssencoder) {Owasp::...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
spec/owasp_esapi_validator_spec.rb
Ruby
bsd-3-clause
46
master
9,305
module Owasp module Esapi describe Validator do let(:validator) { Owasp::Esapi::Validator} let(:allow_null) { false } before do # Global HTTP Validation Rules # Values with Base64 encoded data (e.g. encrypted state) will need at least [a-zA-Z0-9\/+=] { "Account...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
spec/spec_helper.rb
Ruby
bsd-3-clause
46
master
342
$LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'owasp-esapi-ruby' require 'rspec' require 'rspec/autorun' Owasp::Esapi.security_config.resources["antisamy"] = "#{File.dirname(__FILE__)}/antisamy-esapi.xml" RSpec.configure do |config| config.col...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
spec/codec/oracle_codec_spec.rb
Ruby
bsd-3-clause
46
master
585
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') module Owasp module Esapi module Codec describe OracleCodec do let (:codec) { Owasp::Esapi::Codec::OracleCodec.new } it "should encode eddie's stuff as eddie''s stuff" do codec.encode([],"eddie's stuff").shoul...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
spec/codec/xml_codec_spec.rb
Ruby
bsd-3-clause
46
master
3,046
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') module Owasp module Esapi module Codec describe XmlCodec do let (:codec) { Owasp::Esapi::Codec::XmlCodec.new } describe 'XML encoding' do it "should encode nil as nil" do codec.encode([],nil).should...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
spec/codec/os_codec_spec.rb
Ruby
bsd-3-clause
46
master
1,729
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') module Owasp module Esapi module Codec describe OsCodec do let(:unix_codec) {Owasp::Esapi::Codec::OsCodec.new( Owasp::Esapi::Codec::OsCodec::UNIX_HOST)} let(:win_codec) {Owasp::Esapi::Codec::OsCodec.new( Owasp::Esapi::Co...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
spec/codec/css_codec_spec.rb
Ruby
bsd-3-clause
46
master
1,576
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') module Owasp module Esapi module Codec describe CssCodec do let (:codec) { Owasp::Esapi::Codec::CssCodec.new } it "should encode my '<' as \\3c" do m = codec.encode([],"<") m.should == '\\3c ' ...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
spec/codec/javascript_codec_spec.rb
Ruby
bsd-3-clause
46
master
1,418
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') module Owasp module Esapi module Codec describe JavascriptCodec do let (:codec) { Owasp::Esapi::Codec::JavascriptCodec.new } it "should decode \\x3c as <" do codec.decode("\\x3c").should == "<" end ...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
spec/codec/mysql_codec_spec.rb
Ruby
bsd-3-clause
46
master
1,390
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') module Owasp module Esapi module Codec describe MySQLCodec do let (:ansi_codec) { Owasp::Esapi::Codec::MySQLCodec.new(Owasp::Esapi::Codec::MySQLCodec::ANSI_MODE) } let (:mysql_codec) { Owasp::Esapi::Codec::MySQLCodec.new...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
spec/codec/percent_codec_spec.rb
Ruby
bsd-3-clause
46
master
891
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') # percent encode aka URL encoding module Owasp module Esapi module Codec describe PercentCodec do let (:codec) { Owasp::Esapi::Codec::PercentCodec.new } it "should decode %3c as <" do codec.decode("%3c").shoul...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
spec/codec/html_codec_spec.rb
Ruby
bsd-3-clause
46
master
2,486
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') module Owasp module Esapi module Codec describe HtmlCodec do let (:codec) { Owasp::Esapi::Codec::HtmlCodec.new } it "should not change test" do codec.encode([],"test").should == "test" end it ...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
spec/codec/vbcript_codec_spec.rb
Ruby
bsd-3-clause
46
master
602
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') module Owasp module Esapi module Codec describe VbScriptCodec do let (:codec) { Owasp::Esapi::Codec::VbScriptCodec.new } it "should encode < as chrw(60)" do codec.encode([],"<").should == "chrw(60)" end...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
spec/validator/html_rule_spec.rb
Ruby
bsd-3-clause
46
master
1,520
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') module Owasp module Esapi module Validator describe HTMLRule do let(:rule) {Owasp::Esapi::Validator::HTMLRule.new("test")} it "shuld clean out unsafe HTML" do rule.valid("test","Test. <script>alert(document.co...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
spec/validator/integer_rule_spec.rb
Ruby
bsd-3-clause
46
master
1,864
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') module Owasp module Esapi module Validator describe IntegerRule do it "should validate 89745 as valid within range of 0 to 1000000" do rule = Owasp::Esapi::Validator::IntegerRule.new("test",nil,0,10000000) r...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
spec/validator/float_rule_spec.rb
Ruby
bsd-3-clause
46
master
1,081
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') module Owasp module Esapi module Validator describe FloatRule do it "should validate 4.3214 as valid within range of -10 to 10" do rule = Owasp::Esapi::Validator::FloatRule.new("test",nil,-10,10) rule.valid?...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
spec/validator/date_rule_spec.rb
Ruby
bsd-3-clause
46
master
1,262
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') module Owasp module Esapi module Validator describe DateRule do let(:rule) {Owasp::Esapi::Validator::DateRule.new("test",nil,nil)} it "should validate September 11, 2001 as a valid" do rule.valid?("","Septembe...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
spec/validator/string_rule_spec.rb
Ruby
bsd-3-clause
46
master
3,538
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') module Owasp module Esapi module Validator describe StringRule do let(:rule) {Owasp::Esapi::Validator::StringRule.new("test")} # We will reset teh rule before every test so previous white/blacklist entries dont affect th...
github
thesp0nge/owasp-esapi-ruby
https://github.com/thesp0nge/owasp-esapi-ruby
spec/validator/base_rule_spec.rb
Ruby
bsd-3-clause
46
master
905
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper') module Owasp module Esapi module Validator describe BaseRule do let(:rule) {Owasp::Esapi::Validator::BaseRule.new("test")} it "should remove non whitelist characters" do rule.whitelist("12345abcdefghijkmlaaaa",...
github
joshwlewis/validates_by_schema
https://github.com/joshwlewis/validates_by_schema
validates_by_schema.gemspec
Ruby
mit
46
master
1,512
$LOAD_PATH.push File.expand_path('lib', __dir__) # Maintain your gem's version: require 'validates_by_schema/version' # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = 'validates_by_schema' s.version = ValidatesBySchema::VERSION s.authors = ['Josh Lewis', 'P...
github
joshwlewis/validates_by_schema
https://github.com/joshwlewis/validates_by_schema
Rakefile
Ruby
mit
46
master
1,316
#!/usr/bin/env rake begin require 'bundler/setup' rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end begin require 'rdoc/task' rescue LoadError require 'rdoc/rdoc' require 'rake/rdoctask' RDoc::Task = Rake::RDocTask end RDoc::Task.new(:rdoc) do |rdoc| rdoc.r...
github
joshwlewis/validates_by_schema
https://github.com/joshwlewis/validates_by_schema
lib/validates_by_schema.rb
Ruby
mit
46
master
1,952
require 'active_support/concern' require 'active_support/lazy_load_hooks' module ValidatesBySchema autoload :ValidationOption, 'validates_by_schema/validation_option' extend ActiveSupport::Concern mattr_accessor :validate_uniqueness self.validate_uniqueness = true module ClassMethods def validates_by...
github
joshwlewis/validates_by_schema
https://github.com/joshwlewis/validates_by_schema
lib/validates_by_schema/validation_option.rb
Ruby
mit
46
master
3,248
class ValidatesBySchema::ValidationOption # column here must be an ActiveRecord column # i.e. MyARModel.columns.first attr_accessor :klass, :column, :unique_indexes def initialize(klass, column, unique_indexes = []) @klass = klass @column = column @unique_indexes = unique_indexes.select { |index| i...
github
joshwlewis/validates_by_schema
https://github.com/joshwlewis/validates_by_schema
spec/spec_helper.rb
Ruby
mit
46
master
2,241
ENV['RAILS_ENV'] ||= 'test' require 'yaml' require 'active_record' require 'shoulda-matchers' require 'simplecov' SimpleCov.start do if ENV['CI'] require 'simplecov-lcov' SimpleCov::Formatter::LcovFormatter.config do |c| c.report_with_single_file = true c.single_report_path = 'coverage/lcov.inf...
github
joshwlewis/validates_by_schema
https://github.com/joshwlewis/validates_by_schema
spec/validations_spec.rb
Ruby
mit
46
master
11,348
require 'spec_helper' describe 'validates by schema' do let(:attributes) do { name: 'Secret', model: 'secret-42', description: 'Life, the Universe, Everything', wheels: 4, doors: 2, price: 4242.42, cost: 42.42, completion: 0.424, rating: 42.4242, score:...
github
joshwlewis/validates_by_schema
https://github.com/joshwlewis/validates_by_schema
spec/config/schema.rb
Ruby
mit
46
master
2,244
# 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
monzo/mondo-ruby
https://github.com/monzo/mondo-ruby
Gemfile
Ruby
mit
46
master
269
source 'https://rubygems.org' gemspec group :development, :test do gem "guard", "~> 0.8.8" gem "rspec", "~> 3.1" if RUBY_PLATFORM.downcase.include?("darwin") gem "guard-rspec", "~> 0.5.4" gem "rb-fsevent", "~> 0.9" gem "growl", "~> 1.0.3" end end
github
monzo/mondo-ruby
https://github.com/monzo/mondo-ruby
Rakefile
Ruby
mit
46
master
2,090
require 'yard' require 'rspec/core/rake_task' desc "Generate YARD documentation" YARD::Rake::YardocTask.new do |t| files = ['lib/**/*.rb', '-', 'CHANGELOG.md', 'LICENSE'] t.files = files.reject { |f| f =~ /seed|example/ } end desc "Run an IRB session with mondo pre-loaded" task :console do exec "irb -I lib -r m...
github
monzo/mondo-ruby
https://github.com/monzo/mondo-ruby
mondo.gemspec
Ruby
mit
46
master
919
require File.expand_path('../lib/mondo/version', __FILE__) Gem::Specification.new do |gem| gem.add_runtime_dependency 'oauth2', '~> 1.0' gem.add_runtime_dependency 'money' gem.add_runtime_dependency 'multi_json', '~> 1.10' gem.add_runtime_dependency 'activesupport', '~> 4.1.11' gem.add_development_dependenc...
github
monzo/mondo-ruby
https://github.com/monzo/mondo-ruby
Guardfile
Ruby
mit
46
master
256
guard 'rspec', :version => 2, :cli => '--color --format doc' do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/mondo/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } watch('lib/mondo.rb') { "spec/mondo_spec.rb" } watch('spec/spec_helper.rb') { "spec" } end
github
monzo/mondo-ruby
https://github.com/monzo/mondo-ruby
spec/client_spec.rb
Ruby
mit
46
master
489
require 'spec_helper' describe Mondo do describe 'Client' do describe '#request' do it "should not throw an error when opts param are supplied" do client = Mondo::Client.new(token: "token", account_id: "id") resp = instance_double(Faraday::Response, body: '', status: 200) allow(clie...
github
monzo/mondo-ruby
https://github.com/monzo/mondo-ruby
lib/mondo.rb
Ruby
mit
46
master
446
module Mondo require 'mondo/client' require 'mondo/version' require 'mondo/response' require 'mondo/resource' require 'mondo/errors' require 'mondo/utils' require 'mondo/transaction' require 'mondo/feed_item' require 'mondo/card' require 'mondo/balance' require 'mondo/address' require 'mondo/...
github
monzo/mondo-ruby
https://github.com/monzo/mondo-ruby
lib/mondo/card.rb
Ruby
mit
46
master
496
module Mondo class Card < Resource attr_accessor :id, :processor_token, :processor, :account_id, :last_digits, :name, :expires, :status date_accessor :created def active? status == 'ACTIVE' end def freeze self.client.api_put("/card/toggle", { card_id: id, ...
github
monzo/mondo-ruby
https://github.com/monzo/mondo-ruby
lib/mondo/response.rb
Ruby
mit
46
master
583
module Mondo class Response attr_reader :response, :parsed attr_accessor :error, :options # Initializes a Response instance # # @param [Faraday::Response] response The Faraday response instance def initialize(resp) @response = resp @parsed = -> { MultiJson.load(body) rescue body }...
github
monzo/mondo-ruby
https://github.com/monzo/mondo-ruby
lib/mondo/utils.rb
Ruby
mit
46
master
263
require 'uri' module Mondo module Utils extend self # String Helpers def camelize(str) str.split('_').map(&:capitalize).join end def underscore(str) str.gsub(/(.)([A-Z])/) { "#{$1}_#{$2.downcase}" }.downcase end end end
github
monzo/mondo-ruby
https://github.com/monzo/mondo-ruby
lib/mondo/resource.rb
Ruby
mit
46
master
1,121
module Mondo class Resource attr_accessor :client, :raw_data def initialize(hash={}, client) self.raw_data = hash self.client = client hash.each { |key,val| send("#{key}=", val) if respond_to?("#{key}=") } self.to_s end def to_s "#<#{self.class} #{raw_data}>" end ...
github
monzo/mondo-ruby
https://github.com/monzo/mondo-ruby
lib/mondo/attachment.rb
Ruby
mit
46
master
605
module Mondo class Attachment < Resource attr_accessor :id, :user_id, :external_id, :file_url, :file_type, :url, :type date_accessor :created def register raise ClientError.new("You have already registered this attachment") unless self.id.nil? self.client.api_post("attachment/register", reg...
github
monzo/mondo-ruby
https://github.com/monzo/mondo-ruby
lib/mondo/web_hook.rb
Ruby
mit
46
master
273
module Mondo class WebHook < Resource attr_accessor :id, :account_id, :url def save self.client.api_post("webhooks", account_id: account_id, url: url) end def delete self.client.api_delete("webhooks/#{self.id}") true end end end
github
monzo/mondo-ruby
https://github.com/monzo/mondo-ruby
lib/mondo/errors.rb
Ruby
mit
46
master
996
require 'multi_json' module Mondo class Error < StandardError end class ApiError < Error attr_reader :response, :code, :description def initialize(response) @response = response @code = response.status puts response.inspect begin parsed_response = MultiJson.decode(resp...
github
monzo/mondo-ruby
https://github.com/monzo/mondo-ruby
lib/mondo/merchant.rb
Ruby
mit
46
master
293
module Mondo class Merchant < Resource attr_accessor :id, :group_id, :logo, :name, :raw_data, :address, :emoji boolean_accessor :online, :is_load, :settled date_accessor :created def address ::Mondo::Address.new(raw_data['address'], self.client) end end end
github
monzo/mondo-ruby
https://github.com/monzo/mondo-ruby
lib/mondo/transaction.rb
Ruby
mit
46
master
1,762
module Mondo class Transaction < Resource attr_accessor :id, :description, :notes, :metadata, :is_load, :category, :settled, :decline_reason date_accessor :created date_accessor :settled def declined? raw_data['decline_reason'].present? end d...
github
monzo/mondo-ruby
https://github.com/monzo/mondo-ruby
lib/mondo/balance.rb
Ruby
mit
46
master
275
module Mondo class Balance < Resource def balance Money.new(raw_data['balance'], currency) end def spent_today Money.new(raw_data['spent_today'], currency) end def currency Money::Currency.new(raw_data['currency']) end end end