Last active
August 29, 2015 14:20
-
-
Save gterrill/12e31b3cca5d3089b2d6 to your computer and use it in GitHub Desktop.
Example of monkey patching the ShopifyAPI gem
This file contains hidden or 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
module ShopifyAPI | |
class Product | |
def prices | |
variants.collect(&:price).collect(&:to_f) | |
end | |
def price_min | |
prices.min | |
end | |
def price_max | |
prices.max | |
end | |
def available? | |
variants.map(&:inventory_quantity).sum > 0 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment