Class: Item::Materials::Checks::WoodShakeRoof

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/item/materials/checks/wood_shake_roof.rb

Overview

Service object: wood shake roof.

Defined Under Namespace

Classes: Result

Instance Method Summary collapse

Instance Method Details

#process(container:, options: {}) ⇒ Result

rubocop:disable Lint/UnusedMethodArgument
options: is part of the shared Item::Materials::Checks polymorphic API
invoked by Item::Materials::Check#perform_checks_raw. Even though this
particular check ignores the value, the kwarg name has to stay as
options: so the bulk dispatch site keeps working.
:reek:UnusedParameters

Parameters:

  • container (Quote, Order, RoomConfiguration)

    the resource to check

  • options (Hash) (defaults to: {})

    shared check options passed by Item::Materials::Check

Options Hash (options:):

  • :for_www (Boolean)

    whether the check runs for the public site

  • :for_cart (Boolean)

    whether the check runs for the cart

Returns:

  • (Result)

    status and any material alerts



24
25
26
27
28
29
30
31
# File 'app/services/item/materials/checks/wood_shake_roof.rb', line 24

def process(container:, options: {})
  # rubocop:enable Lint/UnusedMethodArgument
  return Result.new(status: :skipped) unless qualify?(container)

  material_alerts = []
  material_alerts << Item::Materials::Alert.new(name: "Please ensure installation of copper flashing on  Wood Shakes roof to accomodate a roof and gutter deicing system.", container: container)
  Result.new(status: :ok, alerts: material_alerts)
end

#qualify?(container) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'app/services/item/materials/checks/wood_shake_roof.rb', line 9

def qualify?(container)
  container.is_a?(RoomConfiguration) && container&.floor_type&.is_wood_shake?
end