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
danielw/opinion
https://github.com/danielw/opinion
test/functional/legacy_routes_controller_test.rb
Ruby
mit
18
master
513
require File.dirname(__FILE__) + '/../test_helper' require 'legacy_routes_controller' # Re-raise errors caught by the controller. class LegacyRoutesController; def rescue_action(e) raise e end; end class LegacyRoutesControllerTest < ActionController::TestCase def setup @controller = LegacyRoutesController.new ...
github
danielw/opinion
https://github.com/danielw/opinion
db/schema.rb
Ruby
mit
18
master
2,690
# 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 data...
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/001_new_initial_tables.rb
Ruby
mit
18
master
778
class NewInitialTables < ActiveRecord::Migration def self.up create_table(:posts) do |t| t.column 'category_id', :integer t.column 'title', :string t.column 'body', :text t.column 'body_html', :text t.column 'user_id', :integer t.column 'created_at', :datetime t.column '...
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/20090907173425_add_sane_indexes.rb
Ruby
mit
18
master
499
class AddSaneIndexes < ActiveRecord::Migration def self.up add_index :users, :email add_index :categories, :access_level add_index :posts, [:parent_id, :type] add_index :posts, :created_at add_index :posts, [:category_id, :type] end def self.down remove_index :posts, [:parent_id...
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/031_create_images.rb
Ruby
mit
18
master
508
class CreateImages < ActiveRecord::Migration def self.up create_table :images do |t| t.column :parent_id, :integer t.column :post_id, :integer t.column :content_type, :string t.column :filename, :string t.column :thumbnail, :string t.column :size, :integer t.column :...
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/016_add_entries_for_files.rb
Ruby
mit
18
master
233
class AddEntriesForFiles < ActiveRecord::Migration def self.up create_table(:entries) do |t| t.column 'image', :string t.column 'post_id', :integer end end def self.down drop_table(:entries) end end
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/029_change_category_description_from_string_to_text.rb
Ruby
mit
18
master
405
class ChangeCategoryDescriptionFromStringToText < ActiveRecord::Migration def self.up change_column 'categories', 'body', :text change_column 'categories', 'body_html', :text change_column 'forums', 'body', :text end def self.down change_column 'categories', 'body', :string change_column 'cat...
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/018_rename_post_to_topic_id.rb
Ruby
mit
18
master
209
class RenamePostToTopicId < ActiveRecord::Migration def self.up rename_column 'attachments', 'post_id', 'topic_id' end def self.down rename_column 'attachments', 'topic_id', 'post_id' end end
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/011_add_index.rb
Ruby
mit
18
master
263
class AddIndex < ActiveRecord::Migration def self.up add_index 'areas', 'title_dashed' add_index 'categories', ['area_id','title_dashed'] end def self.down remove_index 'areas', 'title_dashed' remove_index 'categories', 'area_id' end end
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/032_add_access_level_to_category.rb
Ruby
mit
18
master
233
class AddAccessLevelToCategory < ActiveRecord::Migration def self.up add_column :categories, :access_level, :integer, :null => :false, :default => 0 end def self.down remove_column :categories, :access_level end end
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/005_add_area.rb
Ruby
mit
18
master
571
class AddArea < ActiveRecord::Migration def self.up create_table(:areas) do |t| t.column 'title', :string t.column 'title_dashed', :string end add_column 'users', 'level', :integer add_column 'users', 'area_id', :integer add_column 'categories', 'area_id', :integer add_co...
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/012_add_token_to_users.rb
Ruby
mit
18
master
357
class AddTokenToUsers < ActiveRecord::Migration def self.up add_column 'users', 'token', :string, :limit => 32 User.find(:all).each do |user| md5 = Digest::MD5.hexdigest(Time.now.to_s + user.attributes.to_a.join) user.update_attribute(:token, md5) end end def self.down remo...
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/020_add_category_id_to_comments.rb
Ruby
mit
18
master
234
class AddCategoryIdToComments < ActiveRecord::Migration def self.up transaction do Comment.find(:all).each do |c| c.category_id = c.topic.category c.save! end end end def self.down end end
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/026_add_user_desc.rb
Ruby
mit
18
master
251
class AddUserDesc < ActiveRecord::Migration def self.up add_column "users", "title", :string add_column "users", "signature", :string end def self.down remove_column "users", "title" remove_column "users", "signature" end end
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/010_add_title_dashed_to_categories.rb
Ruby
mit
18
master
206
class AddTitleDashedToCategories < ActiveRecord::Migration def self.up add_column 'categories', 'title_dashed', :string end def self.down remove_column 'categories', 'title_dashed' end end
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/007_add_area_id_to_remote_sites.rb
Ruby
mit
18
master
209
class AddAreaIdToRemoteSites < ActiveRecord::Migration def self.up add_column 'remote_login_sites', 'area_id', :integer end def self.down remove_column 'remote_login_sites', 'area_id' end end
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/028_add_forum_body_and_category_subtitles.rb
Ruby
mit
18
master
280
class AddForumBodyAndCategorySubtitles < ActiveRecord::Migration def self.up add_column "forums", "body", :string add_column "categories", "subtitle", :string end def self.down remove_column "forums", "body" remove_column "categories", "subtitle" end end
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/033_delete_accounts_with_zero_posts.rb
Ruby
mit
18
master
225
class DeleteAccountsWithZeroPosts < ActiveRecord::Migration def self.up transaction do User.find(:all).each do |u| u.destroy if u.post_count == 0 end end end def self.down end end
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/013_add_inspirations.rb
Ruby
mit
18
master
382
class AddInspirations < ActiveRecord::Migration def self.up create_table(:inspirations) do |t| t.column 'topic_id', :integer t.column 'inspiration_id', :integer t.column 'inspired_id', :integer t.column 'inspiration_author', :string t.column 'inspired_author', :string end ...
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/025_add_description_for_categories.rb
Ruby
mit
18
master
285
class AddDescriptionForCategories < ActiveRecord::Migration def self.up add_column "categories", "body", :string add_column "categories", "body_html", :string end def self.down remove_column "categories", "body" remove_column "categories", "body_html" end end
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/006_add_user_type.rb
Ruby
mit
18
master
650
class AddUserType < ActiveRecord::Migration def self.up add_column 'users', 'type', :string add_column 'users', 'remote_user_id', :integer add_column 'users', 'remote_login_site_id', :integer add_column 'users', 'post_count', :integer, :default => 0 create_table(:remote_login_sites) do |t| ...
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/019_drop_attachments.rb
Ruby
mit
18
master
239
class DropAttachments < ActiveRecord::Migration def self.up drop_table('attachments') end def self.down create_table(:attachments) do |t| t.column 'image', :string t.column 'topic_id', :integer end end end
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/023_remove_title_dashed.rb
Ruby
mit
18
master
291
class RemoveTitleDashed < ActiveRecord::Migration def self.up remove_column "forums", "title_dashed" remove_column "categories", "title_dashed" end def self.down add_column "forums", "title_dashed", :string add_column "categories", "title_dashed", :string end end
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/022_areas_to_forums.rb
Ruby
mit
18
master
577
class AreasToForums < ActiveRecord::Migration def self.up rename_table 'areas', 'forums' rename_column 'categories', 'area_id', 'forum_id' rename_column 'posts', 'area_id', 'forum_id' drop_table 'remote_login_sites' end def self.down rename_table 'forums', 'areas' rename_column 'categorie...
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/021_cleanup.rb
Ruby
mit
18
master
756
class Cleanup < ActiveRecord::Migration def self.up drop_table(:inspirations) remove_column "users", "area_id" remove_column "users", "type" remove_column "users", "remote_user_id" remove_column "users", "remote_login_site_id" end def self.down add_column "users", "area_id", :integer ...
github
danielw/opinion
https://github.com/danielw/opinion
db/migrate/015_add_anon_posts_for_areas.rb
Ruby
mit
18
master
226
class AddAnonPostsForAreas < ActiveRecord::Migration def self.up add_column 'areas', 'anonymous_posts', :boolean, :default => false end def self.down remove_column 'areas', 'anonymous_posts', :boolean end end
github
danielw/opinion
https://github.com/danielw/opinion
lib/syslog_logger.rb
Ruby
mit
18
master
5,861
require 'syslog' require 'logger' ## # SyslogLogger is a Logger work-alike that logs via syslog instead of to a # file. You can add SyslogLogger to your Rails production environment to # aggregate logs between multiple machines. # # By default, SyslogLogger uses the program name 'rails', but this can be # changed via...
github
danielw/opinion
https://github.com/danielw/opinion
lib/dash_string.rb
Ruby
mit
18
master
403
class String # Converts a post title to its-title-using-dashes # All special chars are stripped in the process def dashed result = self.downcase # strip all non word chars result.gsub!(/\W/, ' ') # replace all white space sections with a dash result.gsub!(/\ +/, '-') # trim dash...
github
danielw/opinion
https://github.com/danielw/opinion
lib/tasks/capistrano.rake
Ruby
mit
18
master
3,341
# ============================================================================= # A set of rake tasks for invoking the Capistrano automation utility. # ============================================================================= # Invoke the given actions via Capistrano def cap(*parameters) begin require 'rubyg...
github
danielw/opinion
https://github.com/danielw/opinion
lib/tasks/ultrasphinx.rake
Ruby
mit
18
master
6,125
ENV['RAILS_ENV'] ||= "development" namespace :ultrasphinx do task :_environment => [:environment] do # We can't just chain :environment because we want to make # sure it's set only for known Sphinx tasks Ultrasphinx.with_rake = true end desc "Bootstrap a full Sphinx environment" task :bootst...
github
danielw/opinion
https://github.com/danielw/opinion
lib/tasks/backup.rake
Ruby
mit
18
master
1,877
namespace :db do namespace :backup do desc "Dump entire db." task :write => :environment do dir = RAILS_ROOT + '/db/backup' FileUtils.mkdir_p(dir) FileUtils.chdir(dir) ActiveRecord::Base.connection.tables.sort.each do |tbl| next if ["schema_info", 'sessions'].fl...
github
danielw/opinion
https://github.com/danielw/opinion
app/controllers/admin_controller.rb
Ruby
mit
18
master
684
class AdminController < ApplicationController before_filter :require_super_user def index @superusers = User.find(:all, :conditions => "level = 1024") @admins = User.find(:all, :conditions => "level = 128") @moderators = User.find(:all, :conditions => "level = 64") end def new_user re...
github
danielw/opinion
https://github.com/danielw/opinion
app/controllers/dashboard_controller.rb
Ruby
mit
18
master
763
class DashboardController < ApplicationController def index @topic_count = Topic.count @comment_count = Comment.count @user_count = User.count @forums = Forum.find(:all) @rss = url_for(:action => 'feed', :only_path => false) today, yesterday = Time.now.to_date, Time.now.yesterday.to_date ...
github
danielw/opinion
https://github.com/danielw/opinion
app/controllers/categories_controller.rb
Ruby
mit
18
master
1,397
class CategoriesController < ApplicationController before_filter :require_admin, :except => [:show] def show @category = Category.find(params[:id], :conditions => access_conditions) @topics = @category.topics.paginate(:all, :per_page => 20, :page => params[:page], :order => "(status = 'sticky') DESC, upd...
github
danielw/opinion
https://github.com/danielw/opinion
app/controllers/images_controller.rb
Ruby
mit
18
master
612
class ImagesController < ApplicationController before_filter :fetch_post def create if @post.editable? and @post.owner?(@user) image = @post.images.build(params[:image]) if image.save flash[:notice] = "Successfully uploaded #{image.filename}..." else flash[:error] = "...
github
danielw/opinion
https://github.com/danielw/opinion
app/controllers/forums_controller.rb
Ruby
mit
18
master
2,338
class ForumsController < ApplicationController before_filter :require_super_user, :except => [:show, :index, :recent_activity] def show #remove after sever redirect is in place @forum = Forum.find(params[:id]) @recent_posts = @forum.posts.find(:all, :limit => 20, :conditions => ['category_id in (?)', Categ...
github
danielw/opinion
https://github.com/danielw/opinion
app/controllers/users_controller.rb
Ruby
mit
18
master
1,813
class UsersController < ApplicationController before_filter :require_admin, :only => [:create_user] def show @user_details = User.find(params[:id]) end def list conditions = nil if params[:access] conditions = ["level >= ?", params[:access].to_i] end @users = User.paginate(:pe...
github
danielw/opinion
https://github.com/danielw/opinion
app/controllers/search_controller.rb
Ruby
mit
18
master
636
class SearchController < ApplicationController def posts @category_ids = Category.ids_matching(access_conditions) # Restrict search down to a single category but only if it's actually a # valid one for this user. search_categories = if params[:category] and @catego...
github
danielw/opinion
https://github.com/danielw/opinion
app/controllers/legacy_routes_controller.rb
Ruby
mit
18
master
350
class LegacyRoutesController < ApplicationController def area area = Forum.find(params[:id]) redirect_to forum_url(area) end def category cat = Category.find(params[:id]) redirect_to category_url(cat) end def post post = Post.find(params[:id]) redirect_to category_post_url(post.ca...
github
danielw/opinion
https://github.com/danielw/opinion
app/controllers/accounts_controller.rb
Ruby
mit
18
master
2,455
class AccountsController < ApplicationController before_filter :require_admin, :only => [:destroy] def index @user = User.new(params[:user]) if request.post? if user = User.find_by_email_and_password(@user.email,@user.password) if params[:remember] == 'on' ...
github
danielw/opinion
https://github.com/danielw/opinion
app/controllers/posts_controller.rb
Ruby
mit
18
master
3,719
class PostsController < ApplicationController before_filter :fetch_category before_filter :require_moderator, :except => [:show, :edit, :update, :create, :new] def show @topic = @post = Topic.find(params[:id]) @rss = category_post_url(@topic.category, @topic, :format => 'xml') respond_to do |acc...
github
danielw/opinion
https://github.com/danielw/opinion
app/controllers/application_controller.rb
Ruby
mit
18
master
1,235
# Filters added to this controller will be run for all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base before_filter :login protected def load_forum @forum = Forum.find(params[:forum]) i...
github
danielw/opinion
https://github.com/danielw/opinion
app/models/sphinx_index.rb
Ruby
mit
18
master
475
module SphinxIndex module Post def self.included(base) base.is_indexed( :fields => [ 'title', 'body', 'category_id', 'created_at' ], :include => [ {:association_name => 'user', :field => 'name', :as => 'author'}, ...
github
danielw/opinion
https://github.com/danielw/opinion
app/models/category.rb
Ruby
mit
18
master
925
# == Schema Information # Schema version: 32 # # Table name: categories # # id :integer(11) not null, primary key # title :string(255) # forum_id :integer(11) # body :text # body_html :text # subtitle :string(255) # access_level :integer(11) de...
github
danielw/opinion
https://github.com/danielw/opinion
app/models/topic.rb
Ruby
mit
18
master
1,334
# == Schema Information # Schema version: 32 # # Table name: posts # # id :integer(11) not null, primary key # category_id :integer(11) # title :string(255) # body :text # body_html :text # user_id :integer(11) # created_at :datetime # type ...
github
danielw/opinion
https://github.com/danielw/opinion
app/models/user.rb
Ruby
mit
18
master
1,710
# == Schema Information # Schema version: 32 # # Table name: users # # id :integer(11) not null, primary key # password :string(255) # name :string(255) # email :string(255) # url :string(255) # level :integer(11) # token :string(32) # title :string(255) ...
github
danielw/opinion
https://github.com/danielw/opinion
app/models/user_mailer.rb
Ruby
mit
18
master
302
class UserMailer < ActionMailer::Base def recover(user, hostname, sent_at = Time.now) @from = "Opinion Forum <opinion@#{hostname}>" @subject = "Password retrieval" @recipients = user.email @headers = {} @sent_on = sent_at @body['user'] = user end end
github
danielw/opinion
https://github.com/danielw/opinion
app/models/sql_like_query.rb
Ruby
mit
18
master
864
class SqlLikeQuery def query(q, options = {}) query = "%#{q}%" page = options[:page] || 0 limit = options[:limit] || 20 sql = "(title LIKE ? OR body LIKE ?)" params = [query, query] if categories = options[:categories] sql << " AND category_id IN (#{categories.join(",")...
github
danielw/opinion
https://github.com/danielw/opinion
app/models/comment.rb
Ruby
mit
18
master
999
# == Schema Information # Schema version: 32 # # Table name: posts # # id :integer(11) not null, primary key # category_id :integer(11) # title :string(255) # body :text # body_html :text # user_id :integer(11) # created_at :datetime # type ...
github
danielw/opinion
https://github.com/danielw/opinion
app/models/post.rb
Ruby
mit
18
master
1,428
# == Schema Information # Schema version: 32 # # Table name: posts # # id :integer(11) not null, primary key # category_id :integer(11) # title :string(255) # body :text # body_html :text # user_id :integer(11) # created_at :datetime # type ...
github
danielw/opinion
https://github.com/danielw/opinion
app/models/image.rb
Ruby
mit
18
master
723
# == Schema Information # Schema version: 32 # # Table name: images # # id :integer(11) not null, primary key # parent_id :integer(11) # post_id :integer(11) # content_type :string(255) # filename :string(255) # thumbnail :string(255) # size :integer(11) # wi...
github
danielw/opinion
https://github.com/danielw/opinion
app/models/sphinx_query.rb
Ruby
mit
18
master
627
module SphinxQuery def self.search(q, options = {}) params = { :query => q } params[:weights] = { :title => 1.5 } params[:per_page] = options[:limit] if options[:limit] params[:page] = options[:page] if options[:page] params[:filters] = {...
github
danielw/opinion
https://github.com/danielw/opinion
app/models/forum.rb
Ruby
mit
18
master
418
# == Schema Information # Schema version: 32 # # Table name: forums # # id :integer(11) not null, primary key # title :string(255) # anonymous_posts :boolean(1) # body :text # class Forum < ActiveRecord::Base has_many :categories, :dependent => :destroy has_...
github
danielw/opinion
https://github.com/danielw/opinion
app/helpers/search_helper.rb
Ruby
mit
18
master
460
module SearchHelper def highlight_search_result(result) highlight(excerpt(h(result.body), params[:q]), params[:q]) rescue ArgumentError truncate(result.body, :length => 100) rescue '' end def forum_link(forum) return link_to(forum.title, forum_url(forum)) unless forum.nil? "unknown forum" en...
github
danielw/opinion
https://github.com/danielw/opinion
app/helpers/application_helper.rb
Ruby
mit
18
master
2,950
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper def use_tinymce @content_for_tinymce = "" content_for :tinymce do javascript_include_tag "tiny_mce/tiny_mce" end @content_for_tinymce_init = "" content_for :tinymce...
github
danielw/opinion
https://github.com/danielw/opinion
config/environment.rb
Ruby
mit
18
master
2,214
# Be sure to restart your server when you modify this file # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') ...
github
danielw/opinion
https://github.com/danielw/opinion
config/deploy.rb
Ruby
mit
18
master
1,818
set :application, "opinion" set :repository, "git@github.com:Shopify/opinion.git" set :scm, :git set :deploy_via, :fast_remote_cache set :campfire_login, "bot@jadedpixel.com" set :campfire_password, "hallo28" set :announce_in, "Open Bar 1.1" set :user, "deploy" set :rails_env, "production" set :branc...
github
danielw/opinion
https://github.com/danielw/opinion
config/routes.rb
Ruby
mit
18
master
1,185
ActionController::Routing::Routes.draw do |map| map.root :controller => 'forums' map.accounts 'accounts/:action/:id', :controller => "accounts" map.users 'users/:action/:id', :controller => "users" map.admin 'admin/:action/:id', :controller => "admin" map.feed 'feed', :controller => 'dashbo...
github
danielw/opinion
https://github.com/danielw/opinion
config/initializers/session_store.rb
Ruby
mit
18
master
799
# Be sure to restart your server when you modify this file. # Your secret key for verifying cookie session data integrity. # If you change this key, all old sessions 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 attacks. Act...
github
danielw/opinion
https://github.com/danielw/opinion
config/environments/production.rb
Ruby
mit
18
master
836
# Settings specified here will take precedence over those in config/environment.rb # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests config.cache_classes = true # Use a different logger for distributed setups config.logger = SyslogLogger.new('rails.opinion...
github
danielw/opinion
https://github.com/danielw/opinion
config/environments/development.rb
Ruby
mit
18
master
842
# Settings specified here will take precedence over those in config/environment.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 webserver when you make code changes. config.ca...
github
danielw/opinion
https://github.com/danielw/opinion
config/environments/test.rb
Ruby
mit
18
master
856
# Settings specified here will take precedence over those in config/environment.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 suite and is wiped # and recreated between...
github
mcmire/fedex
https://github.com/mcmire/fedex
Rakefile
Ruby
mit
18
master
535
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the fedex plugin.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Generate documentation for the fedex plugin.' Rake::RDo...
github
mcmire/fedex
https://github.com/mcmire/fedex
init.rb
Ruby
mit
18
master
1,271
# Copyright (c) 2007 Joseph Jaramillo # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, d...
github
mcmire/fedex
https://github.com/mcmire/fedex
lib/fedex.rb
Ruby
mit
18
master
19,721
# Copyright (c) 2007 Joseph Jaramillo # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, d...
github
mcmire/fedex
https://github.com/mcmire/fedex
lib/ship_constants.rb
Ruby
mit
18
master
19,819
module Fedex # The following constants were created by running wsdl2ruby.rb on the Ship WSDL and # pulling out the appropriate data. These are provided primarily for convenience. # {http://fedex.com/ws/ship/v5}AdditionalLabelsType module AdditionalLabelsTypes BROKER = "BROKER" CONSIGNEE = "CONSIGN...
github
mcmire/fedex
https://github.com/mcmire/fedex
lib/rate_constants.rb
Ruby
mit
18
master
18,041
module Fedex # The following constants were created by running wsdl2ruby.rb on the Rate WSDL and # pulling out the appropriate data. These are provided primarily for convenience. # {http://fedex.com/ws/rate/v5}PickupRequestType module PickupRequestTypes FUTURE_DAY = "FUTURE_DAY" SAME_DAY = "SAME_DAY" ...
github
moonshado/moonshado-sms
https://github.com/moonshado/moonshado-sms
moonshado-sms.gemspec
Ruby
mit
18
master
2,163
# 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{moonshado-sms} s.version = "1.1.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_...
github
moonshado/moonshado-sms
https://github.com/moonshado/moonshado-sms
Rakefile
Ruby
mit
18
master
1,587
require 'rubygems' require 'rake' begin require 'jeweler' Jeweler::Tasks.new do |gem| gem.name = "moonshado-sms" gem.summary = "Moonshado SMS gem" gem.email = "tech@moonshado.com" gem.homepage = "http://github.com/moonshado/moonshado-sms" gem.authors = ["Kevin Patel"] gem.add_development_de...
github
moonshado/moonshado-sms
https://github.com/moonshado/moonshado-sms
lib/moonshado-sms.rb
Ruby
mit
18
master
232
require 'rubygems' require 'rest_client' require 'json/pure' unless {}.respond_to?(:to_json) require 'moonshado/configuration' require 'moonshado/sms' require 'moonshado/keywords' require 'moonshado/sender' module Moonshado end
github
moonshado/moonshado-sms
https://github.com/moonshado/moonshado-sms
lib/moonshado/configuration.rb
Ruby
mit
18
master
2,113
module Moonshado class Configuration OPTIONS = [:api_key, :keywords, :sms_uri, :keyword_uri, :auto_register_keyword, :host, :http_open_timeout, :http_read_timeout, :port, :protocol, :secure, :production_environment].freeze attr_accessor :api_key ...
github
moonshado/moonshado-sms
https://github.com/moonshado/moonshado-sms
lib/moonshado/sender.rb
Ruby
mit
18
master
1,198
module Moonshado class Sender attr_reader :host, :port, :secure, :http_open_timeout, :http_read_timeout, :protocol, :api_key def initialize(options = {}) [:protocol, :host, :port, :secure, :http_open_timeout, :http_read_timeout, :api_key].each do |option| instance_variable_set("@#{option}", opt...
github
moonshado/moonshado-sms
https://github.com/moonshado/moonshado-sms
lib/moonshado/sms.rb
Ruby
mit
18
master
2,758
module Moonshado class Sms attr_accessor :number, :message class << self attr_accessor :configuration attr_accessor :sender def configure self.configuration ||= Configuration.new yield(configuration) self.sender = Sender.new(configuration) if configuration.a...
github
moonshado/moonshado-sms
https://github.com/moonshado/moonshado-sms
lib/moonshado/keywords.rb
Ruby
mit
18
master
1,163
module Moonshado class Sms class Keywords class << self def list response = sender.get(configuration.keywords_uri) parse(response.body) end def register_keywords raise MoonshadoSMSException.new("no keywords specified") unless valid_keywords? ...
github
moonshado/moonshado-sms
https://github.com/moonshado/moonshado-sms
test/keywords_test.rb
Ruby
mit
18
master
1,182
require 'helper' class Moonshado::SmsTest < Test::Unit::TestCase context Moonshado::Sms::Keywords do setup do Moonshado::Sms.configure do |config| config.api_key = '20lsdjf2' config.keywords = {"test" => "http://test.com"} end end should "validate keywords" do assert(Mo...
github
moonshado/moonshado-sms
https://github.com/moonshado/moonshado-sms
test/configuration_test.rb
Ruby
mit
18
master
726
require 'helper' class Moonshado::SmsTest < Test::Unit::TestCase context Moonshado::Configuration do setup do Moonshado::Sms.configure do |config| config.api_key = 'http://20lsdjf2@localhost:3000/sms' config.keywords = {"test" => "http://test.com"} end end should "parse api k...
github
moonshado/moonshado-sms
https://github.com/moonshado/moonshado-sms
test/sms_test.rb
Ruby
mit
18
master
3,321
require 'helper' class Moonshado::SmsTest < Test::Unit::TestCase context Moonshado::Sms do setup do Moonshado::Sms.configuration = nil Moonshado::Sms.configure do |config| config.api_key = '20lsdjf2' config.production_environment = false end end should "format number wi...
github
moonshado/moonshado-sms
https://github.com/moonshado/moonshado-sms
test/helper.rb
Ruby
mit
18
master
383
require 'rubygems' require 'test/unit' require 'shoulda' require 'mocha' # require 'webmock/test_unit' begin require 'redgreen'; rescue LoadError; end begin require 'turn'; rescue LoadError; end require 'moonshado-sms' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(...
github
sgrove/spec_storm
https://github.com/sgrove/spec_storm
Rakefile
Ruby
mit
18
master
568
require 'rake' require 'rake/testtask' require 'rake/rdoctask' desc 'Default: run unit tests.' task :default => :test desc 'Test the spec_storm 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 ...
github
sgrove/spec_storm
https://github.com/sgrove/spec_storm
spec/spec_helper.rb
Ruby
mit
18
master
316
module SpecStorm USE_NAMESPACE_HACK = true end begin require File.dirname(__FILE__) + '/../../../../spec/spec_helper' rescue LoadError puts "You need to install rspec in your base app" exit end plugin_spec_dir = File.dirname(__FILE__) ActiveRecord::Base.logger = Logger.new(plugin_spec_dir + "/debug.log")
github
sgrove/spec_storm
https://github.com/sgrove/spec_storm
spec/spec_storm_spec.rb
Ruby
mit
18
master
2,245
require File.dirname(__FILE__) + '/spec_helper' # For ActiveRecord extension testing class Category < ActiveRecord::Base; end class Categorization < ActiveRecord::Base; end class Smarts < ActiveRecord::Base; end class CreditCard < ActiveRecord::Base class PinNumber < ActiveRecord::Base class CvvCode < ActiveReco...
github
sgrove/spec_storm
https://github.com/sgrove/spec_storm
lib/spec_storm_helper.rb
Ruby
mit
18
master
1,176
module SpecStorm def self.set_db_prefix(prefix) ActiveRecord::Base.prefix_and_reset_all_table_names_to prefix ActiveRecord::Base.show_all_subclasses end def self.db_prefix_for(file) #puts "Calculating for #{file}" dummy = File.join(File.expand_path(File.dirname(file)), (file).split('/').last) ...
github
sgrove/spec_storm
https://github.com/sgrove/spec_storm
lib/action_controller_ext.rb
Ruby
mit
18
master
1,667
ActionController::Base.class_eval do puts "Not Patching ActionController" if self.const_defined?("SpecStormLoaded") unless self.const_defined?("SpecStormLoaded") puts "Patching ActionController::Base" SpecStormLoaded = true alias_method :original_url_for, :url_for def url_for(options = {}) ...
github
sgrove/spec_storm
https://github.com/sgrove/spec_storm
lib/action_view_ext.rb
Ruby
mit
18
master
837
ActionView::Helpers::UrlHelper.class_eval do unless self.const_defined?("SpecStormLoaded") puts "Patching ActiveView::Base" SpecStormLoaded = true alias_method :original_url_to, :url_for def url_for(options = {}) # TODO: Regex stuff to only append this when necessary case options ...
github
sgrove/spec_storm
https://github.com/sgrove/spec_storm
lib/spec_storm.rb
Ruby
mit
18
master
656
# SpecStorm puts "Parsing SpecStorm loader" module SpecStorm class SpecStormError < StandardError; end #:nodoc class NoDBPrefixSpecified < SpecStormError; end #:nodoc if SpecStorm.const_defined?("USE_NAMESPACE_HACK") and SpecStorm::USE_NAMESPACE_HACK == true puts 'Loading SpecStorm patches...' # Used fo...
github
sgrove/spec_storm
https://github.com/sgrove/spec_storm
lib/active_record_ext.rb
Ruby
mit
18
master
579
ActiveRecord::Base.instance_eval do unless self.const_defined?("SpecStormLoaded") puts "Patching ActiveRecord::Base" SpecStormLoaded = true def prefix_and_reset_all_table_names_to(prefix) ActiveRecord::Base.table_name_prefix = prefix ActiveRecord::Base.reset_all_table_names end d...
github
sgrove/spec_storm
https://github.com/sgrove/spec_storm
tasks/spec_storm_tasks.rake
Ruby
mit
18
master
3,098
namespace :ss do def find_spec_files(prefix) require File.join(File.dirname(__FILE__), '..', 'lib', "spec_storm_helper") require File.join(File.dirname(__FILE__), '..', 'lib', "spec_storm") tests_folder = File.join(RAILS_ROOT, "spec", prefix) puts "Tests folder: #{tests_folder}" return SpecSt...
github
turbopuffer/turbopuffer-ruby
https://github.com/turbopuffer/turbopuffer-ruby
Rakefile
Ruby
mit
10
main
4,963
# frozen_string_literal: true require "pathname" require "securerandom" require "shellwords" require "minitest/test_task" require "rake/clean" require "rubocop/rake_task" tapioca = "sorbet/tapioca" examples = "examples" ignore_file = ".ignore" FILES_ENV = "FORMAT_FILE" CLEAN.push(*%w[.idea/ .ruby-lsp/ .yardoc/ doc...
github
turbopuffer/turbopuffer-ruby
https://github.com/turbopuffer/turbopuffer-ruby
turbopuffer.gemspec
Ruby
mit
10
main
817
# frozen_string_literal: true require_relative "lib/turbopuffer/version" Gem::Specification.new do |s| s.name = "turbopuffer" s.version = Turbopuffer::VERSION s.summary = "Ruby library to access the Turbopuffer API" s.authors = ["Turbopuffer"] s.email = "info@turbopuffer.com" s.homepage = "https://gemdocs...
github
turbopuffer/turbopuffer-ruby
https://github.com/turbopuffer/turbopuffer-ruby
test/turbopuffer/file_part_test.rb
Ruby
mit
10
main
325
# frozen_string_literal: true require_relative "test_helper" class Turbopuffer::Test::FilePartTest < Minitest::Test def test_to_json text = "gray" filepart = Turbopuffer::FilePart.new(StringIO.new(text)) assert_equal(text.to_json, filepart.to_json) assert_equal(text.to_yaml, filepart.to_yaml) end...
github
turbopuffer/turbopuffer-ruby
https://github.com/turbopuffer/turbopuffer-ruby
test/turbopuffer/test_helper.rb
Ruby
mit
10
main
1,954
# frozen_string_literal: true # Requiring this file from each test file ensures we always do the following, even # when running a single-file test: # - Load the whole gem (as one would in production) # - Define shared testing namespace so that we don't need to indent test files as much # - Setting up testing dependenc...
github
turbopuffer/turbopuffer-ruby
https://github.com/turbopuffer/turbopuffer-ruby
test/turbopuffer/custom_test.rb
Ruby
mit
10
main
553
# frozen_string_literal: true require "securerandom" require_relative "test_helper" class Turbopuffer::Test::CustomTest < Minitest::Test def before_all super @turbopuffer = Turbopuffer::Client.new(region: "gcp-us-central1") end def setup super @ns = @turbopuffer.namespace("test-rb-#{SecureRando...
github
turbopuffer/turbopuffer-ruby
https://github.com/turbopuffer/turbopuffer-ruby
test/turbopuffer/client_test.rb
Ruby
mit
10
main
11,411
# frozen_string_literal: true require_relative "test_helper" class TurbopufferTest < Minitest::Test extend Minitest::Serial include WebMock::API def before_all super WebMock.enable! end def setup super Thread.current.thread_variable_set(:mock_sleep, []) @env = ENV.to_h ENV.reject! ...
github
turbopuffer/turbopuffer-ruby
https://github.com/turbopuffer/turbopuffer-ruby
test/turbopuffer/resources/namespaces_test.rb
Ruby
mit
10
main
5,979
# frozen_string_literal: true require_relative "../test_helper" class Turbopuffer::Test::Resources::NamespacesTest < Turbopuffer::Test::ResourceTest def test_delete_all_required_params skip("Mock server tests are disabled") response = @turbopuffer.namespaces.delete_all(namespace: "namespace") assert_p...
github
turbopuffer/turbopuffer-ruby
https://github.com/turbopuffer/turbopuffer-ruby
test/turbopuffer/internal/util_test.rb
Ruby
mit
10
main
17,210
# frozen_string_literal: true require_relative "../test_helper" class Turbopuffer::Test::UtilDataHandlingTest < Minitest::Test def test_left_map assert_pattern do Turbopuffer::Internal::Util.deep_merge({a: 1}, nil) => nil end end def test_right_map assert_pattern do Turbopuffer::Interna...
github
turbopuffer/turbopuffer-ruby
https://github.com/turbopuffer/turbopuffer-ruby
test/turbopuffer/internal/sorbet_runtime_support_test.rb
Ruby
mit
10
main
1,781
# frozen_string_literal: true require_relative "../test_helper" class Turbopuffer::Test::SorbetRuntimeSupportTest < Minitest::Test extend Minitest::Serial i_suck_and_my_tests_are_order_dependent! module E extend Turbopuffer::Internal::Type::Enum define_sorbet_constant!(:TaggedSymbol) { 1 } end m...
github
turbopuffer/turbopuffer-ruby
https://github.com/turbopuffer/turbopuffer-ruby
test/turbopuffer/internal/type/base_model_test.rb
Ruby
mit
10
main
19,414
# frozen_string_literal: true require_relative "../../test_helper" class Turbopuffer::Test::PrimitiveModelTest < Minitest::Test A = Turbopuffer::Internal::Type::ArrayOf[-> { Integer }] H = Turbopuffer::Internal::Type::HashOf[-> { Integer }, nil?: true] module E extend Turbopuffer::Internal::Type::Enum en...
github
turbopuffer/turbopuffer-ruby
https://github.com/turbopuffer/turbopuffer-ruby
examples/write_and_query.rb
Ruby
mit
10
main
1,849
#!/usr/bin/env ruby # frozen_string_literal: true # typed: strict # A straightforward example of storing and retrieving documents via vector # similarity search. # # Run this example with: bundle exec examples/write_and_query.rb require "turbopuffer" client = Turbopuffer::Client.new(region: "gcp-us-central1") name...
github
turbopuffer/turbopuffer-ruby
https://github.com/turbopuffer/turbopuffer-ruby
lib/turbopuffer.rb
Ruby
mit
10
main
5,110
# frozen_string_literal: true # Standard libraries. # rubocop:disable Lint/RedundantRequireStatement require "English" require "base64" require "cgi" require "date" require "erb" require "etc" require "json" require "net/http" require "openssl" require "pathname" require "rbconfig" require "securerandom" require "set"...
github
turbopuffer/turbopuffer-ruby
https://github.com/turbopuffer/turbopuffer-ruby
lib/turbopuffer/errors.rb
Ruby
mit
10
main
6,033
# frozen_string_literal: true module Turbopuffer module Errors class Error < StandardError # @!attribute cause # # @return [StandardError, nil] end class ConversionError < Turbopuffer::Errors::Error # @return [StandardError, nil] def cause = @cause.nil? ? super : @cause ...