Class: Bistrochat::Restaurants::Detail
- Inherits:
-
Object
- Object
- Bistrochat::Restaurants::Detail
- Includes:
- ApiHelpers, DefaultErrorContainer, ElasticAPM::SpanHelpers
- Defined in:
- app/services/bistrochat/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_bistrochat_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.
11 12 13 14 |
# File 'app/services/bistrochat/restaurants/detail.rb', line 11 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.
9 10 11 |
# File 'app/services/bistrochat/restaurants/detail.rb', line 9 def shop_id @shop_id end |
#shop_slug ⇒ Object (readonly)
Returns the value of attribute shop_slug.
9 10 11 |
# File 'app/services/bistrochat/restaurants/detail.rb', line 9 def shop_slug @shop_slug end |
Instance Method Details
#execute ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/services/bistrochat/restaurants/detail.rb', line 16 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_bistrochat_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 |