Module: Spree
- Defined in:
- app/models/spree/store_selector/legacy.rb,
lib/spree/bus.rb,
lib/spree/core.rb,
lib/spree/i18n.rb,
lib/spree/money.rb,
lib/spree/encryptor.rb,
lib/spree/migrations.rb,
app/models/spree/role.rb,
app/models/spree/zone.rb,
lib/spree/core/engine.rb,
lib/spree/deprecation.rb,
app/models/spree/asset.rb,
app/models/spree/image.rb,
app/models/spree/order.rb,
app/models/spree/price.rb,
app/models/spree/state.rb,
app/models/spree/store.rb,
app/models/spree/taxon.rb,
lib/spree/core/version.rb,
app/models/spree/refund.rb,
lib/spree/core/importer.rb,
app/models/spree/ability.rb,
app/models/spree/address.rb,
app/models/spree/country.rb,
app/models/spree/payment.rb,
app/models/spree/product.rb,
app/models/spree/variant.rb,
app/models/spree/exchange.rb,
app/models/spree/property.rb,
app/models/spree/shipment.rb,
app/models/spree/tax_rate.rb,
app/models/spree/taxonomy.rb,
lib/spree/core/permalinks.rb,
app/models/spree/line_item.rb,
app/models/spree/log_entry.rb,
app/models/spree/promotion.rb,
app/models/spree/role_user.rb,
lib/spree/core/environment.rb,
lib/spree/core/search/base.rb,
lib/spree/localized_number.rb,
app/models/spree/adjustment.rb,
app/models/spree/calculator.rb,
app/models/spree/stock_item.rb,
lib/spree/app_configuration.rb,
lib/spree/migration_helpers.rb,
lib/spree/user_class_handle.rb,
app/models/spree/credit_card.rb,
app/models/spree/legacy_user.rb,
app/models/spree/option_type.rb,
app/models/spree/order_mutex.rb,
app/models/spree/return_item.rb,
app/models/spree/zone_member.rb,
app/helpers/spree/base_helper.rb,
app/mailers/spree/base_mailer.rb,
app/models/spree/address/name.rb,
app/models/spree/option_value.rb,
app/models/spree/order_merger.rb,
app/models/spree/state_change.rb,
app/models/spree/tax/item_tax.rb,
app/models/spree/tax_category.rb,
app/models/spree/user_address.rb,
lib/spree/core/importer/order.rb,
lib/spree/core/search/variant.rb,
lib/spree/core/state_machines.rb,
app/helpers/spree/store_helper.rb,
app/mailers/spree/order_mailer.rb,
app/models/spree/order_updater.rb,
app/models/spree/refund_reason.rb,
app/models/spree/reimbursement.rb,
app/models/spree/return_reason.rb,
app/models/spree/shipping_rate.rb,
app/models/spree/stock/package.rb,
app/models/spree/tax/order_tax.rb,
lib/spree/core/product_filters.rb,
lib/spree/core/versioned_value.rb,
lib/spree/permission_sets/base.rb,
lib/spree/permitted_attributes.rb,
app/helpers/spree/taxons_helper.rb,
app/mailers/spree/carton_mailer.rb,
app/models/spree/classification.rb,
app/models/spree/inventory_unit.rb,
app/models/spree/order/payments.rb,
app/models/spree/order_contents.rb,
app/models/spree/order_taxation.rb,
app/models/spree/payment_create.rb,
app/models/spree/payment_method.rb,
app/models/spree/payment_source.rb,
app/models/spree/product/scopes.rb,
app/models/spree/promotion_rule.rb,
app/models/spree/stock_location.rb,
app/models/spree/stock_movement.rb,
app/models/spree/variant/scopes.rb,
lib/spree/core/importer/product.rb,
lib/spree/core/validators/email.rb,
lib/spree/testing_support/flash.rb,
app/models/spree/customer_return.rb,
app/models/spree/order_inventory.rb,
app/models/spree/order_promotion.rb,
app/models/spree/shipping_method.rb,
app/models/spree/stock/estimator.rb,
app/models/spree/tax/tax_helpers.rb,
lib/spree/preferences/preferable.rb,
app/helpers/spree/checkout_helper.rb,
app/helpers/spree/products_helper.rb,
app/models/spree/line_item_action.rb,
app/models/spree/product_property.rb,
app/models/spree/promotion_action.rb,
app/models/spree/stock/quantifier.rb,
app/models/spree/stock_quantities.rb,
app/models/spree/tax/tax_location.rb,
lib/spree/core/class_constantizer.rb,
lib/spree/core/product_duplicator.rb,
lib/spree/core/role_configuration.rb,
lib/spree/preferences/persistable.rb,
lib/spree/testing_support/caching.rb,
app/models/spree/adjustment_reason.rb,
app/models/spree/promotion_chooser.rb,
app/models/spree/shipping_category.rb,
app/models/spree/shipping_rate_tax.rb,
app/models/spree/store_credit_type.rb,
lib/spree/core/stock_configuration.rb,
app/models/spree/fulfilment_changer.rb,
app/models/spree/payment/processing.rb,
app/models/spree/promotion_category.rb,
app/models/spree/reimbursement_type.rb,
app/models/spree/returns_calculator.rb,
app/models/spree/stock/availability.rb,
app/models/spree/stock/content_item.rb,
app/models/spree/store_credit_event.rb,
app/models/spree/tax/order_adjuster.rb,
lib/spree/core/state_machines/order.rb,
app/models/concerns/spree/named_type.rb,
app/models/spree/billing_integration.rb,
app/models/spree/calculator/flat_fee.rb,
app/models/spree/product_option_type.rb,
app/models/spree/promotion_rule_user.rb,
app/models/spree/shipping_calculator.rb,
app/models/spree/stock/splitter/base.rb,
app/models/spree/user_stock_location.rb,
lib/spree/core/environment_extension.rb,
lib/spree/permission_sets/super_user.rb,
app/models/spree/calculator/flat_rate.rb,
app/models/spree/payment/cancellation.rb,
app/models/spree/payment_method/check.rb,
app/models/spree/promotion/rules/user.rb,
app/models/spree/promotion_code_batch.rb,
app/models/spree/promotion_rule_store.rb,
app/models/spree/promotion_rule_taxon.rb,
app/models/spree/reimbursement/credit.rb,
app/models/spree/return_authorization.rb,
app/models/spree/shipping_method_zone.rb,
app/models/spree/stock/allocator/base.rb,
app/models/spree/stock/differentiator.rb,
app/models/spree/stock/splitter_chain.rb,
app/models/spree/store_payment_method.rb,
app/models/spree/user_last_url_storer.rb,
lib/spree/core/environment/promotions.rb,
lib/spree/core/state_machines/payment.rb,
lib/spree/testing_support/bus_helpers.rb,
lib/spree/testing_support/factory_bot.rb,
lib/spree/testing_support/job_helpers.rb,
lib/spree/testing_support/preferences.rb,
lib/spree/testing_support/url_helpers.rb,
app/mailers/spree/reimbursement_mailer.rb,
app/models/concerns/spree/user_methods.rb,
app/models/spree/calculator/flexi_rate.rb,
app/models/spree/option_values_variant.rb,
app/models/spree/payment_capture_event.rb,
app/models/spree/promotion/rules/store.rb,
app/models/spree/promotion/rules/taxon.rb,
app/models/spree/stock/splitter/weight.rb,
app/models/spree/store_shipping_method.rb,
app/models/spree/tax_rate_tax_category.rb,
app/models/spree/variant_property_rule.rb,
app/models/spree/wallet_payment_source.rb,
lib/spree/core/controller_helpers/auth.rb,
lib/spree/core/environment/calculators.rb,
lib/spree/core/state_machines/shipment.rb,
lib/spree/permission_sets/user_display.rb,
lib/spree/testing_support/capybara_ext.rb,
lib/spree/testing_support/translations.rb,
app/jobs/spree/promotion_code_batch_job.rb,
app/models/concerns/spree/default_price.rb,
app/models/concerns/spree/display_money.rb,
app/models/spree/calculator/default_tax.rb,
app/models/spree/order/number_generator.rb,
app/models/spree/product_promotion_rule.rb,
app/models/spree/promotion_handler/cart.rb,
app/models/spree/promotion_handler/page.rb,
app/models/spree/tax_calculator/default.rb,
app/models/spree/variant/price_selector.rb,
lib/spree/core/controller_helpers/order.rb,
lib/spree/core/controller_helpers/store.rb,
lib/spree/mailer_previews/order_preview.rb,
lib/spree/permission_sets/order_display.rb,
lib/spree/permission_sets/stock_display.rb,
app/models/concerns/spree/soft_deletable.rb,
app/models/concerns/spree/user_reporting.rb,
app/models/spree/address/state_validator.rb,
app/models/spree/gallery/product_gallery.rb,
app/models/spree/gallery/variant_gallery.rb,
app/models/spree/order_update_attributes.rb,
app/models/spree/promotion/rules/product.rb,
app/models/spree/reimbursement_performer.rb,
app/models/spree/variant/pricing_options.rb,
lib/spree/core/controller_helpers/common.rb,
lib/spree/core/controller_helpers/search.rb,
lib/spree/mailer_previews/carton_preview.rb,
lib/spree/testing_support/blacklist_urls.rb,
app/models/spree/promotion_handler/coupon.rb,
app/models/spree/shipping_method_category.rb,
app/models/spree/stock/simple_coordinator.rb,
app/models/spree/store_credit_prioritizer.rb,
lib/spree/core/controller_helpers/pricing.rb,
lib/spree/permission_sets/product_display.rb,
lib/spree/permission_sets/user_management.rb,
app/models/spree/calculator/tiered_percent.rb,
app/models/spree/promotion/rules/nth_order.rb,
app/models/spree/promotion/rules/user_role.rb,
app/models/spree/reimbursement_type/credit.rb,
app/models/spree/stock/inventory_validator.rb,
lib/generators/spree/dummy/dummy_generator.rb,
lib/spree/permission_sets/default_customer.rb,
lib/spree/permission_sets/order_management.rb,
lib/spree/permission_sets/stock_management.rb,
app/models/concerns/spree/adjustment_source.rb,
app/models/concerns/spree/user_address_book.rb,
app/models/spree/payment_method/credit_card.rb,
app/models/spree/promotion/rules/item_total.rb,
app/models/spree/promotion_handler/shipping.rb,
app/models/spree/stock/location_filter/base.rb,
app/models/spree/stock/location_sorter/base.rb,
app/models/spree/stock/shipping_rate_sorter.rb,
app/models/spree/stock/splitter/backordered.rb,
lib/spree/core/state_machines/reimbursement.rb,
lib/spree/permission_sets/dashboard_display.rb,
lib/spree/permission_sets/promotion_display.rb,
lib/spree/testing_support/order_walkthrough.rb,
app/models/spree/calculator/tiered_flat_rate.rb,
app/models/spree/distributed_amounts_handler.rb,
app/models/spree/payment_method/store_credit.rb,
app/models/spree/promotion/rules/first_order.rb,
app/models/spree/variant/vat_price_generator.rb,
app/models/spree/variant_property_rule_value.rb,
lib/spree/core/state_machines/inventory_unit.rb,
lib/spree/deprecated_instance_variable_proxy.rb,
lib/spree/permission_sets/product_management.rb,
app/mailers/spree/promotion_code_batch_mailer.rb,
app/models/spree/calculator/shipping/per_item.rb,
app/models/spree/promotion/rules/option_value.rb,
app/models/spree/reimbursement_tax_calculator.rb,
app/models/spree/stock/availability_validator.rb,
app/models/spree/stock/inventory_unit_builder.rb,
app/models/spree/stock/location_filter/active.rb,
app/models/spree/stock/shipping_rate_selector.rb,
app/models/spree/tax_calculator/shipping_rate.rb,
app/subscribers/spree/order_mailer_subscriber.rb,
lib/spree/preferences/statically_configurable.rb,
lib/spree/testing_support/controller_requests.rb,
app/models/spree/calculator/distributed_amount.rb,
app/models/spree/calculator/shipping/flat_rate.rb,
app/models/spree/stock/allocator/on_hand_first.rb,
app/models/spree/store_selector/by_server_name.rb,
lib/spree/permission_sets/promotion_management.rb,
lib/spree/preferences/static_model_preferences.rb,
app/models/spree/calculator/shipping/flexi_rate.rb,
app/models/spree/calculator/shipping/price_sack.rb,
app/models/spree/promotion/rules/user_logged_in.rb,
app/models/spree/stock/location_sorter/unsorted.rb,
lib/spree/mailer_previews/reimbursement_preview.rb,
lib/spree/permission_sets/configuration_display.rb,
lib/spree/preferences/preference_differentiator.rb,
lib/spree/testing_support/authorization_helpers.rb,
app/models/concerns/spree/active_storage_adapter.rb,
app/models/concerns/spree/calculated_adjustments.rb,
app/models/spree/calculator/percent_on_line_item.rb,
app/models/spree/promotion/actions/free_shipping.rb,
app/models/spree/stock/inventory_units_finalizer.rb,
app/models/spree/variant_property_rule_condition.rb,
app/models/concerns/spree/user_api_authentication.rb,
app/models/spree/payment_method/bogus_credit_card.rb,
app/models/spree/promotion/rules/minimum_quantity.rb,
app/models/spree/promotion/rules/one_use_per_user.rb,
app/models/spree/stock/splitter/shipping_category.rb,
lib/spree/core/state_machines/return_authorization.rb,
lib/spree/permission_sets/configuration_management.rb,
lib/spree/permission_sets/restricted_stock_display.rb,
app/models/spree/calculator/flat_percent_item_total.rb,
lib/spree/core/controller_helpers/strong_parameters.rb,
app/models/spree/promotion/actions/create_adjustment.rb,
app/models/spree/stock/location_sorter/default_first.rb,
lib/spree/core/controller_helpers/payment_parameters.rb,
app/models/concerns/spree/ordered_property_value_list.rb,
lib/spree/permission_sets/restricted_stock_management.rb,
lib/generators/spree/custom_user/custom_user_generator.rb,
app/models/spree/payment_method/simple_bogus_credit_card.rb,
app/models/spree/reimbursement/reimbursement_type_engine.rb,
app/models/spree/validations/db_maximum_length_validator.rb,
app/models/spree/calculator/returns/default_refund_amount.rb,
app/models/spree/promotion/order_adjustments_recalculator.rb,
app/models/spree/reimbursement_type/reimbursement_helpers.rb,
app/models/spree/promotion/actions/create_item_adjustments.rb,
app/models/spree/return_item/eligibility_validator/default.rb,
lib/spree/core/state_machines/return_item/reception_status.rb,
app/models/concerns/spree/active_storage_adapter/attachment.rb,
app/models/spree/reimbursement/reimbursement_type_validator.rb,
lib/spree/core/state_machines/return_item/acceptance_status.rb,
app/models/spree/calculator/shipping/flat_percent_item_total.rb,
app/models/spree/promotion/rules/first_repeat_purchase_since.rb,
app/models/concerns/spree/active_storage_adapter/normalization.rb,
app/models/spree/promotion/actions/create_quantity_adjustments.rb,
app/models/spree/return_item/eligibility_validator/rma_required.rb,
app/models/spree/user_last_url_storer/rules/authentication_rule.rb,
app/models/spree/return_item/eligibility_validator/base_validator.rb,
app/models/spree/return_item/eligibility_validator/order_completed.rb,
app/models/spree/return_item/eligibility_validator/inventory_shipped.rb,
app/models/spree/return_item/eligibility_validator/no_reimbursements.rb,
app/models/spree/return_item/eligibility_validator/time_since_purchase.rb,
app/models/spree/return_item/exchange_variant_eligibility/same_product.rb,
app/models/spree/return_item/exchange_variant_eligibility/same_option_value.rb
Overview
Default implementation for finding the current store is given an HTTP request
This is the new default behaviour, starting in Solidus 2.3.0. For the old behaviour see Spree::StoreSelector::Legacy.
This attempts to find a Spree::Store with a URL matching the domain name of the request exactly. Failing that it will return the store marked as default.
Defined Under Namespace
Modules: ActiveStorageAdapter, AdjustmentSource, BaseHelper, CalculatedAdjustments, CheckoutHelper, Core, DefaultPrice, DisplayMoney, DummyGeneratorHelper, Gallery, MigrationHelpers, NamedType, OrderedPropertyValueList, PermissionSets, PermittedAttributes, Preferences, ProductsHelper, PromotionHandler, RansackableAttributes, SoftDeletable, Stock, StoreHelper, StoreSelector, Tax, TaxCalculator, TaxonsHelper, TestingSupport, UserAddressBook, UserApiAuthentication, UserMethods, UserReporting, Validations Classes: Ability, Address, Adjustment, AdjustmentReason, AppConfiguration, Asset, Base, BaseController, BaseMailer, BillingIntegration, Calculator, Carton, CartonMailer, Classification, Country, CreditCard, CustomUserGenerator, CustomerReturn, DeprecatedInstanceVariableProxy, DistributedAmountsHandler, DummyGenerator, EmailValidator, Encryptor, Exchange, FulfilmentChanger, Image, InventoryUnit, LegacyUser, LineItem, LineItemAction, LocalizedNumber, LogEntry, MailerPreviews, Migrations, Money, OptionType, OptionValue, OptionValuesVariant, Order, OrderCancellations, OrderContents, OrderInventory, OrderMailer, OrderMailerSubscriber, OrderMerger, OrderMutex, OrderPromotion, OrderShipping, OrderTaxation, OrderUpdateAttributes, OrderUpdater, Payment, PaymentCaptureEvent, PaymentCreate, PaymentMethod, PaymentSource, Preference, Price, Product, ProductDuplicator, ProductOptionType, ProductPromotionRule, ProductProperty, Promotion, PromotionAction, PromotionCategory, PromotionChooser, PromotionCode, PromotionCodeBatch, PromotionCodeBatchJob, PromotionCodeBatchMailer, PromotionRule, PromotionRuleStore, PromotionRuleTaxon, PromotionRuleUser, Property, Refund, RefundReason, Reimbursement, ReimbursementMailer, ReimbursementPerformer, ReimbursementTaxCalculator, ReimbursementType, ReturnAuthorization, ReturnItem, ReturnReason, ReturnsCalculator, Role, RoleConfiguration, RoleUser, Shipment, ShippingCalculator, ShippingCategory, ShippingManifest, ShippingMethod, ShippingMethodCategory, ShippingMethodStockLocation, ShippingMethodZone, ShippingRate, ShippingRateTax, State, StateChange, StockItem, StockLocation, StockMovement, StockQuantities, Store, StoreCredit, StoreCreditCategory, StoreCreditEvent, StoreCreditPrioritizer, StoreCreditReason, StoreCreditType, StorePaymentMethod, StoreShippingMethod, TaxCategory, TaxRate, TaxRateTaxCategory, Taxon, Taxonomy, UnitCancel, UserAddress, UserClassHandle, UserLastUrlStorer, UserStockLocation, Variant, VariantPropertyRule, VariantPropertyRuleCondition, VariantPropertyRuleValue, Wallet, WalletPaymentSource, Zone, ZoneMember
Constant Summary collapse
- Bus =
Global [Omnes](github.com/nebulab/omnes) bus.
This is used for internal events, while host applications are also able to use it.
Omnes::Bus.new
- I18N_GENERIC_PLURAL =
This value is used as a count for the pluralization helpers related to I18n ex: Spree::Order.model_name.human(count: Spree::I18N_GENERIC_PLURAL) Related to Solidus issue #1164, this is needed to avoid problems with some pluralization calculators
2.1
- Config =
Spree::AppConfiguration.new
- Deprecation =
Spree.deprecator
- VERSION =
"4.3.5"
Class Method Summary collapse
-
.config {|Spree::Config| ... } ⇒ Object
Used to configure Spree.
- .deprecator ⇒ Object
- .i18n_available_locales ⇒ Object
-
.load_defaults(version) ⇒ Object
Load the same version defaults for all available Solidus components.
- .previous_solidus_minor_version ⇒ Object
- .solidus_gem_version ⇒ Object
- .solidus_version ⇒ Object
- .user_class ⇒ Object
Class Method Details
.config {|Spree::Config| ... } ⇒ Object
Used to configure Spree.
Example:
Spree.config do |config|
config.track_inventory_levels = false
end
This method is defined within the core gem on purpose. Some people may only wish to use the Core part of Spree.
67 68 69 |
# File 'lib/spree/core.rb', line 67 def self.config(&_block) yield(Spree::Config) end |
.deprecator ⇒ Object
31 32 33 |
# File 'lib/spree/core.rb', line 31 def self.deprecator @deprecator ||= ActiveSupport::Deprecation.new('5.0', 'Solidus') end |
.i18n_available_locales ⇒ Object
6 7 8 9 10 |
# File 'lib/spree/i18n.rb', line 6 def self.i18n_available_locales I18n.available_locales.select do |locale| I18n.t('spree.i18n.this_file_language', locale: locale, fallback: false, default: nil) end end |
.load_defaults(version) ⇒ Object
Load the same version defaults for all available Solidus components
50 51 52 53 54 55 |
# File 'lib/spree/core.rb', line 50 def self.load_defaults(version) Spree::Config.load_defaults(version) Spree::Frontend::Config.load_defaults(version) if defined?(Spree::Frontend::Config) Spree::Backend::Config.load_defaults(version) if defined?(Spree::Backend::Config) Spree::Api::Config.load_defaults(version) if defined?(Spree::Api::Config) end |
.previous_solidus_minor_version ⇒ Object
10 11 12 |
# File 'lib/spree/core/version.rb', line 10 def self.previous_solidus_minor_version '4.2' end |
.solidus_gem_version ⇒ Object
14 15 16 |
# File 'lib/spree/core/version.rb', line 14 def self.solidus_gem_version Gem::Version.new(solidus_version) end |
.solidus_version ⇒ Object
6 7 8 |
# File 'lib/spree/core/version.rb', line 6 def self.solidus_version VERSION end |
.user_class ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/spree/core.rb', line 39 def self.user_class if @@user_class.is_a?(Class) raise "Spree.user_class MUST be a String or Symbol object, not a Class object." elsif @@user_class.is_a?(String) || @@user_class.is_a?(Symbol) @@user_class.to_s.constantize end end |