Class: Catalog::AmazonBuyBoxService::Decision

Inherits:
Data
  • Object
show all
Defined in:
app/services/catalog/amazon_buy_box_service.rb

Overview

One item's outcome.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action:, reason: nil, price: nil, source: nil, detail: nil) ⇒ Decision

Returns a new instance of Decision.



59
# File 'app/services/catalog/amazon_buy_box_service.rb', line 59

def initialize(action:, reason: nil, price: nil, source: nil, detail: nil) = super

Instance Attribute Details

#actionSymbol

Returns :price_lowered, :price_raised, :price_reverted, :flagged, :no_action.

Returns:

  • (Symbol)

    :price_lowered, :price_raised, :price_reverted, :flagged, :no_action



58
59
60
61
62
# File 'app/services/catalog/amazon_buy_box_service.rb', line 58

Decision = Data.define(:action, :reason, :price, :source, :detail) do
  def initialize(action:, reason: nil, price: nil, source: nil, detail: nil) = super

  def acted? = action != :no_action
end

#detailObject?

Returns the underlying lowering/raising Result, for callers
that report on it (the daily run's blocked-by-external email).

Returns:

  • (Object, nil)

    the underlying lowering/raising Result, for callers
    that report on it (the daily run's blocked-by-external email)



58
59
60
61
62
# File 'app/services/catalog/amazon_buy_box_service.rb', line 58

Decision = Data.define(:action, :reason, :price, :source, :detail) do
  def initialize(action:, reason: nil, price: nil, source: nil, detail: nil) = super

  def acted? = action != :no_action
end

#priceObject (readonly)

Returns the value of attribute price

Returns:

  • (Object)

    the current value of price



58
59
60
# File 'app/services/catalog/amazon_buy_box_service.rb', line 58

def price
  @price
end

#reasonObject (readonly)

Returns the value of attribute reason

Returns:

  • (Object)

    the current value of reason



58
59
60
# File 'app/services/catalog/amazon_buy_box_service.rb', line 58

def reason
  @reason
end

#sourceSymbol?

Returns which rung of the ladder produced the target, or
:maintenance for the raising path.

Returns:

  • (Symbol, nil)

    which rung of the ladder produced the target, or
    :maintenance for the raising path



58
59
60
61
62
# File 'app/services/catalog/amazon_buy_box_service.rb', line 58

Decision = Data.define(:action, :reason, :price, :source, :detail) do
  def initialize(action:, reason: nil, price: nil, source: nil, detail: nil) = super

  def acted? = action != :no_action
end

Instance Method Details

#acted?Boolean

Returns:

  • (Boolean)


61
# File 'app/services/catalog/amazon_buy_box_service.rb', line 61

def acted? = action != :no_action