Class: Tablecheck::Restaurants::Detail
- Inherits:
-
Object
- Object
- Tablecheck::Restaurants::Detail
- Includes:
- DefaultErrorContainer, ApiHelpers
- Defined in:
- app/services/tablecheck/restaurants/detail.rb
Instance Attribute Summary collapse
-
#shop_id ⇒ Object
readonly
Returns the value of attribute shop_id.
-
#shop_slug ⇒ Object
readonly
Returns the value of attribute shop_slug.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(shop_id, shop_slug) ⇒ Detail
constructor
A new instance of Detail.
Methods included from DefaultErrorContainer
#error, #error_message_simple, #merge_errors
Methods included from ApiHelpers
#api_call, #channel, #find_tablecheck_vendor_application, #get_purpose, #headers, #parse_phone_number, #parse_user_or_guest_full_name, #parsed_vendor_name, #reservation_start_at, #send_error_availability_notification_to_staff
Constructor Details
#initialize(shop_id, shop_slug) ⇒ Detail
Returns a new instance of Detail.
10 11 12 13 |
# File 'app/services/tablecheck/restaurants/detail.rb', line 10 def initialize(shop_id, shop_slug) @shop_id = shop_id @shop_slug = shop_slug end |
Instance Attribute Details
#shop_id ⇒ Object (readonly)
Returns the value of attribute shop_id.
8 9 10 |
# File 'app/services/tablecheck/restaurants/detail.rb', line 8 def shop_id @shop_id end |
#shop_slug ⇒ Object (readonly)
Returns the value of attribute shop_slug.
8 9 10 |
# File 'app/services/tablecheck/restaurants/detail.rb', line 8 def shop_slug @shop_slug end |
Instance Method Details
#execute ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/services/tablecheck/restaurants/detail.rb', line 15 def execute errors.clear validation_result = validate_shop unless validation_result.success? = validation_result. errors.add(:base, ) return ServiceResult.new errors: errors, message: end result = get_tablecheck_shop(validation_result.data[:shop_id], validation_result.data[:shop_slug]) unless result.success? = result. errors.add(:base, ) return ServiceResult.new errors: errors, message: end ServiceResult.new data: result.data end |