Sha256: 1a6205f8d1d780b53185ec4a1d0b6c9db87f42c258143825b01ee987bcb44178
Contents?: true
Size: 556 Bytes
Versions: 2
Compression:
Stored size: 556 Bytes
Contents
module DiscoApp::Concerns::SynchronisesWithShopify extend ActiveSupport::Concern class_methods do def synchronise_from_shopify(shop, data) data = data.with_indifferent_access instance = self.find_or_create_by!(id: data[:id]) do |instance| instance.shop = shop instance.data = data end instance.update(data: data) instance end def synchronise_deletion_from_shopify(shop, data) data = data.with_indifferent_access self.destroy_all(shop: shop, id: data[:id]) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
disco_app-0.8.4 | app/models/disco_app/concerns/synchronises_with_shopify.rb |
disco_app-0.8.5 | app/models/disco_app/concerns/synchronises_with_shopify.rb |