Last active
March 14, 2021 18:56
-
-
Save ignacio-chiazzo/7e51ff0bb4b6d1a0fb445181453e3d47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Consumer 2 Logic | |
require 'pricing_engine' | |
module StorefrontRenderer | |
class PricingRepository < PricingEngine::PricingRepositoryInterface | |
def variants_by_ids(ids) | |
variants = DataStoreConnection.execute("SELECT title, price FROM variants WHERE id in (?)", ids).limit(50) | |
variants.map { |variant| PricingEngine::Schema::Variant.new(title: variant.title, price: variant.price) } | |
end | |
def variants_by_titles(titles) | |
variants = DataStoreConnection.execute("SELECT title, price FROM variants WHERE name in (?)", titles).limit(50) | |
variants.map { |variant| PricingEngine::Schema::Variant.new(title: variant.title, price: variant.price) } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment