Class: ReservationService::InitFactory
- Inherits:
-
Object
- Object
- ReservationService::InitFactory
- Defined in:
- app/services/reservation_service/init_factory.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#restaurant ⇒ Object
readonly
Returns the value of attribute restaurant.
Class Method Summary collapse
Instance Method Summary collapse
- #build_service ⇒ Object
-
#initialize(params) ⇒ InitFactory
constructor
A new instance of InitFactory.
Constructor Details
#initialize(params) ⇒ InitFactory
Returns a new instance of InitFactory.
5 6 7 8 |
# File 'app/services/reservation_service/init_factory.rb', line 5 def initialize(params) @params = params @restaurant = fetch_restaurant end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'app/services/reservation_service/init_factory.rb', line 3 def params @params end |
#restaurant ⇒ Object (readonly)
Returns the value of attribute restaurant.
3 4 5 |
# File 'app/services/reservation_service/init_factory.rb', line 3 def restaurant @restaurant end |
Class Method Details
.build(params) ⇒ Object
10 11 12 |
# File 'app/services/reservation_service/init_factory.rb', line 10 def self.build(params) new(params).build_service end |
Instance Method Details
#build_service ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/services/reservation_service/init_factory.rb', line 14 def build_service if restaurant&.inventory_tablecheck? ReservationService::Init::Tablecheck.new(params) elsif restaurant&.inventory_weeloy? ReservationService::Init::Weeloy.new(params) elsif restaurant&.inventory_bistrochat? ReservationService::Init::Bistrochat.new(params) elsif restaurant&.inventory_seven_rooms? ReservationService::Init::SevenRooms.new(params) elsif restaurant&. ReservationService::Init::MyMenu.new(params) else ReservationService::Init::HungryHub.new(params) end end |