Skip to content

Instantly share code, notes, and snippets.

@gterrill
Last active August 29, 2015 14:20
Show Gist options
  • Save gterrill/12e31b3cca5d3089b2d6 to your computer and use it in GitHub Desktop.
Save gterrill/12e31b3cca5d3089b2d6 to your computer and use it in GitHub Desktop.
Example of monkey patching the ShopifyAPI gem
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