Class: VendorsService::GoogleReserve::DescriptionGeneratorService
- Inherits:
-
ApplicationService
- Object
- ApplicationService
- VendorsService::GoogleReserve::DescriptionGeneratorService
- Includes:
- ElasticAPM::SpanHelpers
- Defined in:
- app/services/vendors_service/google_reserve/description_generator_service.rb
Overview
Service to generate AI-powered package descriptions for Google Reserve packages.
Takes a restaurant package ID as input and generates a comprehensive description using AI based on package details, restaurant info, benefits, and booking rules. The service only generates and returns descriptions - database updates are handled by the caller.
Restaurant description logic matches the API serializer format but returns plain text without HTML tags for AI processing.
Instance Attribute Summary collapse
-
#openrouter_client ⇒ Object
readonly
Returns the value of attribute openrouter_client.
-
#package ⇒ Object
readonly
Returns the value of attribute package.
-
#restaurant ⇒ Object
readonly
Returns the value of attribute restaurant.
-
#restaurant_package ⇒ Object
readonly
Returns the value of attribute restaurant_package.
-
#restaurant_package_id ⇒ Object
readonly
Returns the value of attribute restaurant_package_id.
Attributes inherited from ApplicationService
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(restaurant_package_id) ⇒ ServiceResult
constructor
Generates AI description for a Google Reserve package.
Methods inherited from ApplicationService
Constructor Details
#initialize(restaurant_package_id) ⇒ ServiceResult
Generates AI description for a Google Reserve package.
53 54 55 56 57 |
# File 'app/services/vendors_service/google_reserve/description_generator_service.rb', line 53 def initialize(restaurant_package_id) super() @restaurant_package_id = restaurant_package_id @openrouter_client = OpenrouterClient.new end |
Instance Attribute Details
#openrouter_client ⇒ Object (readonly)
Returns the value of attribute openrouter_client.
46 47 48 |
# File 'app/services/vendors_service/google_reserve/description_generator_service.rb', line 46 def openrouter_client @openrouter_client end |
#package ⇒ Object (readonly)
Returns the value of attribute package.
46 47 48 |
# File 'app/services/vendors_service/google_reserve/description_generator_service.rb', line 46 def package @package end |
#restaurant ⇒ Object (readonly)
Returns the value of attribute restaurant.
46 47 48 |
# File 'app/services/vendors_service/google_reserve/description_generator_service.rb', line 46 def restaurant @restaurant end |
#restaurant_package ⇒ Object (readonly)
Returns the value of attribute restaurant_package.
46 47 48 |
# File 'app/services/vendors_service/google_reserve/description_generator_service.rb', line 46 def restaurant_package @restaurant_package end |
#restaurant_package_id ⇒ Object (readonly)
Returns the value of attribute restaurant_package_id.
46 47 48 |
# File 'app/services/vendors_service/google_reserve/description_generator_service.rb', line 46 def restaurant_package_id @restaurant_package_id end |
Instance Method Details
#call ⇒ Object
59 60 61 62 63 64 |
# File 'app/services/vendors_service/google_reserve/description_generator_service.rb', line 59 def call load_data generate_description rescue StandardError => e handle_error(e) end |