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.6.4'.freeze

Class Method Summary collapse

Class Method Details

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

Returns:

  • (Boolean)


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

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



75
76
77
78
79
80
81
82
# File 'lib/effective_orders.rb', line 75

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:



64
65
66
# File 'lib/effective_orders.rb', line 64

def self.setup
  yield self
end

.use_active_admin?Boolean

Returns:

  • (Boolean)


84
85
86
# File 'lib/effective_orders.rb', line 84

def self.use_active_admin?
  use_active_admin && defined?(ActiveAdmin)
end