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 |
|---|---|---|---|---|---|---|---|---|
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/app/models/passkit/pass.rb | app/models/passkit/pass.rb | module Passkit
class Pass < ActiveRecord::Base
validates_uniqueness_of :serial_number
validates_presence_of :klass
belongs_to :generator, polymorphic: true, optional: true
has_many :registrations, foreign_key: :passkit_pass_id
has_many :devices, through: :registrations
delegate :apple_team_i... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/app/models/passkit/log.rb | app/models/passkit/log.rb | module Passkit
class Log < ActiveRecord::Base
end
end
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/app/models/passkit/registration.rb | app/models/passkit/registration.rb | module Passkit
class Registration < ActiveRecord::Base
belongs_to :device, foreign_key: :passkit_device_id
belongs_to :pass, foreign_key: :passkit_pass_id
end
end
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/app/models/passkit/device.rb | app/models/passkit/device.rb | module Passkit
class Device < ActiveRecord::Base
validates_uniqueness_of :identifier
has_many :registrations, foreign_key: :passkit_device_id
has_many :passes, through: :registrations
end
end
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/app/mailers/passkit/example_mailer.rb | app/mailers/passkit/example_mailer.rb | module Passkit
class ExampleMailer < ActionMailer::Base
def example_email
@passkit_url_generator = Passkit::UrlGenerator.new(Passkit::ExampleStoreCard, nil)
mail(to: "passkit@example.com", subject: "Here is an example of a passkit email")
end
end
end
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/test_passkit.rb | test/test_passkit.rb | # frozen_string_literal: true
require "test_helper"
class TestPasskit < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::Passkit::VERSION
end
end
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/rails_helper.rb | test/rails_helper.rb | # frozen_string_literal: true
#
# $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
# require "passkit"
#
# require "minitest/autorun"
# Configure Rails Environment
ENV["RAILS_ENV"] = "test"
require "dotenv/load"
require_relative "../test/dummy/config/environment"
ActiveRecord::Migrator.migrations_paths = [File.... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/test_helper.rb | test/test_helper.rb | # frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "dotenv/load"
require "passkit"
require "minitest/autorun"
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/example_qr_code_pass.rb | test/example_qr_code_pass.rb | # frozen_string_literal: true
module Passkit
class ExampleQrCodePass < BasePass
def header_fields
[{
key: "value",
label: "Value",
value: 100,
currencyCode: "CHF"
}]
end
def back_fields
[{
key: "code",
label: "Code",
value: "https... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/system/logs_dashboard_test.rb | test/system/logs_dashboard_test.rb | require "rails_helper"
class LogsDashboardTest < ActionDispatch::SystemTestCase
include Passkit::Engine.routes.url_helpers
setup do
@routes = Passkit::Engine.routes
end
def authorize
visit "http://#{ENV["PASSKIT_DASHBOARD_USERNAME"]}:#{ENV["PASSKIT_DASHBOARD_PASSWORD"]}@#{Capybara.current_session.ser... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/api/v1/test_registrations_controller.rb | test/api/v1/test_registrations_controller.rb | # frozen_string_literal: true
require "rails_helper"
class TestRegistrationsController < ActionDispatch::IntegrationTest
include Passkit::Engine.routes.url_helpers
setup do
@routes = Passkit::Engine.routes
end
def test_create
Passkit::Factory.create_pass(Passkit::ExampleStoreCard)
Passkit::Facto... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/api/v1/test_passes_controller.rb | test/api/v1/test_passes_controller.rb | # frozen_string_literal: true
require "rails_helper"
class TestPassesController < ActionDispatch::IntegrationTest
include Passkit::Engine.routes.url_helpers
setup do
@routes = Passkit::Engine.routes
end
def test_create
payload = Passkit::PayloadGenerator.encrypted(Passkit::ExampleStoreCard)
get ... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/api/v1/test_logs_controller.rb | test/api/v1/test_logs_controller.rb | # frozen_string_literal: true
require "rails_helper"
class TestLogsController < ActionDispatch::IntegrationTest
include Passkit::Engine.routes.url_helpers
setup do
@routes = Passkit::Engine.routes
end
def test_show
post log_url, params: {"logs" => ["message 1", "message 2", "message 3"]}
assert_e... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/app/jobs/application_job.rb | test/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 | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/app/helpers/application_helper.rb | test/dummy/app/helpers/application_helper.rb | module ApplicationHelper
end
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/app/controllers/application_controller.rb | test/dummy/app/controllers/application_controller.rb | class ApplicationController < ActionController::Base
end
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/app/models/ticket.rb | test/dummy/app/models/ticket.rb | class Ticket < ApplicationRecord
belongs_to :user
end
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/app/models/application_record.rb | test/dummy/app/models/application_record.rb | class ApplicationRecord < ActiveRecord::Base
primary_abstract_class
end
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/app/models/user.rb | test/dummy/app/models/user.rb | class User < ApplicationRecord
has_many :tickets
end
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/app/lib/passkit/user_ticket.rb | test/dummy/app/lib/passkit/user_ticket.rb | module Passkit
class UserTicket < BasePass
def pass_type
:eventTicket
end
def organization_name
"Passkit"
end
def description
"A basic description for a pass"
end
# A pass can have up to ten relevant locations
#
# @see https://developer.apple.com/library/archiv... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/app/lib/passkit/user_store_card.rb | test/dummy/app/lib/passkit/user_store_card.rb | module Passkit
class UserStoreCard < BasePass
def pass_type
:storeCard
end
def organization_name
"Passkit"
end
def description
"A basic description for a pass"
end
# A pass can have up to ten relevant locations
#
# @see https://developer.apple.com/library/archi... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/app/mailers/application_mailer.rb | test/dummy/app/mailers/application_mailer.rb | class ApplicationMailer < ActionMailer::Base
default from: "from@example.com"
layout "mailer"
end
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/app/channels/application_cable/channel.rb | test/dummy/app/channels/application_cable/channel.rb | module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/app/channels/application_cable/connection.rb | test/dummy/app/channels/application_cable/connection.rb | module ApplicationCable
class Connection < ActionCable::Connection::Base
end
end
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/db/seeds.rb | test/dummy/db/seeds.rb | @user1 = User.create!(name: "First User")
@user2 = User.create!(name: "Second User")
Ticket.create!(name: "Ticket1", user: @user1)
Ticket.create!(name: "Ticket2", user: @user1)
Ticket.create!(name: "Ticket3", user: @user2) | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/db/schema.rb | test/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.
#
# This file is the source Rails uses to define your schema when running `bin/rai... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/db/migrate/20220923124956_create_passkit_tables.rb | test/dummy/db/migrate/20220923124956_create_passkit_tables.rb | class CreatePasskitTables < ActiveRecord::Migration[7.0]
def change
create_table :passkit_passes do |t|
t.string :generator_type
t.string :klass
t.bigint :generator_id
t.string :serial_number
t.string :authentication_token
t.json :data
t.integer :version
t.timestamp... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/db/migrate/20240411013721_create_tickets.rb | test/dummy/db/migrate/20240411013721_create_tickets.rb | class CreateTickets < ActiveRecord::Migration[7.1]
def change
create_table :tickets do |t|
t.string :name
t.references :user, null: false, foreign_key: true
t.timestamps
end
end
end
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/db/migrate/20240411013524_create_users.rb | test/dummy/db/migrate/20240411013524_create_users.rb | class CreateUsers < ActiveRecord::Migration[7.1]
def change
create_table :users do |t|
t.string :name
t.timestamps
end
end
end
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/config/application.rb | test/dummy/config/application.rb | require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
require "passkit"
module Dummy
class Application < Rails::Application
config.load_defaults Rails::VERSION::STRING.to_f
... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/config/environment.rb | test/dummy/config/environment.rb | # Load the Rails application.
require_relative "application"
# Initialize the Rails application.
Rails.application.initialize!
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/config/puma.rb | test/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 | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/config/routes.rb | test/dummy/config/routes.rb | Rails.application.routes.draw do
mount Passkit::Engine => "/passkit"
end
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/config/boot.rb | test/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 | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/config/initializers/content_security_policy.rb | test/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.
# See the Securing Rails Applications Guide for more information:
# https://guides.rubyonrails.org/security.html#content-security-policy-header
# Rails.application.configure do
# config.content_security... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/config/initializers/filter_parameter_logging.rb | test/dummy/config/initializers/filter_parameter_logging.rb | # Be sure to restart your server when you modify this file.
# Configure parameters to be filtered from the log file. Use this to limit dissemination of
# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
# notations and behaviors.
Rails.application.config.filter_parameters += [
... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/config/initializers/inflections.rb | test/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 | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/config/initializers/permissions_policy.rb | test/dummy/config/initializers/permissions_policy.rb | # Define an application-wide HTTP permissions policy. For further
# information see https://developers.google.com/web/updates/2018/06/feature-policy
#
# Rails.application.config.permissions_policy do |f|
# f.camera :none
# f.gyroscope :none
# f.microphone :none
# f.usb :none
# f.fullscreen :s... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/config/initializers/assets.rb | test/dummy/config/initializers/assets.rb | # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
# Rails.application.config.assets.version = "1.0"
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile addition... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/config/initializers/passkit.rb | test/dummy/config/initializers/passkit.rb | Passkit.configure do |config|
config.available_passes['Passkit::UserStoreCard'] = -> { User.create!(name: "ExampleName") }
end
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/config/environments/test.rb | test/dummy/config/environments/test.rb | require "active_support/core_ext/integer/time"
# 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 the... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/config/environments/development.rb | test/dummy/config/environments/development.rb | require "active_support/core_ext/integer/time"
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 any time
# it changes. This slows down response time but is perfect for developme... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/test/dummy/config/environments/production.rb | test/dummy/config/environments/production.rb | require "active_support/core_ext/integer/time"
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 applica... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/lib/passkit.rb | lib/passkit.rb | # frozen_string_literal: true
require "rails"
require "passkit/engine"
require "zeitwerk"
loader = Zeitwerk::Loader.for_gem
loader.ignore("#{__dir__}/generators")
loader.setup
module Passkit
class Error < StandardError; end
class << self
attr_accessor :configuration
end
def self.configure
self.conf... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/lib/generators/passkit/install_generator.rb | lib/generators/passkit/install_generator.rb | # frozen_string_literal: true
require "rails/generators/base"
require "rails/generators/migration"
module Passkit
module Generators
class InstallGenerator < Rails::Generators::Base
include Rails::Generators::Migration
source_root File.expand_path("../../templates", __FILE__)
# Implement the ... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/lib/generators/templates/passkit.rb | lib/generators/templates/passkit.rb | Passkit.configure do |config|
# config.available_passes['Passkit::YourPass'] = -> { User.create }
end
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/lib/passkit/version.rb | lib/passkit/version.rb | # frozen_string_literal: true
module Passkit
VERSION = "0.7.0"
end
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/lib/passkit/base_pass.rb | lib/passkit/base_pass.rb | module Passkit
class BasePass
def initialize(generator = nil)
@generator = generator
end
def format_version
ENV["PASSKIT_FORMAT_VERSION"] || 1
end
def apple_team_identifier
ENV["PASSKIT_APPLE_TEAM_IDENTIFIER"] || raise(Error.new("Missing environment variable: PASSKIT_APPLE_TEAM... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/lib/passkit/example_store_card.rb | lib/passkit/example_store_card.rb | module Passkit
class ExampleStoreCard < BasePass
def pass_type
:storeCard
# :coupon
end
def foreground_color
"rgb(0, 0, 0)"
end
def background_color
"rgb(255, 255, 255)"
end
def organization_name
"Passkit"
end
def description
"A basic descrip... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/lib/passkit/url_encrypt.rb | lib/passkit/url_encrypt.rb | module Passkit
class UrlEncrypt
class << self
def encrypt(payload)
string = payload.to_json
cipher = cypher.encrypt
cipher.key = encryption_key
s = cipher.update(string) + cipher.final
s.unpack1("H*").upcase
end
def decrypt(string)
cipher = cyphe... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/lib/passkit/generator.rb | lib/passkit/generator.rb | require "zip"
module Passkit
class Generator
TMP_FOLDER = Rails.root.join("tmp/passkit").freeze
def initialize(pass)
@pass = pass
@generator = pass.generator
end
def generate_and_sign
check_necessary_files
create_temporary_directory
copy_pass_to_tmp_location
@pas... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/lib/passkit/factory.rb | lib/passkit/factory.rb | module Passkit
class Factory
class << self
# generator is an optional ActiveRecord object, the application data for the pass
def create_pass(pass_class, generator = nil)
pass = Passkit::Pass.create!(klass: pass_class, generator: generator)
Passkit::Generator.new(pass).generate_and_sign... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/lib/passkit/payload_generator.rb | lib/passkit/payload_generator.rb | module Passkit
class PayloadGenerator
VALIDITY = 30.days
def self.encrypted(pass_class, generator = nil, collection_name = nil)
UrlEncrypt.encrypt(hash(pass_class, generator, collection_name))
end
def self.hash(pass_class, generator = nil, collection_name = nil)
valid_until = VALIDITY.fr... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/lib/passkit/url_generator.rb | lib/passkit/url_generator.rb | module Passkit
class UrlGenerator
include Passkit::Engine.routes.url_helpers
def initialize(pass_class, generator = nil, collection_name = nil)
@url = passes_api_url(host: ENV["PASSKIT_WEB_SERVICE_HOST"],
payload: PayloadGenerator.encrypted(pass_class, generator, collection_name))
end
... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/lib/passkit/engine.rb | lib/passkit/engine.rb | # frozen_string_literal: true
module Passkit
class Engine < ::Rails::Engine
isolate_namespace Passkit
end
end
| ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
coorasse/passkit | https://github.com/coorasse/passkit/blob/83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f/config/routes.rb | config/routes.rb | # frozen_string_literal: true
Passkit::Engine.routes.draw do
scope :api, constraints: {pass_type_id: /.*/} do
scope :v1 do
resources :devices, only: [] do
post "registrations/:pass_type_id/:serial_number" => "api/v1/registrations#create", :as => :register
delete "registrations/:pass_type_id... | ruby | MIT | 83c9c8ddcf6a7c8b1aa6a971f9c0dc02aef8323f | 2026-01-04T17:57:15.346461Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/benchmark/msgpack-pooling.rb | benchmark/msgpack-pooling.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
require "bundler/setup"
require "paquito"
require "benchmark/ips"
BASELINE = Paquito::CodecFactory.build([Symbol], pool: false)
POOLED = Paquito::CodecFactory.build([Symbol], pool: 1)
PAYLOAD = BASELINE.dump(:foo)
MARSHAL_PAYLOAD = Marshal.dump(:foo)
Benchmark.ips d... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/benchmark/string-bypass.rb | benchmark/string-bypass.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
require "bundler/setup"
require "paquito"
require "benchmark/ips"
CODEC = Paquito::CodecFactory.build([])
VERSIONED = Paquito::SingleBytePrefixVersion.new(0, 0 => CODEC)
BYPASS = Paquito::SingleBytePrefixVersionWithStringBypass.new(0, 0 => CODEC)
[100, 10_000, 1_000_... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/benchmark/flat-entry-coder.rb | benchmark/flat-entry-coder.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
require "bundler/setup"
require "paquito"
require "active_support"
require "benchmark/ips"
CODEC = Paquito::CodecFactory.build
ORIGINAL = Paquito::SingleBytePrefixVersion.new(
0,
0 => Paquito.chain(
Paquito::CacheEntryCoder,
CODEC,
),
)
FLAT = Paquito::F... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/test_helper.rb | test/test_helper.rb | # frozen_string_literal: true
# Load Sorbet runtime early so that all conditional requires
# from this gem are loaded properly below
require "sorbet-runtime"
require "zlib"
require "json"
require "yaml"
require "bigdecimal"
$LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
require "paquito"
require "minitest/a... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/activerecord/codec_factory_test.rb | test/activerecord/codec_factory_test.rb | # frozen_string_literal: true
require "test_helper"
class PaquitoCodecFactoryTest < PaquitoTest
test "correctly encodes ActiveRecord::Base objects" do
codec = Paquito::CodecFactory.build([ActiveRecord::Base])
value = Shop.new
decoded_value = codec.load(codec.dump(value))
assert_equal value.attribu... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/activerecord/test_helper.rb | test/activerecord/test_helper.rb | # frozen_string_literal: true
require File.expand_path("../test_helper.rb", __dir__)
require "active_record"
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
Dir[File.expand_path("support/*.rb", __dir__)].sort.each do |support|
require support
end
| ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/activerecord/active_record_coder_test.rb | test/activerecord/active_record_coder_test.rb | # frozen_string_literal: true
require "test_helper"
class PaquitoActiveRecordCodecTest < PaquitoTest
def setup
@codec = Paquito::ActiveRecordCoder
end
test "correctly encodes AR object with no associations" do
shop = Shop.find_by!(name: "Snow Devil")
encoded_value = @codec.dump(shop)
recovered... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/activerecord/serialized_column_test.rb | test/activerecord/serialized_column_test.rb | # frozen_string_literal: true
require "test_helper"
class PaquitoSerializedColumnTest < PaquitoTest
def setup
@settings = { currency: "€" }.freeze
@model = Shop.create!(name: "Test", settings: @settings)
end
test "deserialize the payload" do
assert_equal "#\xE2\x98\xA01\xE2\x98\xA2\n\x81\xD7\x00cur... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/activerecord/codec_factory_active_record_test.rb | test/activerecord/codec_factory_active_record_test.rb | # frozen_string_literal: true
require "test_helper"
class PaquitoCodecFactoryActiveRecordTest < PaquitoTest
test "MessagePack factory correctly encodes AR::Base objects" do
shop = Shop.preload(:products, :domain).first
codec = Paquito::CodecFactory.build([ActiveRecord::Base])
assert_equal(true, shop.a... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/activerecord/support/models.rb | test/activerecord/support/models.rb | # frozen_string_literal: true
ActiveRecord::Schema.define do
create_table :users, force: true do |t|
t.string(:email)
end
create_table :features, force: true do |t|
t.string(:name)
end
create_table :shops, force: true do |t|
t.string(:name)
t.binary(:settings)
t.references(:owner)
end... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/vanilla/comment_prefix_version_test.rb | test/vanilla/comment_prefix_version_test.rb | # frozen_string_literal: true
require "test_helper"
class PaquitoCommentPrefixVersionTest < PaquitoTest
def setup
@coder = Paquito::CommentPrefixVersion.new(
1,
0 => YAML,
1 => JSON,
2 => MessagePack,
)
end
test "#dump use the current version" do
assert_equal "#☠1☢\n{\"foo\"... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/vanilla/conditional_compressor_test.rb | test/vanilla/conditional_compressor_test.rb | # frozen_string_literal: true
require "test_helper"
class ConditionalCompressorTest < PaquitoTest
def setup
@coder = Paquito::ConditionalCompressor.new(
Zlib,
4,
)
end
test "it does not compress when under the threshold" do
assert_equal "\x00foo".b, @coder.dump("foo")
end
test "it ... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/vanilla/single_byte_prefix_version_test.rb | test/vanilla/single_byte_prefix_version_test.rb | # frozen_string_literal: true
require "test_helper"
class PaquitoSingleBytePrefixVersionTest < PaquitoTest
def setup
@coder = Paquito::SingleBytePrefixVersion.new(
1,
0 => YAML,
1 => JSON,
2 => MessagePack,
)
end
test "#dump use the current version" do
assert_equal "\x01{\"f... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/vanilla/safe_yaml_test.rb | test/vanilla/safe_yaml_test.rb | # frozen_string_literal: true
require "test_helper"
class SafeYAMLTest < PaquitoTest
def setup
@coder = Paquito::SafeYAML.new(
permitted_classes: ["Hash", "Set", "Integer"],
deprecated_classes: ["BigDecimal"],
aliases: true,
)
end
test "#load accepts deprecated classes" do
expecte... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/vanilla/codec_factory_test.rb | test/vanilla/codec_factory_test.rb | # frozen_string_literal: true
require "test_helper"
module Paquito
module SharedCodecFactoryTests
# The difference is in the prefix which contains details about the internal representation (27 vs 9).
# However both versions can read each others fine, so it's not a problem.
RUBY_3_0_BIG_DECIMAL = "\xC7\n... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/vanilla/single_byte_prefix_version_with_string_bypass_test.rb | test/vanilla/single_byte_prefix_version_with_string_bypass_test.rb | # frozen_string_literal: true
require "test_helper"
class PaquitoSingleBytePrefixVersionWithStringBypassTest < PaquitoTest
def setup
@coder = Paquito::SingleBytePrefixVersionWithStringBypass.new(
1,
{ 0 => YAML, 1 => JSON, 2 => MessagePack },
)
end
test "#dump use the current version" do
... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/vanilla/struct_test.rb | test/vanilla/struct_test.rb | # frozen_string_literal: true
require "test_helper"
class PaquitoStructTest < PaquitoTest
FooStruct = Paquito::Struct.new(:foo, :bar)
BarStruct = Paquito::Struct.new(:foo, :bar, keyword_init: true)
BazStruct = Paquito::Struct.new(:baz, keyword_init: true)
test "with keyword_init: false" do
digest = pack_... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/vanilla/translate_errors_test.rb | test/vanilla/translate_errors_test.rb | # frozen_string_literal: true
require "test_helper"
class TranslateErrorsTest < PaquitoTest
def setup
@coder = Paquito::TranslateErrors.new(Marshal)
end
test "#load translate any error to Paquito::UnpackError" do
assert_raises Paquito::UnpackError do
@coder.load("\x00")
end
end
test "#du... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/vanilla/typed_struct_test.rb | test/vanilla/typed_struct_test.rb | # frozen_string_literal: true
require "test_helper"
class PaquitoTypedStructTest < PaquitoTest
class FooStruct < T::Struct
include Paquito::TypedStruct
prop :foo, String
prop :bar, Integer
end
test "#as_pack returns array of digest and struct values" do
digest = pack_digest(FooStruct)
ass... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/vanilla/test_helper.rb | test/vanilla/test_helper.rb | # frozen_string_literal: true
require File.expand_path("../test_helper.rb", __dir__)
Dir[File.expand_path("support/*.rb", __dir__)].sort.each do |support|
require support
end
| ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/vanilla/allow_nil_test.rb | test/vanilla/allow_nil_test.rb | # frozen_string_literal: true
require "test_helper"
class AllowNilTest < PaquitoTest
def setup
@coder = Paquito.allow_nil(Marshal)
end
test "#load returns nil if passed nil" do
assert_nil @coder.load(nil)
end
test "#dump returns nil if passed nil" do
assert_nil @coder.dump(nil)
end
end
| ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/activesupport/cache_entry_coder_test.rb | test/activesupport/cache_entry_coder_test.rb | # frozen_string_literal: true
require "test_helper"
class PaquitoCacheEntryCoderTest < PaquitoTest
def setup
@coder = Paquito.chain(
Paquito::CacheEntryCoder,
JSON,
)
@cache_dir = Dir.mktmpdir
@store = ActiveSupport::Cache::FileStore.new(@cache_dir, coder: @coder)
end
def test_simpl... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/activesupport/codec_factory_test.rb | test/activesupport/codec_factory_test.rb | # frozen_string_literal: true
require "test_helper"
module Paquito
module ActiveSupportSharedCodecFactoryTests
OBJECTS = {
hwia: ActiveSupport::HashWithIndifferentAccess.new("foo" => "bar"),
time_with_zone: ActiveSupport::TimeWithZone.new(
Time.new(2000, 1, 1, 2, 2, 2, "UTC"),
Active... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/activesupport/test_helper.rb | test/activesupport/test_helper.rb | # frozen_string_literal: true
require "active_support/all"
require File.expand_path("../test_helper.rb", __dir__)
Dir[File.expand_path("support/*.rb", __dir__)].sort.each do |support|
require support
end
| ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/test/activesupport/flat_cache_entry_coder_test.rb | test/activesupport/flat_cache_entry_coder_test.rb | # frozen_string_literal: true
require "test_helper"
class FlatPaquitoCacheEntryCoderTest < PaquitoTest
def setup
@coder = Paquito::FlatCacheEntryCoder.new(JSON)
@cache_dir = Dir.mktmpdir
@store = ActiveSupport::Cache::FileStore.new(@cache_dir, coder: @coder)
end
def test_simple_key
@store.write... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/lib/paquito.rb | lib/paquito.rb | # frozen_string_literal: true
require "digest/md5"
require "bigdecimal"
require "date"
require "set"
require "yaml"
require "msgpack"
require "paquito/version"
require "paquito/deflater"
require "paquito/compressor"
require "paquito/allow_nil"
require "paquito/translate_errors"
require "paquito/safe_yaml"
require "p... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/lib/paquito/active_record_coder.rb | lib/paquito/active_record_coder.rb | # frozen_string_literal: true
gem "activerecord", ">= 7.0"
require "paquito/errors"
module Paquito
class ActiveRecordCoder
EMPTY_HASH = {}.freeze
class << self
def dump(record)
instances = InstanceTracker.new
serialized_associations = serialize_associations(record, instances)
... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/lib/paquito/version.rb | lib/paquito/version.rb | # frozen_string_literal: true
module Paquito
VERSION = "1.0.0"
end
| ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/lib/paquito/typed_struct.rb | lib/paquito/typed_struct.rb | # typed: true
# frozen_string_literal: true
return unless defined?(T::Props)
module Paquito
# To make a T::Struct class serializable, include Paquito::TypedStruct:
#
# class MyStruct < T::Struct
# include Paquito::TypedStruct
#
# prop :foo, String
# prop :bar, Integer
# end
#
# m... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/lib/paquito/codec_factory.rb | lib/paquito/codec_factory.rb | # frozen_string_literal: true
require "paquito/types"
require "paquito/coder_chain"
module Paquito
class CodecFactory
def self.build(types = [], freeze: false, serializable_type: false, pool: 1, format_version: Paquito.format_version)
factory = if types.empty? && !serializable_type
MessagePack::De... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/lib/paquito/coder_chain.rb | lib/paquito/coder_chain.rb | # frozen_string_literal: true
module Paquito
class CoderChain
def initialize(*coders)
@coders = coders.flatten.map { |c| Paquito.cast(c) }
@reverse_coders = @coders.reverse
end
def dump(object)
payload = object
@coders.each { |c| payload = c.dump(payload) }
payload
end
... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/lib/paquito/struct.rb | lib/paquito/struct.rb | # frozen_string_literal: true
require "paquito/errors"
module Paquito
# To make a Struct class cacheable, include Paquito::Struct:
#
# MyStruct = Struct.new(:foo, :bar)
# MyStruct.include(Paquito::Struct)
#
# Alternatively, declare the struct with Paquito::Struct#new:
#
# MyStruct = Paquito::Str... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/lib/paquito/errors.rb | lib/paquito/errors.rb | # frozen_string_literal: true
module Paquito
Error = Class.new(StandardError)
class PackError < Error
attr_reader :receiver
def initialize(msg, receiver = nil)
super(msg)
@receiver = receiver
end
end
UnpackError = Class.new(Error)
ClassMissingError = Class.new(Error)
UnsupportedT... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/lib/paquito/cache_entry_coder.rb | lib/paquito/cache_entry_coder.rb | # frozen_string_literal: true
gem "activesupport", ">= 7.0"
module Paquito
module CacheEntryCoder
def self.dump(entry)
entry.pack
end
def self.load(payload)
::ActiveSupport::Cache::Entry.unpack(payload)
end
end
end
| ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/lib/paquito/comment_prefix_version.rb | lib/paquito/comment_prefix_version.rb | # frozen_string_literal: true
module Paquito
class CommentPrefixVersion
PREFIX = "#\u2620"
SUFFIX = "\u2622\n"
VERSION_POSITION = PREFIX.bytesize
HEADER_SLICE = (0..(PREFIX.bytesize + SUFFIX.bytesize))
PAYLOAD_SLICE = (PREFIX.bytesize + 1 + SUFFIX.bytesize)..-1
DEFAULT_VERSION = 0
def i... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/lib/paquito/conditional_compressor.rb | lib/paquito/conditional_compressor.rb | # frozen_string_literal: true
module Paquito
class ConditionalCompressor
UNCOMPRESSED = 0
COMPRESSED = 1
def initialize(compressor, compress_threshold)
@compressor = Paquito.cast(compressor)
@compress_threshold = compress_threshold
end
def dump(uncompressed)
uncompressed_size ... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/lib/paquito/serialized_column.rb | lib/paquito/serialized_column.rb | # frozen_string_literal: true
module Paquito
class SerializedColumn
def initialize(coder, type = nil, attribute_name: nil)
@coder = coder
@type = type
@attribute_name = attribute_name || "Attribute"
check_arity_of_constructor
@default_value = type&.new
end
def object_class
... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/lib/paquito/single_byte_prefix_version_with_string_bypass.rb | lib/paquito/single_byte_prefix_version_with_string_bypass.rb | # frozen_string_literal: true
module Paquito
class SingleBytePrefixVersionWithStringBypass < SingleBytePrefixVersion
UTF8_VERSION = 255
BINARY_VERSION = 254
ASCII_VERSION = 253
def initialize(current_version, coders, string_coder = nil)
super(current_version, coders)
@string_coder = stri... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/lib/paquito/allow_nil.rb | lib/paquito/allow_nil.rb | # frozen_string_literal: true
module Paquito
class AllowNil
def initialize(coder)
@coder = Paquito.cast(coder)
end
def dump(object)
return nil if object.nil?
@coder.dump(object)
end
def load(payload)
return nil if payload.nil?
@coder.load(payload)
end
end
e... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/lib/paquito/deflater.rb | lib/paquito/deflater.rb | # frozen_string_literal: true
module Paquito
class Deflater
def initialize(deflater)
@deflater = deflater
end
def dump(serial)
@deflater.deflate(serial)
end
def load(payload)
@deflater.inflate(payload)
end
end
end
| ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/lib/paquito/safe_yaml.rb | lib/paquito/safe_yaml.rb | # frozen_string_literal: true
module Paquito
class SafeYAML
ALL_SYMBOLS = [].freeze # Restricting symbols isn't really useful since symbols are no longer immortal
BASE_PERMITTED_CLASSNAMES = [
"TrueClass",
"FalseClass",
"NilClass",
"Numeric",
"String",
"Array",
"Hash... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/lib/paquito/types.rb | lib/paquito/types.rb | # frozen_string_literal: true
require "paquito/errors"
begin
require "active_support"
require "active_support/core_ext/time/calculations"
rescue LoadError
# We don't actually depend on ActiveSupport, we just want to use
# Time.at_without_coercion if it's available. Otherwise, we'll just use
# Time.at and ig... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/lib/paquito/single_byte_prefix_version.rb | lib/paquito/single_byte_prefix_version.rb | # frozen_string_literal: true
module Paquito
class SingleBytePrefixVersion
def initialize(current_version, coders)
@current_version = validate_version(current_version)
@coders = coders.transform_keys { |v| validate_version(v) }.transform_values { |c| Paquito.cast(c) }
@current_coder = coders.fe... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Shopify/paquito | https://github.com/Shopify/paquito/blob/e462641cf1c8b3554f8749b86c387729fce2cfc4/lib/paquito/flat_cache_entry_coder.rb | lib/paquito/flat_cache_entry_coder.rb | # frozen_string_literal: true
gem "activesupport", ">= 7.0"
module Paquito
class FlatCacheEntryCoder
METADATA_CODEC = CodecFactory.build
EXPIRES_AT_FORMAT = "E" # Float double-precision, little-endian byte order (8 bytes)
VERSION_SIZE_FORMAT = "l<" # 32-bit signed, little-endian byte order (int32_t) (4... | ruby | MIT | e462641cf1c8b3554f8749b86c387729fce2cfc4 | 2026-01-04T17:57:28.878221Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.