Sha256: 846f6cb528a6f82482611b20c7791f63186f135b00de564ae6f85b88f9330631
Contents?: true
Size: 566 Bytes
Versions: 11
Compression:
Stored size: 566 Bytes
Contents
module DiscoApp class ShopUpdateJob < DiscoApp::ShopJob def perform(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(*::Shop.column_names)) end end end
Version data entries
11 entries across 11 versions & 1 rubygems