Class: Widgets::UserRequest::Main

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
app/my_lib/widgets/user_request/main.rb

Overview

Main class of Offering Booking Assistance Logic

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Main

Returns a new instance of Main.



19
20
21
22
23
# File 'app/my_lib/widgets/user_request/main.rb', line 19

def initialize(params = {})
  params.each_pair do |key, value|
    send("#{key}=".to_sym, value) if respond_to?("#{key}=".to_sym)
  end
end

Instance Attribute Details

#dateObject

Returns the value of attribute date.



10
11
12
# File 'app/my_lib/widgets/user_request/main.rb', line 10

def date
  @date
end

#messageObject

Returns the value of attribute message.



10
11
12
# File 'app/my_lib/widgets/user_request/main.rb', line 10

def message
  @message
end

#nameObject

Returns the value of attribute name.



10
11
12
# File 'app/my_lib/widgets/user_request/main.rb', line 10

def name
  @name
end

#party_sizeObject

Returns the value of attribute party_size.



10
11
12
# File 'app/my_lib/widgets/user_request/main.rb', line 10

def party_size
  @party_size
end

#phoneObject

Returns the value of attribute phone.



10
11
12
# File 'app/my_lib/widgets/user_request/main.rb', line 10

def phone
  @phone
end

#restaurant_idObject

Returns the value of attribute restaurant_id.



10
11
12
# File 'app/my_lib/widgets/user_request/main.rb', line 10

def restaurant_id
  @restaurant_id
end

#timeObject

Returns the value of attribute time.



10
11
12
# File 'app/my_lib/widgets/user_request/main.rb', line 10

def time
  @time
end

Instance Method Details

#error_messageObject



25
26
27
# File 'app/my_lib/widgets/user_request/main.rb', line 25

def error_message
  errors.blank? ? nil : errors.full_messages.to_sentence
end

#executeObject



29
30
31
32
# File 'app/my_lib/widgets/user_request/main.rb', line 29

def execute
  return false unless valid?
  ::UserRequestWorker.perform_async(worker_payload)
end