Class: ReservationService::InitFactory

Inherits:
Object
  • Object
show all
Defined in:
app/services/reservation_service/init_factory.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#paramsObject (readonly)

Returns the value of attribute params.



3
4
5
# File 'app/services/reservation_service/init_factory.rb', line 3

def params
  @params
end

#restaurantObject (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_serviceObject



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&.inventory_my_menu?
    ReservationService::Init::MyMenu.new(params)
  else
    ReservationService::Init::HungryHub.new(params)
  end
end