Class: PackageLabelsService
- Inherits:
-
ApplicationService
- Object
- ApplicationService
- PackageLabelsService
- Includes:
- PackageLabelGenerator
- Defined in:
- app/services/package_labels_service.rb
Overview
Service class to retrieve package custom labels
Constant Summary
Constants included from PackageLabelGenerator
PackageLabelGenerator::DEFAULT_LABEL_TYPE
Instance Attribute Summary
Attributes inherited from ApplicationService
Instance Method Summary collapse
- #cache_key ⇒ Object
-
#call ⇒ Array<Hash>
Calls the service and returns an array of package custom labels for each restaurant package.
-
#initialize(restaurant_package_ids) ⇒ PackageLabelsService
constructor
Initializes the service with the given restaurant package IDs.
Methods included from PackageLabelGenerator
#generate_label_names_for_package, #generate_labels_for_package
Methods inherited from ApplicationService
Constructor Details
#initialize(restaurant_package_ids) ⇒ PackageLabelsService
Initializes the service with the given restaurant package IDs.
11 12 13 |
# File 'app/services/package_labels_service.rb', line 11 def initialize(restaurant_package_ids) @restaurant_package_ids = restaurant_package_ids end |
Instance Method Details
#cache_key ⇒ Object
24 25 26 |
# File 'app/services/package_labels_service.rb', line 24 def cache_key HhPackage::RestaurantPackage.where(id: @restaurant_package_ids).cache_key end |
#call ⇒ Array<Hash>
Calls the service and returns an array of package custom labels for each restaurant package.
18 19 20 21 22 |
# File 'app/services/package_labels_service.rb', line 18 def call @restaurant_package_ids.map do |restaurant_package_id| package_custom_labels(restaurant_package_id) end end |