Sha256: 02c2535ad977644792bb0df205108d3bbe5d7485785a3b021e71ad5435161547
Contents?: true
Size: 564 Bytes
Versions: 17
Compression:
Stored size: 564 Bytes
Contents
module DiscoApp::Concerns::ShopUpdateJob extend ActiveSupport::Concern # Perform an update of the current shop's information. def perform(_shop, shop_data = nil) # If we weren't provided with shop data (eg from a webhook), fetch it. shop_data ||= ActiveSupport::JSON::decode(ShopifyAPI::Shop.current.to_json) # Update attributes stored directly on the Shop model, along with the data hash itself. @shop.update(shop_data.with_indifferent_access.slice(*DiscoApp::Shop.column_names).except(:id, :created_at).merge(data: shop_data)) end end
Version data entries
17 entries across 17 versions & 1 rubygems