Sha256: 2c6a0eb977a9fc4eee2ba98f3734ed535554941b3a4d14a510603f9ef9cd3ea5
Contents?: true
Size: 632 Bytes
Versions: 25
Compression:
Stored size: 632 Bytes
Contents
module DiscoApp::Concerns::ShopUpdateJob extend ActiveSupport::Concern # Perform an update of the current shop's information. def perform(shopify_domain, 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) # Ensure we can access shop data through symbols. shop_data = HashWithIndifferentAccess.new(shop_data) # Update model attributes present in both our model and the data hash. @shop.update_attributes(shop_data.except(:id, :created_at).slice(*DiscoApp::Shop.column_names)) end end
Version data entries
25 entries across 25 versions & 1 rubygems