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
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/test/test_helpers/fake_session_storage.rb
test/test_helpers/fake_session_storage.rb
# typed: true # frozen_string_literal: true module TestHelpers class FakeSessionStorage extend T::Sig sig { returns(T::Hash[String, ShopifyAPI::Auth::Session]) } attr_reader :sessions sig { returns(T.nilable(T::Boolean)) } attr_reader :error_on_save, :error_on_delete sig do params( ...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app.rb
lib/shopify_app.rb
# frozen_string_literal: true require "shopify_app/version" # deps require "shopify_api" require "redirect_safely" require "addressable" module ShopifyApp def self.rails6? Rails::VERSION::MAJOR >= 6 end def self.rails7? Rails::VERSION::MAJOR >= 7 end def self.use_importmap? rails7? && File.ex...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/shopify_app_generator.rb
lib/generators/shopify_app/shopify_app_generator.rb
# frozen_string_literal: true module ShopifyApp module Generators class ShopifyAppGenerator < Rails::Generators::Base def initialize(args, *options) @opts = options.first super(args, *options) end def run_all_generators generate("shopify_app:add_app_uninstalled_job") ...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/authenticated_controller/authenticated_controller_generator.rb
lib/generators/shopify_app/authenticated_controller/authenticated_controller_generator.rb
# frozen_string_literal: true require "rails/generators/base" module ShopifyApp module Generators class AuthenticatedControllerGenerator < Rails::Generators::Base source_root File.expand_path("../templates", __FILE__) def create_authenticated_controller template("authenticated_controller.rb...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/authenticated_controller/templates/authenticated_controller.rb
lib/generators/shopify_app/authenticated_controller/templates/authenticated_controller.rb
# frozen_string_literal: true class AuthenticatedController < ApplicationController include ShopifyApp::EnsureHasSession end
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/add_privacy_jobs/add_privacy_jobs_generator.rb
lib/generators/shopify_app/add_privacy_jobs/add_privacy_jobs_generator.rb
# frozen_string_literal: true require "rails/generators/base" module ShopifyApp module Generators class AddPrivacyJobsGenerator < Rails::Generators::Base source_root File.expand_path("../templates", __FILE__) def add_customer_data_request_job template("customers_data_request_job.rb", "app/j...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/add_app_uninstalled_job/add_app_uninstalled_job_generator.rb
lib/generators/shopify_app/add_app_uninstalled_job/add_app_uninstalled_job_generator.rb
# frozen_string_literal: true require "rails/generators/base" module ShopifyApp module Generators class AddAppUninstalledJobGenerator < Rails::Generators::Base source_root File.expand_path("../templates", __FILE__) def create_job template("app_uninstalled_job.rb", "app/jobs/app_uninstalled_...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb
lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb
# frozen_string_literal: true require "rails/generators/base" module ShopifyApp module Generators class AddAfterAuthenticateJobGenerator < Rails::Generators::Base source_root File.expand_path("../templates", __FILE__) hook_for :test_framework, as: :job, in: :rails do |instance, generator| i...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb
lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb
# frozen_string_literal: true module Shopify class AfterAuthenticateJob < ActiveJob::Base def perform(shop_domain:) shop = Shop.find_by(shopify_domain: shop_domain) shop.with_shopify_session do |session| end end end end
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/shop_model/shop_model_generator.rb
lib/generators/shopify_app/shop_model/shop_model_generator.rb
# frozen_string_literal: true require "rails/generators/base" require "rails/generators/active_record" module ShopifyApp module Generators class ShopModelGenerator < Rails::Generators::Base include Rails::Generators::Migration source_root File.expand_path("../templates", __FILE__) class_optio...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/shop_model/templates/shop.rb
lib/generators/shopify_app/shop_model/templates/shop.rb
# frozen_string_literal: true class Shop < ActiveRecord::Base include ShopifyApp::ShopSessionStorage def api_version ShopifyApp.configuration.api_version end end
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/rotate_shopify_token_job/rotate_shopify_token_job_generator.rb
lib/generators/shopify_app/rotate_shopify_token_job/rotate_shopify_token_job_generator.rb
# frozen_string_literal: true require "rails/generators/base" module ShopifyApp module Generators class RotateShopifyTokenJobGenerator < Rails::Generators::Base source_root File.expand_path("../templates", __FILE__) def add_rotate_shopify_token_job copy_file("rotate_shopify_token_job.rb", "...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token_job.rb
lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token_job.rb
# frozen_string_literal: true module Shopify class RotateShopifyTokenJob < ActiveJob::Base def perform(params) @shop = Shop.find_by(shopify_domain: params[:shop_domain]) return unless @shop config = ShopifyApp.configuration uri = URI("https://#{@shop.shopify_domain}/admin/oauth/access_to...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/controllers/controllers_generator.rb
lib/generators/shopify_app/controllers/controllers_generator.rb
# frozen_string_literal: true require "rails/generators/base" module ShopifyApp module Generators class ControllersGenerator < Rails::Generators::Base source_root File.expand_path("../../../../..", __FILE__) def create_controllers controllers.each do |controller| copy_file(control...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/home_controller/home_controller_generator.rb
lib/generators/shopify_app/home_controller/home_controller_generator.rb
# frozen_string_literal: true require "rails/generators/base" module ShopifyApp module Generators class HomeControllerGenerator < Rails::Generators::Base source_root File.expand_path("../templates", __FILE__) class_option :embedded, type: :string, default: "true" def create_home_controller ...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/home_controller/templates/home_controller.rb
lib/generators/shopify_app/home_controller/templates/home_controller.rb
# frozen_string_literal: true class HomeController < AuthenticatedController include ShopifyApp::ShopAccessScopesVerification before_action :set_host def index @products = ShopifyAPI::Product.all(limit: 10) @webhooks = ShopifyAPI::Webhook.all end private def set_host @host = params[:host] ...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/home_controller/templates/unauthenticated_home_controller.rb
lib/generators/shopify_app/home_controller/templates/unauthenticated_home_controller.rb
# frozen_string_literal: true class HomeController < ApplicationController include ShopifyApp::EmbeddedApp include ShopifyApp::EnsureInstalled include ShopifyApp::ShopAccessScopesVerification def index if ShopifyAPI::Context.embedded? && (!params[:embedded].present? || params[:embedded] != "1") redi...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/routes/routes_generator.rb
lib/generators/shopify_app/routes/routes_generator.rb
# frozen_string_literal: true require "rails/generators/base" module ShopifyApp module Generators class RoutesGenerator < Rails::Generators::Base source_root File.expand_path("../templates", __FILE__) def inject_shopify_app_routes_into_application_routes route(session_routes) end ...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/routes/templates/routes.rb
lib/generators/shopify_app/routes/templates/routes.rb
# frozen_string_literal: true controller :sessions do get "login" => :new, :as => :login post "login" => :create, :as => :authenticate get "auth/shopify/callback" => :callback get "logout" => :destroy, :as => :logout end namespace :webhooks do post ":type" => :receive end
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/products_controller/products_controller_generator.rb
lib/generators/shopify_app/products_controller/products_controller_generator.rb
# frozen_string_literal: true require "rails/generators/base" module ShopifyApp module Generators class ProductsControllerGenerator < Rails::Generators::Base source_root File.expand_path("../templates", __FILE__) def create_products_controller template("products_controller.rb", "app/control...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/products_controller/templates/products_controller.rb
lib/generators/shopify_app/products_controller/templates/products_controller.rb
# frozen_string_literal: true class ProductsController < AuthenticatedController def index @products = ShopifyAPI::Product.all(limit: 10) render(json: { products: @products }) end end
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/views/views_generator.rb
lib/generators/shopify_app/views/views_generator.rb
# frozen_string_literal: true require "rails/generators/base" module ShopifyApp module Generators class ViewsGenerator < Rails::Generators::Base source_root File.expand_path("../../../../..", __FILE__) def create_views views.each do |view| copy_file(view) end end ...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/user_model/user_model_generator.rb
lib/generators/shopify_app/user_model/user_model_generator.rb
# frozen_string_literal: true require "rails/generators/base" require "rails/generators/active_record" module ShopifyApp module Generators class UserModelGenerator < Rails::Generators::Base include Rails::Generators::Migration source_root File.expand_path("../templates", __FILE__) class_optio...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/user_model/templates/user.rb
lib/generators/shopify_app/user_model/templates/user.rb
# frozen_string_literal: true class User < ActiveRecord::Base include ShopifyApp::UserSessionStorage def api_version ShopifyApp.configuration.api_version end end
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/add_webhook/add_webhook_generator.rb
lib/generators/shopify_app/add_webhook/add_webhook_generator.rb
# frozen_string_literal: true require "rails/generators/base" module ShopifyApp module Generators class AddWebhookGenerator < Rails::Generators::Base source_root File.expand_path("../templates", __FILE__) class_option :topic, type: :string, aliases: "-t", required: true class_option :path, typ...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/add_declarative_webhook/add_declarative_webhook_generator.rb
lib/generators/shopify_app/add_declarative_webhook/add_declarative_webhook_generator.rb
# frozen_string_literal: true require "rails/generators/base" module ShopifyApp module Generators class AddDeclarativeWebhookGenerator < Rails::Generators::Base source_root File.expand_path("../templates", __FILE__) class_option :topic, type: :string, aliases: "-t", required: true class_option...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb
lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb
# frozen_string_literal: true require "rails/generators/base" module ShopifyApp module Generators class AppProxyControllerGenerator < Rails::Generators::Base source_root File.expand_path("../templates", __FILE__) def create_app_proxy_controller template("app_proxy_controller.rb", "app/contr...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb
lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb
# frozen_string_literal: true class AppProxyController < ApplicationController include ShopifyApp::AppProxyVerification def index render(layout: false, content_type: "application/liquid") end end
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_route.rb
lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_route.rb
# frozen_string_literal: true namespace :app_proxy do root action: "index" # simple routes without a specified controller will go to AppProxyController # more complex routes will go to controllers in the AppProxy namespace # resources :reviews # GET /app_proxy/reviews will now be routed to # AppProxy::R...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/install/install_generator.rb
lib/generators/shopify_app/install/install_generator.rb
# frozen_string_literal: true require "rails/generators/base" module ShopifyApp module Generators class InstallGenerator < Rails::Generators::Base include Rails::Generators::Migration source_root File.expand_path("../templates", __FILE__) class_option :application_name, type: :array, default:...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/generators/shopify_app/install/templates/session_store.rb
lib/generators/shopify_app/install/templates/session_store.rb
# frozen_string_literal: true # Be sure to restart your server when you modify this file. Rails.application.config.session_store(:cookie_store, key: "_example_session", expire_after: 14.days)
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/version.rb
lib/shopify_app/version.rb
# frozen_string_literal: true module ShopifyApp VERSION = "23.0.1" end
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/logger.rb
lib/shopify_app/logger.rb
# frozen_string_literal: true module ShopifyApp class Logger < ShopifyAPI::Logger class << self def deprecated(message, version) return unless enabled_for_log_level?(:warn) raise ShopifyAPI::Errors::FeatureDeprecatedError unless valid_version(version) deprecator.warn("[#{version}]...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/errors.rb
lib/shopify_app/errors.rb
# frozen_string_literal: true module ShopifyApp class BillingError < StandardError attr_accessor :message attr_accessor :errors def initialize(message, errors) super(message) @message = message @errors = errors end end class ConfigurationError < StandardError; end class Cre...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/utils.rb
lib/shopify_app/utils.rb
# frozen_string_literal: true module ShopifyApp module Utils class << self TRUSTED_SHOPIFY_DOMAINS = [ "shopify.com", "myshopify.io", "myshopify.com", "spin.dev", "shop.dev", ].freeze def sanitize_shop_domain(shop_domain) uri = uri_from_shop_doma...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/configuration.rb
lib/shopify_app/configuration.rb
# frozen_string_literal: true module ShopifyApp class Configuration # Shopify App settings. These values should match the configuration # for the app in your Shopify Partners page. Change your settings in # `config/initializers/shopify_app.rb` attr_accessor :application_name attr_accessor :api_ke...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/engine.rb
lib/shopify_app/engine.rb
# frozen_string_literal: true module ShopifyApp module RedactJobParams private def args_info(job) log_disabled_classes = ["ShopifyApp::WebhooksManagerJob", "ShopifyApp::ScriptTagsManagerJob"] return "" if log_disabled_classes.include?(job.class.name) super end end class Engine < ...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/auth/token_exchange.rb
lib/shopify_app/auth/token_exchange.rb
# frozen_string_literal: true module ShopifyApp module Auth class TokenExchange attr_reader :id_token def self.perform(id_token) new(id_token).perform end def initialize(id_token) @id_token = id_token end def perform domain = ShopifyAPI::Auth::JwtPay...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/auth/post_authenticate_tasks.rb
lib/shopify_app/auth/post_authenticate_tasks.rb
# frozen_string_literal: true module ShopifyApp module Auth class PostAuthenticateTasks class << self def perform(session) ShopifyApp::Logger.debug("Performing post authenticate tasks") # Ensure we use the shop session to install webhooks session_for_shop = session.onl...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/admin_api/with_token_refetch.rb
lib/shopify_app/admin_api/with_token_refetch.rb
# frozen_string_literal: true module ShopifyApp module AdminAPI module WithTokenRefetch def with_token_refetch(session, shopify_id_token) retrying = false if retrying.nil? yield rescue ShopifyAPI::Errors::HttpResponseError => error if error.code != 401 ShopifyApp::Lo...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/controller_concerns/redirect_for_embedded.rb
lib/shopify_app/controller_concerns/redirect_for_embedded.rb
# frozen_string_literal: true module ShopifyApp module RedirectForEmbedded include ShopifyApp::SanitizedParams def self.add_app_bridge_redirect_url_header(url, response) response.set_header("X-Shopify-API-Request-Failure-Reauthorize", "1") response.set_header("X-Shopify-API-Request-Failure-Reaut...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/controller_concerns/token_exchange.rb
lib/shopify_app/controller_concerns/token_exchange.rb
# frozen_string_literal: true module ShopifyApp module TokenExchange extend ActiveSupport::Concern include ShopifyApp::AdminAPI::WithTokenRefetch include ShopifyApp::SanitizedParams include ShopifyApp::EmbeddedApp included do include ShopifyApp::WithShopifyIdToken end INVALID_SHOP...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/controller_concerns/frame_ancestors.rb
lib/shopify_app/controller_concerns/frame_ancestors.rb
# frozen_string_literal: true module ShopifyApp module FrameAncestors extend ActiveSupport::Concern included do content_security_policy do |policy| policy.frame_ancestors(-> do domain_host = current_shopify_domain || "*.#{::ShopifyApp.configuration.myshopify_domain}" [ ...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/controller_concerns/login_protection.rb
lib/shopify_app/controller_concerns/login_protection.rb
# frozen_string_literal: true module ShopifyApp module LoginProtection extend ActiveSupport::Concern include ShopifyApp::SanitizedParams included do if defined?(ShopifyApp::EnsureInstalled) && ancestors.include?(ShopifyApp::EnsureInstalled) message = <<~EOS We detected ...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/controller_concerns/embedded_app.rb
lib/shopify_app/controller_concerns/embedded_app.rb
# frozen_string_literal: true module ShopifyApp module EmbeddedApp extend ActiveSupport::Concern include ShopifyApp::FrameAncestors include ShopifyApp::SanitizedParams included do layout :embedded_app_layout after_action :set_esdk_headers, if: -> { ShopifyApp.configuration.embedded_app?...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/controller_concerns/localization.rb
lib/shopify_app/controller_concerns/localization.rb
# frozen_string_literal: true module ShopifyApp module Localization extend ActiveSupport::Concern included do around_action :set_locale end private def set_locale(&action) locale = params[:locale] || session[:locale] || I18n.default_locale # Fallback to the 2 letter language...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/controller_concerns/webhook_verification.rb
lib/shopify_app/controller_concerns/webhook_verification.rb
# frozen_string_literal: true module ShopifyApp module WebhookVerification extend ActiveSupport::Concern include ShopifyApp::PayloadVerification included do skip_before_action :verify_authenticity_token, raise: false before_action :verify_request end private def verify_request ...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/controller_concerns/sanitized_params.rb
lib/shopify_app/controller_concerns/sanitized_params.rb
# frozen_string_literal: true module ShopifyApp module SanitizedParams protected def sanitized_shop_name @sanitized_shop_name ||= sanitize_shop_param(params) end def referer_sanitized_shop_name return unless request.referer.present? @referer_sanitized_shop_name ||= begin ...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/controller_concerns/payload_verification.rb
lib/shopify_app/controller_concerns/payload_verification.rb
# frozen_string_literal: true module ShopifyApp module PayloadVerification extend ActiveSupport::Concern private def shopify_hmac request.headers["HTTP_X_SHOPIFY_HMAC_SHA256"] end def hmac_valid?(data) secrets = [ShopifyApp.configuration.secret, ShopifyApp.configuration.old_secret]...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/controller_concerns/with_shopify_id_token.rb
lib/shopify_app/controller_concerns/with_shopify_id_token.rb
# frozen_string_literal: true module ShopifyApp module WithShopifyIdToken extend ActiveSupport::Concern def shopify_id_token return @shopify_id_token if defined?(@shopify_id_token) @shopify_id_token = id_token_from_authorization_header || id_token_from_url_param end def jwt_payload ...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/controller_concerns/app_proxy_verification.rb
lib/shopify_app/controller_concerns/app_proxy_verification.rb
# frozen_string_literal: true module ShopifyApp module AppProxyVerification extend ActiveSupport::Concern included do skip_before_action :verify_authenticity_token, raise: false before_action :verify_proxy_request end def verify_proxy_request head(:forbidden) unless query_string_va...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/controller_concerns/csrf_protection.rb
lib/shopify_app/controller_concerns/csrf_protection.rb
# frozen_string_literal: true module ShopifyApp module CsrfProtection extend ActiveSupport::Concern included do include ShopifyApp::WithShopifyIdToken protect_from_forgery with: :exception, unless: :valid_session_token? end private def valid_session_token? jwt_payload.present?...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/controller_concerns/ensure_billing.rb
lib/shopify_app/controller_concerns/ensure_billing.rb
# frozen_string_literal: true module ShopifyApp module EnsureBilling extend ActiveSupport::Concern RECURRING_INTERVALS = [BillingConfiguration::INTERVAL_EVERY_30_DAYS, BillingConfiguration::INTERVAL_ANNUAL] included do before_action :check_billing, if: :billing_required? rescue_from ::Shopi...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/access_scopes/shop_strategy.rb
lib/shopify_app/access_scopes/shop_strategy.rb
# frozen_string_literal: true module ShopifyApp module AccessScopes class ShopStrategy class << self def update_access_scopes?(shop_domain) shop_access_scopes = shop_access_scopes(shop_domain) configuration_access_scopes != shop_access_scopes end private ...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/access_scopes/user_strategy.rb
lib/shopify_app/access_scopes/user_strategy.rb
# frozen_string_literal: true module ShopifyApp module AccessScopes class UserStrategy class << self def update_access_scopes?(user_id: nil, shopify_user_id: nil) return update_access_scopes_for_user_id?(user_id) if user_id return update_access_scopes_for_shopify_user_id?(shopif...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/access_scopes/noop_strategy.rb
lib/shopify_app/access_scopes/noop_strategy.rb
# frozen_string_literal: true module ShopifyApp module AccessScopes class NoopStrategy class << self def update_access_scopes?(*_args) false end def covers_scopes?(*_args) true end end end end end
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/managers/webhooks_manager.rb
lib/shopify_app/managers/webhooks_manager.rb
# frozen_string_literal: true require "uri" module ShopifyApp class WebhooksManager class << self def queue(shop_domain, shop_token) ShopifyApp::WebhooksManagerJob.perform_later( shop_domain: shop_domain, shop_token: shop_token, ) end def create_webhooks(se...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/managers/script_tags_manager.rb
lib/shopify_app/managers/script_tags_manager.rb
# frozen_string_literal: true module ShopifyApp class ScriptTagsManager def self.queue(shop_domain, shop_token, script_tags) ShopifyApp::ScriptTagsManagerJob.perform_later( shop_domain: shop_domain, shop_token: shop_token, # Procs cannot be serialized so we interpolate now, if neces...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/session/user_session_storage_with_scopes.rb
lib/shopify_app/session/user_session_storage_with_scopes.rb
# frozen_string_literal: true module ShopifyApp module UserSessionStorageWithScopes extend ActiveSupport::Concern include ::ShopifyApp::SessionStorage included do ShopifyApp::Logger.deprecated( "UserSessionStorageWithScopes is deprecated and will be removed in v24.0.0. " \ "Use U...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/session/in_memory_user_session_store.rb
lib/shopify_app/session/in_memory_user_session_store.rb
# frozen_string_literal: true module ShopifyApp class InMemoryUserSessionStore < InMemorySessionStore class << self def store(session, user) id = super repo[user.id.to_s] = session id end def retrieve_by_shopify_user_id(user_id) repo[user_id] end end ...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/session/shop_session_storage.rb
lib/shopify_app/session/shop_session_storage.rb
# frozen_string_literal: true module ShopifyApp module ShopSessionStorage extend ActiveSupport::Concern include ::ShopifyApp::SessionStorage included do validates :shopify_domain, presence: true, uniqueness: { case_sensitive: false } end def with_shopify_session(auto_refresh: true, &block...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/session/session_storage.rb
lib/shopify_app/session/session_storage.rb
# frozen_string_literal: true module ShopifyApp module SessionStorage extend ActiveSupport::Concern included do validates :shopify_token, presence: true validates :api_version, presence: true end def with_shopify_session(&block) ShopifyAPI::Auth::Session.temp(shop: shopify_domain,...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/session/null_user_session_store.rb
lib/shopify_app/session/null_user_session_store.rb
# frozen_string_literal: true module ShopifyApp class NullUserSessionStore class << self def retrieve(_) nil end def store(_, _) raise ::ShopifyApp::ConfigurationError, "user_storage is not configured" end def retrieve_by_shopify_user_id(_) nil end ...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/session/session_repository.rb
lib/shopify_app/session/session_repository.rb
# frozen_string_literal: true module ShopifyApp class SessionRepository class << self attr_writer :shop_storage attr_writer :user_storage def retrieve_shop_session(id) shop_storage.retrieve(id) end def retrieve_user_session(id) user_storage.retrieve(id) end ...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/session/in_memory_shop_session_store.rb
lib/shopify_app/session/in_memory_shop_session_store.rb
# frozen_string_literal: true module ShopifyApp class InMemoryShopSessionStore < InMemorySessionStore class << self def store(session, *args) id = super repo[session.shop] = session id end def retrieve_by_shopify_domain(shopify_domain) repo[shopify_domain] ...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/session/user_session_storage.rb
lib/shopify_app/session/user_session_storage.rb
# frozen_string_literal: true module ShopifyApp module UserSessionStorage extend ActiveSupport::Concern include ::ShopifyApp::SessionStorage included do validates :shopify_domain, presence: true end class_methods do def store(auth_session, user) user = find_or_initialize_by(...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/session/in_memory_session_store.rb
lib/shopify_app/session/in_memory_session_store.rb
# frozen_string_literal: true module ShopifyApp # rubocop:disable Style/ClassVars # Class var repo is needed here in order to share data between the 2 child classes. class InMemorySessionStore def self.retrieve(id) repo[id] end def self.store(session, *_args) id = SecureRandom.uuid ...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/session/shop_session_storage_with_scopes.rb
lib/shopify_app/session/shop_session_storage_with_scopes.rb
# frozen_string_literal: true module ShopifyApp module ShopSessionStorageWithScopes extend ActiveSupport::Concern include ::ShopifyApp::SessionStorage included do ShopifyApp::Logger.deprecated( "ShopSessionStorageWithScopes is deprecated and will be removed in v24.0.0. " \ "Use S...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/test_helpers/webhook_verification_helper.rb
lib/shopify_app/test_helpers/webhook_verification_helper.rb
# frozen_string_literal: true module ShopifyApp module TestHelpers module WebhookVerificationHelper def authorized_webhook_verification_headers!(params = {}) digest = OpenSSL::Digest.new("sha256") secret = ShopifyApp.configuration.secret valid_hmac = Base64.encode64(OpenSSL::HMAC.di...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/test_helpers/shopify_session_helper.rb
lib/shopify_app/test_helpers/shopify_session_helper.rb
# frozen_string_literal: true module ShopifyApp module TestHelpers module ShopifySessionHelper def setup_shopify_session(session_id:, shop_domain:) ShopifyAPI::Auth::Session.new(id: session_id, shop: shop_domain).tap do |session| ShopifyApp::SessionRepository.stubs(:load_session).returns(...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/lib/shopify_app/test_helpers/all.rb
lib/shopify_app/test_helpers/all.rb
# frozen_string_literal: true require "shopify_app/test_helpers/webhook_verification_helper" require "shopify_app/test_helpers/shopify_session_helper"
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
Shopify/shopify_app
https://github.com/Shopify/shopify_app/blob/e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b/config/routes.rb
config/routes.rb
# frozen_string_literal: true ShopifyApp::Engine.routes.draw do login_url = ShopifyApp.configuration.login_url.gsub(/^#{ShopifyApp.configuration.root_url}/, "") login_callback_url = ShopifyApp.configuration.login_callback_url.gsub(/^#{ShopifyApp.configuration.root_url}/, "") controller :sessions do get logi...
ruby
MIT
e7ae8e548a0232c2fa1801cf0c4f15d8242dd22b
2026-01-04T16:00:17.637053Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/spec_helper.rb
spec/spec_helper.rb
# frozen_string_literal: true require "statesman" require "sqlite3" require "mysql2" require "pg" require "active_record" require "active_record/database_configurations" # We have to include all of Rails to make rspec-rails work require "rails" require "action_view" require "action_dispatch" require "action_controller...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/support/active_record.rb
spec/support/active_record.rb
# frozen_string_literal: true require "json" MIGRATION_CLASS = if Rails.version.split(".").map(&:to_i).first >= 5 migration_version = ActiveRecord::Migration.current_version ActiveRecord::Migration[migration_version] else ActiveRecord::Migr...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/support/generators_shared_examples.rb
spec/support/generators_shared_examples.rb
# frozen_string_literal: true require "rails/version" require "rspec/rails" require "ammeter/init" TMP_GENERATOR_PATH = File.expand_path("generator-tmp", __dir__) shared_examples "a generator" do destination TMP_GENERATOR_PATH before { prepare_destination } let(:gen) { generator %w[Yummy::Bacon Yummy::BaconTr...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/support/exactly_query_databases.rb
spec/support/exactly_query_databases.rb
# frozen_string_literal: true # `expected_dbs` should be a Hash of the form: # { # primary: [:writing, :reading], # replica: [:reading], # } RSpec::Matchers.define :exactly_query_databases do |expected_dbs| match do |block| @expected_dbs = expected_dbs.transform_values(&:to_set).with_indifferent_access @...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/fixtures/add_most_recent_to_bacon_transitions.rb
spec/fixtures/add_most_recent_to_bacon_transitions.rb
# frozen_string_literal: true class AddMostRecentToBaconTransitions < ActiveRecord::Migration def up add_column :bacon_transitions, :most_recent, :boolean, null: true end def down remove_column :bacon_transitions, :most_recent end end
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/fixtures/add_constraints_to_most_recent_for_bacon_transitions_with_partial_index.rb
spec/fixtures/add_constraints_to_most_recent_for_bacon_transitions_with_partial_index.rb
# frozen_string_literal: true class AddConstraintsToMostRecentForBaconTransitions < ActiveRecord::Migration disable_ddl_transaction! def up add_index :bacon_transitions, %i[bacon_id most_recent], unique: true, where: "most_recent", name: "index_bacon_tra...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/fixtures/add_constraints_to_most_recent_for_bacon_transitions_without_partial_index.rb
spec/fixtures/add_constraints_to_most_recent_for_bacon_transitions_without_partial_index.rb
# frozen_string_literal: true class AddConstraintsToMostRecentForBaconTransitions < ActiveRecord::Migration disable_ddl_transaction! def up add_index :bacon_transitions, %i[bacon_id most_recent], unique: true, name: "index_bacon_transitions_parent_most_recent", ...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/generators/statesman/active_record_transition_generator_spec.rb
spec/generators/statesman/active_record_transition_generator_spec.rb
# frozen_string_literal: true require "support/generators_shared_examples" require "generators/statesman/active_record_transition_generator" describe Statesman::ActiveRecordTransitionGenerator, type: :generator do before do stub_const("Bacon", Class.new(ActiveRecord::Base)) stub_const("BaconTransition", Cla...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/generators/statesman/migration_generator_spec.rb
spec/generators/statesman/migration_generator_spec.rb
# frozen_string_literal: true require "support/generators_shared_examples" require "generators/statesman/migration_generator" require "rails/generators/testing/behavior" describe Statesman::MigrationGenerator, type: :generator do before do stub_const("Yummy::Bacon", Class.new(ActiveRecord::Base)) stub_const...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/statesman/exceptions_spec.rb
spec/statesman/exceptions_spec.rb
# frozen_string_literal: true describe "Exceptions" do describe "InvalidStateError" do subject(:error) { Statesman::InvalidStateError.new } its(:message) { is_expected.to eq("Statesman::InvalidStateError") } its "string matches its message" do expect(error.to_s).to eq(error.message) end end...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/statesman/machine_spec.rb
spec/statesman/machine_spec.rb
# frozen_string_literal: true describe Statesman::Machine do let(:machine) do Class.new do include Statesman::Machine def self.name "MyStateMachine" end end end let(:my_model) { Class.new { attr_accessor :current_state }.new } describe ".state" do before do machine...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/statesman/utils_spec.rb
spec/statesman/utils_spec.rb
# frozen_string_literal: true describe Statesman::Utils do describe ".rails_major_version" do subject { described_class.rails_major_version } context "for Rails 4" do before { allow(Rails).to receive(:version).and_return("4.1.2") } it { is_expected.to eq(4) } end context "for Rails 5" ...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/statesman/callback_spec.rb
spec/statesman/callback_spec.rb
# frozen_string_literal: true describe Statesman::Callback do let(:cb_lambda) { -> {} } let(:callback) do described_class.new(from: nil, to: nil, callback: cb_lambda) end describe "#initialize" do context "with no callback" do let(:cb_lambda) { nil } it "raises an error" do expect...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/statesman/config_spec.rb
spec/statesman/config_spec.rb
# frozen_string_literal: true describe Statesman::Config do let(:instance) { described_class.new } after { Statesman.configure { storage_adapter(Statesman::Adapters::Memory) } } describe "#storage_adapter" do subject { instance.adapter_class } let(:adapter) { Class.new } before { instance.storage...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/statesman/guard_spec.rb
spec/statesman/guard_spec.rb
# frozen_string_literal: true describe Statesman::Guard do let(:callback) { -> {} } let(:guard) { described_class.new(from: nil, to: nil, callback: callback) } specify { expect(guard).to be_a(Statesman::Callback) } describe "#call" do subject(:call) { guard.call } context "success" do let(:cal...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/statesman/adapters/active_record_spec.rb
spec/statesman/adapters/active_record_spec.rb
# frozen_string_literal: true require "timecop" require "statesman/adapters/shared_examples" require "statesman/exceptions" describe Statesman::Adapters::ActiveRecord, :active_record do before do prepare_model_table prepare_transitions_table prepare_sti_model_table prepare_sti_transitions_table ...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/statesman/adapters/shared_examples.rb
spec/statesman/adapters/shared_examples.rb
# frozen_string_literal: true # All adpators must define seven methods: # initialize: Accepts a transition class, parent model and state_attr. # transition_class: Returns the transition class object passed to initialize. # parent_model: Returns the model class object passed to initialize. # state_att...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/statesman/adapters/type_safe_active_record_queries_spec.rb
spec/statesman/adapters/type_safe_active_record_queries_spec.rb
# frozen_string_literal: true describe Statesman::Adapters::TypeSafeActiveRecordQueries, :active_record do def configure(klass, transition_class) klass.send(:extend, described_class) klass.configure_state_machine( transition_class: transition_class, initial_state: :initial, ) end before ...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/statesman/adapters/memory_transition_spec.rb
spec/statesman/adapters/memory_transition_spec.rb
# frozen_string_literal: true require "statesman/adapters/memory_transition" describe Statesman::Adapters::MemoryTransition do describe "#initialize" do let(:from) { :n } let(:to) { :y } let(:sort_key) { 0 } let(:create) { described_class.new(from, to, sort_key) } specify { expect(create.from_s...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/statesman/adapters/active_record_queries_spec.rb
spec/statesman/adapters/active_record_queries_spec.rb
# frozen_string_literal: true describe Statesman::Adapters::ActiveRecordQueries, :active_record do def configure_old(klass, transition_class) klass.define_singleton_method(:transition_class) { transition_class } klass.define_singleton_method(:initial_state) { :initial } klass.send(:include, described_cla...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/statesman/adapters/active_record_transition_spec.rb
spec/statesman/adapters/active_record_transition_spec.rb
# frozen_string_literal: true require "json" describe Statesman::Adapters::ActiveRecordTransition do let(:transition_class) { Class.new { def self.serialize(*_args); end } } describe "including behaviour" do it "calls Class.serialize" do if Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Versio...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/spec/statesman/adapters/memory_spec.rb
spec/statesman/adapters/memory_spec.rb
# frozen_string_literal: true require "statesman/adapters/shared_examples" require "statesman/adapters/memory_transition" describe Statesman::Adapters::Memory do let(:model) { Class.new { attr_accessor :current_state }.new } it_behaves_like "an adapter", described_class, Statesman::Adapters::Me...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/lib/statesman.rb
lib/statesman.rb
# frozen_string_literal: true module Statesman autoload :Config, "statesman/config" autoload :Machine, "statesman/machine" autoload :Callback, "statesman/callback" autoload :Guard, "statesman/guard" autoload :Utils, "statesman/utils" autoload :VERSION, "statesman/version" module Ada...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/lib/generators/statesman/generator_helpers.rb
lib/generators/statesman/generator_helpers.rb
# frozen_string_literal: true module Statesman module GeneratorHelpers def class_name_option ", class_name: '#{parent}'" unless parent.underscore == parent_name end def model_file_name "app/models/#{klass.underscore}.rb" end def parent_name parent.underscore.split("/").join("_...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/lib/generators/statesman/active_record_transition_generator.rb
lib/generators/statesman/active_record_transition_generator.rb
# frozen_string_literal: true require "rails/generators" require "rails/generators/active_record" require "generators/statesman/generator_helpers" module Statesman class ActiveRecordTransitionGenerator < Rails::Generators::Base include Statesman::GeneratorHelpers include ActiveRecord::Generators::Migration ...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/lib/generators/statesman/migration_generator.rb
lib/generators/statesman/migration_generator.rb
# frozen_string_literal: true require "rails/generators" require "rails/generators/active_record" require "generators/statesman/generator_helpers" # Add statesman attributes to a pre-existing transition class module Statesman class MigrationGenerator < Rails::Generators::Base include Statesman::GeneratorHelpers...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/lib/statesman/callback.rb
lib/statesman/callback.rb
# frozen_string_literal: true require_relative "exceptions" module Statesman class Callback attr_reader :from attr_reader :to attr_reader :callback def initialize(options = { from: nil, to: nil, callback: nil }) unless options[:callback].respond_to?(:call) raise InvalidCallbackError, ...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/lib/statesman/version.rb
lib/statesman/version.rb
# frozen_string_literal: true module Statesman VERSION = "13.1.0" end
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false