repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
agoragames/activity_feed | https://github.com/agoragames/activity_feed/blob/4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5/spec/support/active_record.rb | spec/support/active_record.rb | require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => "sqlite3",
:database => ":memory:"
)
ActiveRecord::Migration.verbose = false
DatabaseCleaner[:active_record].strategy = :transaction
ActiveRecord::Schema.define do
create_table :activity_feed_items, :force => true do |t|
t.string... | ruby | MIT | 4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5 | 2026-01-04T17:47:31.631220Z | false |
agoragames/activity_feed | https://github.com/agoragames/activity_feed/blob/4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5/spec/support/mongoid.rb | spec/support/mongoid.rb | require 'mongoid'
# If using Mongoid 2.x
# Mongoid.configure do |config|
# config.master = Mongo::Connection.new.db("activity_feed_gem_test")
# end
# If using Mongoid 3.x
Mongoid.load!("#{File.dirname(__FILE__)}/mongoid.yml", :test)
DatabaseCleaner[:mongoid].strategy = :truncation
module ActivityFeed
module Mon... | ruby | MIT | 4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5 | 2026-01-04T17:47:31.631220Z | false |
agoragames/activity_feed | https://github.com/agoragames/activity_feed/blob/4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5/spec/activity_feed/configuration_spec.rb | spec/activity_feed/configuration_spec.rb | require 'spec_helper'
describe ActivityFeed::Configuration do
describe '#configure' do
it 'should have default attributes' do
ActivityFeed.configure do |configuration|
expect(configuration.namespace).to eql('activity_feed')
expect(configuration.aggregate).to be_falsey
expect(configu... | ruby | MIT | 4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5 | 2026-01-04T17:47:31.631220Z | false |
agoragames/activity_feed | https://github.com/agoragames/activity_feed/blob/4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5/spec/activity_feed/utility_spec.rb | spec/activity_feed/utility_spec.rb | require 'spec_helper'
describe ActivityFeed::Utility do
describe '#feed_key' do
it 'should return the correct key for the non-aggregate feed' do
expect(ActivityFeed.feed_key('david')).to eq('activity_feed:david')
end
it 'should return the correct key for an aggregate feed' do
expect(Activity... | ruby | MIT | 4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5 | 2026-01-04T17:47:31.631220Z | false |
agoragames/activity_feed | https://github.com/agoragames/activity_feed/blob/4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5/spec/activity_feed/feed_spec.rb | spec/activity_feed/feed_spec.rb | require 'spec_helper'
describe ActivityFeed::Feed do
describe '#feed and #for' do
describe 'without aggregation' do
it 'should return an activity feed with the items correctly ordered' do
feed = ActivityFeed.feed('david', 1)
expect(feed.length).to eql(0)
add_items_to_feed('david')
... | ruby | MIT | 4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5 | 2026-01-04T17:47:31.631220Z | false |
agoragames/activity_feed | https://github.com/agoragames/activity_feed/blob/4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5/spec/activity_feed/item_spec.rb | spec/activity_feed/item_spec.rb | require 'spec_helper'
require 'active_support/core_ext/date_time/conversions'
describe ActivityFeed::Item do
describe '#update_item' do
describe 'without aggregation' do
it 'should correctly build an activity feed' do
expect(ActivityFeed.redis.exists(ActivityFeed.feed_key('david'))).to be_falsey
... | ruby | MIT | 4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5 | 2026-01-04T17:47:31.631220Z | false |
agoragames/activity_feed | https://github.com/agoragames/activity_feed/blob/4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5/lib/activity_feed.rb | lib/activity_feed.rb | require 'activity_feed/configuration'
require 'activity_feed/item'
require 'activity_feed/feed'
require 'activity_feed/utility'
require 'activity_feed/version'
require 'leaderboard'
module ActivityFeed
extend Configuration
extend Item
extend Feed
extend Utility
end | ruby | MIT | 4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5 | 2026-01-04T17:47:31.631220Z | false |
agoragames/activity_feed | https://github.com/agoragames/activity_feed/blob/4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5/lib/activity_feed/feed.rb | lib/activity_feed/feed.rb | module ActivityFeed
module Feed
# Retrieve a page from the activity feed for a given +user_id+. You can configure
# +ActivityFeed.items_loader+ with a Proc to retrieve items from, for example,
# your ORM (e.g. ActiveRecord) or your ODM (e.g. Mongoid), and have the page
# returned with loaded items rat... | ruby | MIT | 4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5 | 2026-01-04T17:47:31.631220Z | false |
agoragames/activity_feed | https://github.com/agoragames/activity_feed/blob/4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5/lib/activity_feed/version.rb | lib/activity_feed/version.rb | module ActivityFeed
VERSION = '3.1.0'
end
| ruby | MIT | 4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5 | 2026-01-04T17:47:31.631220Z | false |
agoragames/activity_feed | https://github.com/agoragames/activity_feed/blob/4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5/lib/activity_feed/item.rb | lib/activity_feed/item.rb | module ActivityFeed
module Item
# Add or update an item in the activity feed for a given +user_id+.
#
# @param user_id [String] User ID.
# @param item_id [String] Item ID.
# @param timestamp [int] Timestamp for the item being added or updated.
# @param aggregate [boolean, false] Whether to add... | ruby | MIT | 4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5 | 2026-01-04T17:47:31.631220Z | false |
agoragames/activity_feed | https://github.com/agoragames/activity_feed/blob/4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5/lib/activity_feed/utility.rb | lib/activity_feed/utility.rb | module ActivityFeed
module Utility
# Feed key for a +user_id+ composed of:
#
# Feed: +ActivityFeed.namespace:user_id+
# Aggregate feed: +ActivityFeed.namespace:ActivityFeed.aggregate_key:user_id+
#
# @return feed key.
def feed_key(user_id, aggregate = ActivityFeed.aggregate)
aggrega... | ruby | MIT | 4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5 | 2026-01-04T17:47:31.631220Z | false |
agoragames/activity_feed | https://github.com/agoragames/activity_feed/blob/4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5/lib/activity_feed/configuration.rb | lib/activity_feed/configuration.rb | module ActivityFeed
# Configuration settings for ActivityFeed.
module Configuration
# Redis instance.
attr_accessor :redis
# Proc that will be called for loading items from an
# ORM (e.g. ActiveRecord) or ODM (e.g. Mongoid). Proc
# will be called with the IDs of the items from the feed.
att... | ruby | MIT | 4f93a29b69b70d6ae1dbbdb7ce3da83d4f413aa5 | 2026-01-04T17:47:31.631220Z | false |
companionstudio/instagram-token-agent | https://github.com/companionstudio/instagram-token-agent/blob/02fec49788a3a73dc1ad7207743d5fb01ce713d9/app.rb | app.rb | require 'dotenv'
require 'bundler'
Dotenv.load
Bundler.require
require_relative 'lib/instagram_token_agent'
class App < Sinatra::Base
register Sinatra::ActiveRecordExtension
register Sinatra::CrossOrigin
# Nicer debugging in dev mode
configure :development do
require 'pry'
require "better_errors"
... | ruby | MIT | 02fec49788a3a73dc1ad7207743d5fb01ce713d9 | 2026-01-04T17:47:31.319073Z | false |
companionstudio/instagram-token-agent | https://github.com/companionstudio/instagram-token-agent/blob/02fec49788a3a73dc1ad7207743d5fb01ce713d9/lib/instagram_token_agent.rb | lib/instagram_token_agent.rb | require_relative 'instagram_token_agent/version'
require_relative 'instagram_token_agent/store'
require_relative 'instagram_token_agent/client'
require_relative 'temporize/scheduler'
module InstagramTokenAgent
module AppInfo
def self.info
if File.exist?("#{Dir.pwd}/app.json")
file = File.read("#{Di... | ruby | MIT | 02fec49788a3a73dc1ad7207743d5fb01ce713d9 | 2026-01-04T17:47:31.319073Z | false |
companionstudio/instagram-token-agent | https://github.com/companionstudio/instagram-token-agent/blob/02fec49788a3a73dc1ad7207743d5fb01ce713d9/lib/instagram_token_agent/version.rb | lib/instagram_token_agent/version.rb | module InstagramTokenAgent
VERSION = '1.0.3'.freeze
end
| ruby | MIT | 02fec49788a3a73dc1ad7207743d5fb01ce713d9 | 2026-01-04T17:47:31.319073Z | false |
companionstudio/instagram-token-agent | https://github.com/companionstudio/instagram-token-agent/blob/02fec49788a3a73dc1ad7207743d5fb01ce713d9/lib/instagram_token_agent/store.rb | lib/instagram_token_agent/store.rb | module InstagramTokenAgent
# Handle interfacing with the database, updating and retrieving values
class Store
# Execute the given SQL and params
def self.execute(sql, params = [])
binds = params.map{|p| [nil, p]}
ActiveRecord::Base.connection_pool.with_connection { |con| con.exec_query(sql, 'sq... | ruby | MIT | 02fec49788a3a73dc1ad7207743d5fb01ce713d9 | 2026-01-04T17:47:31.319073Z | false |
companionstudio/instagram-token-agent | https://github.com/companionstudio/instagram-token-agent/blob/02fec49788a3a73dc1ad7207743d5fb01ce713d9/lib/instagram_token_agent/client.rb | lib/instagram_token_agent/client.rb | # Handles connecting to the basic display API
module InstagramTokenAgent
class Client
include HTTParty
attr_accessor :config
def initialize(settings)
@config = settings
end
# Does the provided signature match?
def check_signature?(check_signature)
check_signature == signature
... | ruby | MIT | 02fec49788a3a73dc1ad7207743d5fb01ce713d9 | 2026-01-04T17:47:31.319073Z | false |
companionstudio/instagram-token-agent | https://github.com/companionstudio/instagram-token-agent/blob/02fec49788a3a73dc1ad7207743d5fb01ce713d9/lib/temporize/scheduler.rb | lib/temporize/scheduler.rb | # Interface with Temporize's cron add-on for Heroku,
# This takes care of scheduling the refresh job for the future when a new expiry is known.
module Temporize
class Scheduler
include HTTParty
format :json
attr_accessor :config
base_uri "#{ENV['TEMPORIZE_URL']}/v1"
def initialize(settings)
... | ruby | MIT | 02fec49788a3a73dc1ad7207743d5fb01ce713d9 | 2026-01-04T17:47:31.319073Z | false |
christospappas/streama | https://github.com/christospappas/streama/blob/2f6134437ba8f2364c12c0d836d4908be8a6b648/spec/spec_helper.rb | spec/spec_helper.rb | require "pry"
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
MODELS = File.join(File.dirname(__FILE__), "app/models")
SUPPORT = File.join(File.dirname(__FILE__), "support")
$LOAD_PATH.unshift(MODELS)
$LOAD_PATH.unshift(SUPPORT)
require 'streama'
require '... | ruby | MIT | 2f6134437ba8f2364c12c0d836d4908be8a6b648 | 2026-01-04T17:47:35.818726Z | false |
christospappas/streama | https://github.com/christospappas/streama/blob/2f6134437ba8f2364c12c0d836d4908be8a6b648/spec/app/models/activity.rb | spec/app/models/activity.rb | class Activity
include Streama::Activity
activity :new_photo do
actor :user, :cache => [:full_name]
object :photo, :cache => [:file]
target_object :album, :cache => [:title]
end
activity :new_photo_without_cache do
actor :user
object :photo
target_object :album
end
activity :new_c... | ruby | MIT | 2f6134437ba8f2364c12c0d836d4908be8a6b648 | 2026-01-04T17:47:35.818726Z | false |
christospappas/streama | https://github.com/christospappas/streama/blob/2f6134437ba8f2364c12c0d836d4908be8a6b648/spec/app/models/photo.rb | spec/app/models/photo.rb | class Photo
include Mongoid::Document
include Mongoid::Attributes::Dynamic
field :file
end
| ruby | MIT | 2f6134437ba8f2364c12c0d836d4908be8a6b648 | 2026-01-04T17:47:35.818726Z | false |
christospappas/streama | https://github.com/christospappas/streama/blob/2f6134437ba8f2364c12c0d836d4908be8a6b648/spec/app/models/no_mongoid.rb | spec/app/models/no_mongoid.rb | class NoMongoid
include Streama::Actor
field :full_name
def followers
self.class.all
end
end | ruby | MIT | 2f6134437ba8f2364c12c0d836d4908be8a6b648 | 2026-01-04T17:47:35.818726Z | false |
christospappas/streama | https://github.com/christospappas/streama/blob/2f6134437ba8f2364c12c0d836d4908be8a6b648/spec/app/models/album.rb | spec/app/models/album.rb | class Album
include Mongoid::Document
field :title
end | ruby | MIT | 2f6134437ba8f2364c12c0d836d4908be8a6b648 | 2026-01-04T17:47:35.818726Z | false |
christospappas/streama | https://github.com/christospappas/streama/blob/2f6134437ba8f2364c12c0d836d4908be8a6b648/spec/app/models/user.rb | spec/app/models/user.rb | class User
include Mongoid::Document
include Streama::Actor
field :full_name
def friends
self.class.all
end
def followers
self.class.all
end
end | ruby | MIT | 2f6134437ba8f2364c12c0d836d4908be8a6b648 | 2026-01-04T17:47:35.818726Z | false |
christospappas/streama | https://github.com/christospappas/streama/blob/2f6134437ba8f2364c12c0d836d4908be8a6b648/spec/app/models/mars/user.rb | spec/app/models/mars/user.rb | # encoding: utf-8
module Mars
class User
include Mongoid::Document
include Streama::Actor
field :full_name
def followers
self.class.all
end
end
end
| ruby | MIT | 2f6134437ba8f2364c12c0d836d4908be8a6b648 | 2026-01-04T17:47:35.818726Z | false |
christospappas/streama | https://github.com/christospappas/streama/blob/2f6134437ba8f2364c12c0d836d4908be8a6b648/spec/lib/activity_spec.rb | spec/lib/activity_spec.rb | require 'spec_helper'
describe "Activity" do
let(:photo) { Photo.create(:file => "image.jpg") }
let(:album) { Album.create(:title => "A test album") }
let(:user) { User.create(:full_name => "Christos") }
let(:mars_user) { Mars::User.create(:full_name => "Mars User") }
describe ".activity" do
it "regist... | ruby | MIT | 2f6134437ba8f2364c12c0d836d4908be8a6b648 | 2026-01-04T17:47:35.818726Z | false |
christospappas/streama | https://github.com/christospappas/streama/blob/2f6134437ba8f2364c12c0d836d4908be8a6b648/spec/lib/definition_spec.rb | spec/lib/definition_spec.rb | require 'spec_helper'
describe "Definition" do
let(:definition_dsl) do
dsl = Streama::DefinitionDSL.new(:new_photo)
dsl.actor(:user, :cache => [:id, :full_name])
dsl.object(:photo, :cache => [:id, :full_name])
dsl.target_object(:album, :cache => [:id, :name, :full_address])
dsl
end
desc... | ruby | MIT | 2f6134437ba8f2364c12c0d836d4908be8a6b648 | 2026-01-04T17:47:35.818726Z | false |
christospappas/streama | https://github.com/christospappas/streama/blob/2f6134437ba8f2364c12c0d836d4908be8a6b648/spec/lib/actor_spec.rb | spec/lib/actor_spec.rb | require 'spec_helper'
describe "Actor" do
let(:photo) { Photo.create(:comment => "I'm interested") }
let(:album) { Album.create(:title => "A test album") }
let(:user) { User.create(:full_name => "Christos") }
it "raises an exception if the class is not a mongoid document" do
lambda { NoMongoid.new }.shou... | ruby | MIT | 2f6134437ba8f2364c12c0d836d4908be8a6b648 | 2026-01-04T17:47:35.818726Z | false |
christospappas/streama | https://github.com/christospappas/streama/blob/2f6134437ba8f2364c12c0d836d4908be8a6b648/spec/lib/definition_dsl_spec.rb | spec/lib/definition_dsl_spec.rb | require 'spec_helper'
describe "Definition" do
let(:definition_dsl) {Streama::DefinitionDSL.new(:new_enquiry)}
it "initializes with name" do
definition_dsl.attributes[:name].should eq :new_enquiry
end
it "adds an actor to the definition" do
dsl = definition_dsl
dsl.actor(:user, :cache => [... | ruby | MIT | 2f6134437ba8f2364c12c0d836d4908be8a6b648 | 2026-01-04T17:47:35.818726Z | false |
christospappas/streama | https://github.com/christospappas/streama/blob/2f6134437ba8f2364c12c0d836d4908be8a6b648/lib/streama.rb | lib/streama.rb | require "mongoid"
require "streama/version"
require "streama/actor"
require "streama/activity"
require "streama/definition"
require "streama/definition_dsl"
require "streama/errors" | ruby | MIT | 2f6134437ba8f2364c12c0d836d4908be8a6b648 | 2026-01-04T17:47:35.818726Z | false |
christospappas/streama | https://github.com/christospappas/streama/blob/2f6134437ba8f2364c12c0d836d4908be8a6b648/lib/streama/version.rb | lib/streama/version.rb | module Streama
VERSION = "0.3.8"
end
| ruby | MIT | 2f6134437ba8f2364c12c0d836d4908be8a6b648 | 2026-01-04T17:47:35.818726Z | false |
christospappas/streama | https://github.com/christospappas/streama/blob/2f6134437ba8f2364c12c0d836d4908be8a6b648/lib/streama/definition_dsl.rb | lib/streama/definition_dsl.rb | module Streama
class DefinitionDSL
attr_reader :attributes
def initialize(name)
@attributes = {
:name => name.to_sym,
:actor => {},
:object => {},
:target_object => {}
}
end
delegate :[], :to => :@attributes
def self.data_methods(*args)
args.e... | ruby | MIT | 2f6134437ba8f2364c12c0d836d4908be8a6b648 | 2026-01-04T17:47:35.818726Z | false |
christospappas/streama | https://github.com/christospappas/streama/blob/2f6134437ba8f2364c12c0d836d4908be8a6b648/lib/streama/errors.rb | lib/streama/errors.rb | module Streama
module Errors
class StreamaError < StandardError
end
class InvalidActivity < StreamaError
end
# This error is raised when an object isn't defined
# as an actor, object or target
#
# Example:
#
# <tt>InvalidField.new('field_name')</tt>
class Invali... | ruby | MIT | 2f6134437ba8f2364c12c0d836d4908be8a6b648 | 2026-01-04T17:47:35.818726Z | false |
christospappas/streama | https://github.com/christospappas/streama/blob/2f6134437ba8f2364c12c0d836d4908be8a6b648/lib/streama/actor.rb | lib/streama/actor.rb | module Streama
module Actor
extend ActiveSupport::Concern
included do
raise Errors::NotMongoid, "Must be included in a Mongoid::Document" unless self.ancestors.include? Mongoid::Document
cattr_accessor :activity_klass
end
module ClassMethods
def activity_class(... | ruby | MIT | 2f6134437ba8f2364c12c0d836d4908be8a6b648 | 2026-01-04T17:47:35.818726Z | false |
christospappas/streama | https://github.com/christospappas/streama/blob/2f6134437ba8f2364c12c0d836d4908be8a6b648/lib/streama/activity.rb | lib/streama/activity.rb | module Streama
module Activity
extend ActiveSupport::Concern
included do
include Mongoid::Document
include Mongoid::Timestamps
field :verb, :type => Symbol
field :actor
field :object
field :target_object
field :receivers, :type => Array
index({ ... | ruby | MIT | 2f6134437ba8f2364c12c0d836d4908be8a6b648 | 2026-01-04T17:47:35.818726Z | false |
christospappas/streama | https://github.com/christospappas/streama/blob/2f6134437ba8f2364c12c0d836d4908be8a6b648/lib/streama/definition.rb | lib/streama/definition.rb | module Streama
class Definition
attr_reader :name, :actor, :object, :target_object, :receivers
# @param dsl [Streama::DefinitionDSL] A DSL object
def initialize(definition)
@name = definition[:name]
@actor = definition[:actor] || {}
@object = definition[:object] || {}
... | ruby | MIT | 2f6134437ba8f2364c12c0d836d4908be8a6b648 | 2026-01-04T17:47:35.818726Z | false |
gottfrois/grape-attack | https://github.com/gottfrois/grape-attack/blob/cb7e6fddd13e9e4d4241521f96404abb7c628abf/spec/spec_helper.rb | spec/spec_helper.rb | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'grape/attack'
| ruby | MIT | cb7e6fddd13e9e4d4241521f96404abb7c628abf | 2026-01-04T17:47:37.008215Z | false |
gottfrois/grape-attack | https://github.com/gottfrois/grape-attack/blob/cb7e6fddd13e9e4d4241521f96404abb7c628abf/spec/grape/attack_spec.rb | spec/grape/attack_spec.rb | require 'spec_helper'
describe Grape::Attack do
it 'has a version number' do
expect(Grape::Attack::VERSION).not_to be nil
end
it 'does something useful' do
expect(false).to eq(true)
end
end
| ruby | MIT | cb7e6fddd13e9e4d4241521f96404abb7c628abf | 2026-01-04T17:47:37.008215Z | false |
gottfrois/grape-attack | https://github.com/gottfrois/grape-attack/blob/cb7e6fddd13e9e4d4241521f96404abb7c628abf/lib/grape/attack.rb | lib/grape/attack.rb | require 'active_support/core_ext/numeric/time.rb'
require 'grape'
require 'grape/attack/version'
require 'grape/attack/adapters/redis'
require 'grape/attack/adapters/memory'
require 'grape/attack/configurable'
require 'grape/attack/extension'
require 'grape/attack/exceptions'
require 'grape/attack/throttle'
module Gr... | ruby | MIT | cb7e6fddd13e9e4d4241521f96404abb7c628abf | 2026-01-04T17:47:37.008215Z | false |
gottfrois/grape-attack | https://github.com/gottfrois/grape-attack/blob/cb7e6fddd13e9e4d4241521f96404abb7c628abf/lib/grape/attack/version.rb | lib/grape/attack/version.rb | module Grape
module Attack
VERSION = '0.3.0'
end
end
| ruby | MIT | cb7e6fddd13e9e4d4241521f96404abb7c628abf | 2026-01-04T17:47:37.008215Z | false |
gottfrois/grape-attack | https://github.com/gottfrois/grape-attack/blob/cb7e6fddd13e9e4d4241521f96404abb7c628abf/lib/grape/attack/limiter.rb | lib/grape/attack/limiter.rb | require 'grape/attack/request'
require 'grape/attack/counter'
module Grape
module Attack
class Limiter
attr_reader :request, :adapter, :counter
def initialize(env, adapter = ::Grape::Attack.config.adapter)
@request = ::Grape::Attack::Request.new(env)
@adapter = adapter
@coun... | ruby | MIT | cb7e6fddd13e9e4d4241521f96404abb7c628abf | 2026-01-04T17:47:37.008215Z | false |
gottfrois/grape-attack | https://github.com/gottfrois/grape-attack/blob/cb7e6fddd13e9e4d4241521f96404abb7c628abf/lib/grape/attack/exceptions.rb | lib/grape/attack/exceptions.rb | module Grape
module Attack
StoreError = Class.new(StandardError)
Exceptions = Class.new(StandardError)
RateLimitExceededError = Class.new(Exceptions)
end
end
| ruby | MIT | cb7e6fddd13e9e4d4241521f96404abb7c628abf | 2026-01-04T17:47:37.008215Z | false |
gottfrois/grape-attack | https://github.com/gottfrois/grape-attack/blob/cb7e6fddd13e9e4d4241521f96404abb7c628abf/lib/grape/attack/options.rb | lib/grape/attack/options.rb | require 'active_model'
module Grape
module Attack
class Options
include ActiveModel::Model
include ActiveModel::Validations
attr_accessor :max, :per, :identifier, :remaining
class ProcOrNumberValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
... | ruby | MIT | cb7e6fddd13e9e4d4241521f96404abb7c628abf | 2026-01-04T17:47:37.008215Z | false |
gottfrois/grape-attack | https://github.com/gottfrois/grape-attack/blob/cb7e6fddd13e9e4d4241521f96404abb7c628abf/lib/grape/attack/configuration.rb | lib/grape/attack/configuration.rb | module Grape
module Attack
class Configuration
attr_accessor :adapter, :disable
def initialize
@adapter = ::Grape::Attack::Adapters::Redis.new
@disable = Proc.new { false }
end
end
end
end
| ruby | MIT | cb7e6fddd13e9e4d4241521f96404abb7c628abf | 2026-01-04T17:47:37.008215Z | false |
gottfrois/grape-attack | https://github.com/gottfrois/grape-attack/blob/cb7e6fddd13e9e4d4241521f96404abb7c628abf/lib/grape/attack/counter.rb | lib/grape/attack/counter.rb | module Grape
module Attack
class Counter
attr_reader :request, :adapter
def initialize(request, adapter)
@request = request
@adapter = adapter
end
def value
@value ||= begin
adapter.get(key).to_i
rescue ::Grape::Attack::StoreError
1
... | ruby | MIT | cb7e6fddd13e9e4d4241521f96404abb7c628abf | 2026-01-04T17:47:37.008215Z | false |
gottfrois/grape-attack | https://github.com/gottfrois/grape-attack/blob/cb7e6fddd13e9e4d4241521f96404abb7c628abf/lib/grape/attack/request.rb | lib/grape/attack/request.rb | require 'grape/attack/options'
module Grape
module Attack
class Request
attr_reader :env, :context, :request, :throttle_options
def initialize(env)
@env = env
@context = env['api.endpoint']
@request = @context.routes.first
@throttle_opt... | ruby | MIT | cb7e6fddd13e9e4d4241521f96404abb7c628abf | 2026-01-04T17:47:37.008215Z | false |
gottfrois/grape-attack | https://github.com/gottfrois/grape-attack/blob/cb7e6fddd13e9e4d4241521f96404abb7c628abf/lib/grape/attack/extension.rb | lib/grape/attack/extension.rb | module Grape
module Attack
module Extension
def throttle(options = {})
route_setting(:throttle, options)
options
end
::Grape::API.extend self
end
end
end
| ruby | MIT | cb7e6fddd13e9e4d4241521f96404abb7c628abf | 2026-01-04T17:47:37.008215Z | false |
gottfrois/grape-attack | https://github.com/gottfrois/grape-attack/blob/cb7e6fddd13e9e4d4241521f96404abb7c628abf/lib/grape/attack/throttle.rb | lib/grape/attack/throttle.rb | require 'grape/attack/limiter'
module Grape
module Attack
class Throttle < Grape::Middleware::Base
def before
::Grape::Attack::Limiter.new(env).call!
end
def after
request = ::Grape::Attack::Request.new(env)
return if ::Grape::Attack.config.disable.call
return... | ruby | MIT | cb7e6fddd13e9e4d4241521f96404abb7c628abf | 2026-01-04T17:47:37.008215Z | false |
gottfrois/grape-attack | https://github.com/gottfrois/grape-attack/blob/cb7e6fddd13e9e4d4241521f96404abb7c628abf/lib/grape/attack/configurable.rb | lib/grape/attack/configurable.rb | require 'grape/attack/configuration'
module Grape
module Attack
module Configurable
def config
@config ||= ::Grape::Attack::Configuration.new
end
def configure
yield config if block_given?
end
end
end
end
| ruby | MIT | cb7e6fddd13e9e4d4241521f96404abb7c628abf | 2026-01-04T17:47:37.008215Z | false |
gottfrois/grape-attack | https://github.com/gottfrois/grape-attack/blob/cb7e6fddd13e9e4d4241521f96404abb7c628abf/lib/grape/attack/adapters/memory.rb | lib/grape/attack/adapters/memory.rb | module Grape
module Attack
module Adapters
class Memory
attr_reader :data
def initialize
@data = {}
end
def get(key)
data[key]
end
def incr(key)
data[key] ||= 0
data[key] += 1
end
def expire(key, ttl... | ruby | MIT | cb7e6fddd13e9e4d4241521f96404abb7c628abf | 2026-01-04T17:47:37.008215Z | false |
gottfrois/grape-attack | https://github.com/gottfrois/grape-attack/blob/cb7e6fddd13e9e4d4241521f96404abb7c628abf/lib/grape/attack/adapters/redis.rb | lib/grape/attack/adapters/redis.rb | require 'redis-namespace'
module Grape
module Attack
module Adapters
class Redis
attr_reader :broker
def initialize
@broker = ::Redis::Namespace.new("grape-attack:#{env}:thottle", redis: ::Redis.new(url: url))
end
def get(key)
with_custom_exception do
... | ruby | MIT | cb7e6fddd13e9e4d4241521f96404abb7c628abf | 2026-01-04T17:47:37.008215Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/app/jobs/lets_encrypt/application_job.rb | app/jobs/lets_encrypt/application_job.rb | # frozen_string_literal: true
module LetsEncrypt
class ApplicationJob < ActiveJob::Base
end
end
| ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/app/jobs/lets_encrypt/renew_certificates_job.rb | app/jobs/lets_encrypt/renew_certificates_job.rb | # frozen_string_literal: true
module LetsEncrypt
# :nodoc:
class RenewCertificatesJob < ApplicationJob
queue_as :default
def perform
service = LetsEncrypt::RenewService.new
LetsEncrypt.certificate_model.renewable.each do |certificate|
service.execute(certificate)
rescue LetsEncr... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/app/controllers/lets_encrypt/verifications_controller.rb | app/controllers/lets_encrypt/verifications_controller.rb | # frozen_string_literal: true
require_dependency 'lets_encrypt/application_controller'
module LetsEncrypt
# :nodoc:
class VerificationsController < ApplicationController
def show
return render_verification_string if certificate.present?
render plain: 'Verification not found', status: :not_found
... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/app/controllers/lets_encrypt/application_controller.rb | app/controllers/lets_encrypt/application_controller.rb | # frozen_string_literal: true
module LetsEncrypt
# :nodoc:
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
end
end
| ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/app/models/lets_encrypt/certificate.rb | app/models/lets_encrypt/certificate.rb | # frozen_string_literal: true
module LetsEncrypt
# == Schema Information
#
# Table name: letsencrypt_certificates
#
# id :integer not null, primary key
# domain :string(255)
# certificate :text(65535)
# intermediaries :text(65535)
# key ... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/rails_helper.rb | spec/rails_helper.rb | # frozen_string_literal: true
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('dummy/config/environment', __dir__)
# Prevent database truncation if the environment is production
abort('The Rails environment is running... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/letsencrypt_spec.rb | spec/letsencrypt_spec.rb | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe LetsEncrypt do
let(:tempfile) { Tempfile.new }
let(:key) { OpenSSL::PKey::RSA.new(2048) }
before do
LetsEncrypt.class_eval do
@private_key = nil
@endpoint = nil
end
LetsEncrypt.config.private_key_path = tempfile.path
... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, withou... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/jobs/lets_encrypt/renew_certificates_job_spec.rb | spec/jobs/lets_encrypt/renew_certificates_job_spec.rb | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe LetsEncrypt::RenewCertificatesJob, type: :job do
subject(:renew) { LetsEncrypt::RenewCertificatesJob.perform_now }
let(:certificate) { LetsEncrypt::Certificate.create!(domain: 'example.com') }
let(:pem) do
<<~PEM
-----BEGIN CERTIFICA... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/support/acme.rb | spec/support/acme.rb | # frozen_string_literal: true
module AcmeTestHelper # rubocop:disable Metrics/ModuleLength
# This module contains helper methods to stub ACME requests
# in the tests. It uses WebMock to intercept HTTP requests
# and return predefined responses.
DIRECTORY_BODY = <<~JSON
{
"keyChange": "https://... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/controllers/lets_encrypt/verifications_controller_spec.rb | spec/controllers/lets_encrypt/verifications_controller_spec.rb | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe LetsEncrypt::VerificationsController, type: :controller do
routes { LetsEncrypt::Engine.routes }
subject { get :show, params: { verification_path: } }
let(:verification_path) { :invalid_path }
describe 'with invalid path' do
it { is_exp... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/models/lets_encrypt/certificate_spec.rb | spec/models/lets_encrypt/certificate_spec.rb | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe LetsEncrypt::Certificate do
subject(:cert) { LetsEncrypt::Certificate.new(domain: 'example.com') }
let(:key) { OpenSSL::PKey::RSA.new(4096) }
let(:pem) do
<<~PEM
-----BEGIN CERTIFICATE-----
MIICjzCCAXcCAQAwDQYJKoZIhvcNAQELBQAwA... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/app/jobs/application_job.rb | spec/dummy/app/jobs/application_job.rb | class ApplicationJob < ActiveJob::Base
# Automatically retry jobs that encountered a deadlock
# retry_on ActiveRecord::Deadlocked
# Most jobs are safe to ignore if the underlying records are no longer available
# discard_on ActiveJob::DeserializationError
end
| ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/app/helpers/application_helper.rb | spec/dummy/app/helpers/application_helper.rb | module ApplicationHelper
end
| ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/app/controllers/application_controller.rb | spec/dummy/app/controllers/application_controller.rb | class ApplicationController < ActionController::Base
end
| ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/app/models/application_record.rb | spec/dummy/app/models/application_record.rb | class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
| ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/app/mailers/application_mailer.rb | spec/dummy/app/mailers/application_mailer.rb | class ApplicationMailer < ActionMailer::Base
default from: 'from@example.com'
layout 'mailer'
end
| ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/db/schema.rb | spec/dummy/db/schema.rb | # 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... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/db/migrate/20200211034819_create_letsencrypt_certificates.rb | spec/dummy/db/migrate/20200211034819_create_letsencrypt_certificates.rb | # frozen_string_literal: true
# :nodoc:
class CreateLetsencryptCertificates < ActiveRecord::Migration[5.2]
def change
create_table :letsencrypt_certificates do |t|
t.string :domain
t.text :certificate, limit: 65535
t.text :intermediaries, limit: 65535
t.text :key, limit: 655... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/config/application.rb | spec/dummy/config/application.rb | # frozen_string_literal: true
require 'rails/version'
require_relative 'boot'
require 'rails/all'
Bundler.require(*Rails.groups)
require 'rails-letsencrypt'
module Dummy
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
case Rails::VERSION:... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/config/environment.rb | spec/dummy/config/environment.rb | # Load the Rails application.
require_relative 'application'
# Initialize the Rails application.
Rails.application.initialize!
| ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/config/puma.rb | spec/dummy/config/puma.rb | # Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/config/routes.rb | spec/dummy/config/routes.rb | Rails.application.routes.draw do
mount LetsEncrypt::Engine => '/.well-known'
end
| ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/config/spring.rb | spec/dummy/config/spring.rb | Spring.watch(
".ruby-version",
".rbenv-vars",
"tmp/restart.txt",
"tmp/caching-dev.txt"
)
| ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/config/boot.rb | spec/dummy/config/boot.rb | # Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
$LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
| ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/config/initializers/content_security_policy.rb | spec/dummy/config/initializers/content_security_policy.rb | # Be sure to restart your server when you modify this file.
# Define an application-wide content security policy
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
# Rails.application.config.content_security_policy do |policy|
... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/config/initializers/filter_parameter_logging.rb | spec/dummy/config/initializers/filter_parameter_logging.rb | # Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]
| ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/config/initializers/application_controller_renderer.rb | spec/dummy/config/initializers/application_controller_renderer.rb | # Be sure to restart your server when you modify this file.
# ActiveSupport::Reloader.to_prepare do
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
# end
| ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/config/initializers/wrap_parameters.rb | spec/dummy/config/initializers/wrap_parameters.rb | # Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters f... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/config/initializers/inflections.rb | spec/dummy/config/initializers/inflections.rb | # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflec... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/config/initializers/cookies_serializer.rb | spec/dummy/config/initializers/cookies_serializer.rb | # Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails.application.config.action_dispatch.cookies_serializer = :json
| ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/config/initializers/backtrace_silencers.rb | spec/dummy/config/initializers/backtrace_silencers.rb | # Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a probl... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/config/initializers/mime_types.rb | spec/dummy/config/initializers/mime_types.rb | # Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
| ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/config/environments/test.rb | spec/dummy/config/environments/test.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 test runs. Don't rely on the data there!
Rails.application.configure do
# Settings... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/config/environments/development.rb | spec/dummy/config/environments/development.rb | Rails.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 serv... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/dummy/config/environments/production.rb | spec/dummy/config/environments/production.rb | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/letsencrypt/redis_spec.rb | spec/letsencrypt/redis_spec.rb | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe LetsEncrypt::Redis do
let(:redis) { double(Redis) }
let(:domain) { 'example.com' }
let(:certificate) do
LetsEncrypt::Certificate.new(domain:, key: 'KEY', certificate: 'CERTIFICATE')
end
before(:each) do
allow(Redis).to receive(:new... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/letsencrypt/configuration_spec.rb | spec/letsencrypt/configuration_spec.rb | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe LetsEncrypt::Configuration do
subject(:config) { LetsEncrypt::Configuration.new }
describe '#use_redis?' do
before { config.save_to_redis = true }
it { is_expected.to be_use_redis }
end
describe '#use_staging?' do
before { conf... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/letsencrypt/renew_service_spec.rb | spec/letsencrypt/renew_service_spec.rb | # frozen_string_literal: true
RSpec.describe LetsEncrypt::RenewService do
subject(:renew) { service.execute(certificate) }
let(:service) { described_class.new }
let(:certificate) { LetsEncrypt::Certificate.create!(domain: 'example.com') }
let(:pem) do
<<~PEM
-----BEGIN CERTIFICATE-----
MIICjzC... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/letsencrypt/generators/lets_encrypt/register_generator_spec.rb | spec/letsencrypt/generators/lets_encrypt/register_generator_spec.rb | # frozen_string_literal: true
require 'rails_helper'
require 'rails/generators/test_case'
require 'generators/lets_encrypt/register_generator'
RSpec.describe LetsEncrypt::Generators::RegisterGenerator do
let(:klass) do
Class.new(Rails::Generators::TestCase) do
tests LetsEncrypt::Generators::RegisterGenera... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/spec/letsencrypt/generators/lets_encrypt/install_generator_spec.rb | spec/letsencrypt/generators/lets_encrypt/install_generator_spec.rb | # frozen_string_literal: true
require 'rails_helper'
require 'rails/generators/test_case'
require 'generators/lets_encrypt/install_generator'
RSpec.describe LetsEncrypt::Generators::InstallGenerator do
let(:klass) do
Class.new(Rails::Generators::TestCase) do
tests LetsEncrypt::Generators::InstallGenerator... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/lib/rails-letsencrypt.rb | lib/rails-letsencrypt.rb | # frozen_string_literal: true
require 'letsencrypt'
| ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/lib/letsencrypt.rb | lib/letsencrypt.rb | # frozen_string_literal: true
require 'openssl'
require 'acme-client'
require 'redis'
require 'letsencrypt/railtie'
require 'letsencrypt/engine'
require 'letsencrypt/errors'
require 'letsencrypt/configuration'
require 'letsencrypt/redis'
require 'letsencrypt/status_checker'
require 'letsencrypt/verify_service'
require... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/lib/generators/lets_encrypt/register_generator.rb | lib/generators/lets_encrypt/register_generator.rb | # frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/migration'
require 'rails/generators/active_record'
module LetsEncrypt
module Generators
# :nodoc:
class RegisterGenerator < ::Rails::Generators::Base
def register
say 'Starting register Let\'s Encrypt account',... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/lib/generators/lets_encrypt/install_generator.rb | lib/generators/lets_encrypt/install_generator.rb | # frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/migration'
require 'rails/generators/active_record'
module LetsEncrypt
module Generators
# :nodoc:
class InstallGenerator < ::Rails::Generators::Base
include ::Rails::Generators::Migration
source_root File.expand... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/lib/generators/lets_encrypt/templates/letsencrypt.rb | lib/generators/lets_encrypt/templates/letsencrypt.rb | LetsEncrypt.config do |config|
# Configure the ACME server
# Default is Let's Encrypt production server
# config.acme_server = 'https://acme-v02.api.letsencrypt.org/directory'
# Using Let's Encrypt staging server or not
# Default only `Rails.env.production? == true` will use Let's Encrypt production server.
... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/lib/generators/lets_encrypt/templates/migration.rb | lib/generators/lets_encrypt/templates/migration.rb | # frozen_string_literal: true
# :nodoc:
class CreateLetsencryptCertificates < ActiveRecord::Migration<%= migration_version %>
def change
create_table :letsencrypt_certificates do |t|
t.string :domain
t.text :certificate, limit: 65535
t.text :intermediaries, limit: 65535
t.text ... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/lib/letsencrypt/version.rb | lib/letsencrypt/version.rb | # frozen_string_literal: true
module LetsEncrypt
VERSION = '0.13.0'
end
| ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
elct9620/rails-letsencrypt | https://github.com/elct9620/rails-letsencrypt/blob/ff544157f89112d81573dfa1151dea6d97c88c28/lib/letsencrypt/status_checker.rb | lib/letsencrypt/status_checker.rb | # frozen_string_literal: true
module LetsEncrypt
# The status checker to make a loop until the status is reached
class StatusChecker
attr_reader :max_attempts, :interval
def initialize(max_attempts:, interval:)
@max_attempts = max_attempts
@interval = interval
end
def execute
at... | ruby | MIT | ff544157f89112d81573dfa1151dea6d97c88c28 | 2026-01-04T17:47:41.292155Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.