Module: EffectiveOrders

Defined in:
lib/generators/effective_orders/upgrade_price_column_generator.rb,
lib/effective_orders.rb,
lib/effective_orders/engine.rb,
lib/effective_orders/version.rb,
lib/generators/effective_orders/install_generator.rb,
lib/generators/effective_orders/upgrade_from03x_generator.rb

Overview

bundle exec rails generate effective_orders:upgrade_price_column TABLE COLUMN

Defined Under Namespace

Modules: Generators Classes: AlreadyDeclinedException, AlreadyPurchasedException, Engine, SoldOutException

Constant Summary collapse

PURCHASED =
'purchased'
DECLINED =
'declined'
VERSION =
'1.3.0'.freeze

Class Method Summary collapse

Class Method Details

.authorized?(controller, action, resource) ⇒ Boolean

Returns:

  • (Boolean)


60
61
62
63
64
65
# File 'lib/effective_orders.rb', line 60

def self.authorized?(controller, action, resource)
  if authorization_method.respond_to?(:call) || authorization_method.kind_of?(Symbol)
    raise Effective::AccessDenied.new() unless (controller || self).instance_exec(controller, action, resource, &authorization_method)
  end
  true
end

.minimum_chargeObject



67
68
69
70
71
72
73
74
# File 'lib/effective_orders.rb', line 67

def self.minimum_charge
  if @@minimum_charge.nil? || @@minimum_charge.kind_of?(Integer)
    @@minimum_charge
  else
    ActiveSupport::Deprecation.warn('EffectiveOrders.minimum_charge config option is a non-integer. It should be an Integer representing the number of cents.  Continuing with (price * 100.0).round(0).to_i conversion') unless EffectiveOrders.silence_deprecation_warnings
    ((@@minimum_charge * 100.0).round(0).to_i rescue nil)
  end
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



56
57
58
# File 'lib/effective_orders.rb', line 56

def self.setup
  yield self
end