Class: PackageBooking::Owners::Create

Inherits:
Agents::CreateBase show all
Includes:
Agents::SectionTrees, Components::ViewDecorator
Defined in:
app/my_lib/package_booking/owners/create.rb

Overview

Responsible to create reservation + package from Owner perspective class PackageBooking::Owners

Constant Summary

Constants inherited from Agents::Base

Agents::Base::WORKER_DELAY_TIME

Instance Attribute Summary collapse

Attributes inherited from Agents::Base

#audit_comment, #errors, #executor, #force_update, #owner, #reservation, #reservation_params, #restaurant, #user, #vendor_booking_id

Instance Method Summary collapse

Methods included from Agents::SectionTrees

#build_group_section_trees, #build_section_trees

Methods included from Components::ViewDecorator

#origin_selected_packages, #reservation_attributes, #selected_packages, #state

Methods inherited from Agents::CreateBase

#execute, #execute!, #make_booking, #notification_sent?

Methods inherited from Agents::Base

#error_message, #hotline, #inventory_available?, #save_reservation!, #status=

Methods included from Agents::SharedJobs

#give_campaign_reward, #send_rating_email

Constructor Details

#initialize(reservation:, package:, add_on: nil) ⇒ Create

Returns a new instance of Create.

Parameters:

  • reservation

    Hash of Reservation attribute



16
17
18
19
20
21
22
# File 'app/my_lib/package_booking/owners/create.rb', line 16

def initialize(reservation:, package:, add_on: nil)
  super(reservation)

  @package = package
  @add_on = add_on
  after_initialize
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Agents::Base

Instance Attribute Details

#add_onObject (readonly)

Returns the value of attribute add_on.



13
14
15
# File 'app/my_lib/package_booking/owners/create.rb', line 13

def add_on
  @add_on
end

#packageObject (readonly)

Returns the value of attribute package.



13
14
15
# File 'app/my_lib/package_booking/owners/create.rb', line 13

def package
  @package
end

Instance Method Details

#make_booking!Object



24
25
26
27
28
29
# File 'app/my_lib/package_booking/owners/create.rb', line 24

def make_booking!
  validate_owner_parameters!
  save_reservation_and_package!
  additional_tasks
  true
end