Class: Corzinus::Checkout::AccessStep

Inherits:
Rectify::Command
  • Object
show all
Defined in:
app/commands/corzinus/checkout/access_step.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(order, step) ⇒ AccessStep

Returns a new instance of AccessStep.



6
7
8
9
# File 'app/commands/corzinus/checkout/access_step.rb', line 6

def initialize(order, step)
  @order = order
  @step = step
end

Instance Attribute Details

#orderObject (readonly)

Returns the value of attribute order.



4
5
6
# File 'app/commands/corzinus/checkout/access_step.rb', line 4

def order
  @order
end

#stepObject (readonly)

Returns the value of attribute step.



4
5
6
# File 'app/commands/corzinus/checkout/access_step.rb', line 4

def step
  @step
end

Instance Method Details

#callObject



11
12
13
14
15
16
# File 'app/commands/corzinus/checkout/access_step.rb', line 11

def call
  if order.items_count.zero? && step != :complete
    return broadcast(:empty_cart)
  end
  allow? ? broadcast(:allow) : broadcast(:not_allow)
end