Sha256: 4a5d09805fc884d288a6e5c4de10cf1e9be286cf7f2182bcb9eda7ee2215734d

Contents?: true

Size: 563 Bytes

Versions: 25

Compression:

Stored size: 563 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

25 entries across 25 versions & 1 rubygems

Version Path
disco_app-0.9.4 app/jobs/disco_app/concerns/shop_update_job.rb
disco_app-0.9.5 app/jobs/disco_app/concerns/shop_update_job.rb
disco_app-0.9.6 app/jobs/disco_app/concerns/shop_update_job.rb
disco_app-0.9.7 app/jobs/disco_app/concerns/shop_update_job.rb
disco_app-0.9.8 app/jobs/disco_app/concerns/shop_update_job.rb
disco_app-0.9.9 app/jobs/disco_app/concerns/shop_update_job.rb
disco_app-0.9.10 app/jobs/disco_app/concerns/shop_update_job.rb
disco_app-0.9.11 app/jobs/disco_app/concerns/shop_update_job.rb
disco_app-0.10.0 app/jobs/disco_app/concerns/shop_update_job.rb
disco_app-0.10.1 app/jobs/disco_app/concerns/shop_update_job.rb
disco_app-0.10.2 app/jobs/disco_app/concerns/shop_update_job.rb
disco_app-0.10.3 app/jobs/disco_app/concerns/shop_update_job.rb
disco_app-0.10.4 app/jobs/disco_app/concerns/shop_update_job.rb
disco_app-0.10.5 app/jobs/disco_app/concerns/shop_update_job.rb
disco_app-0.11.0 app/jobs/disco_app/concerns/shop_update_job.rb
disco_app-0.11.1 app/jobs/disco_app/concerns/shop_update_job.rb
disco_app-0.12.0 app/jobs/disco_app/concerns/shop_update_job.rb
disco_app-0.12.1 app/jobs/disco_app/concerns/shop_update_job.rb
disco_app-0.12.5 app/jobs/disco_app/concerns/shop_update_job.rb
disco_app-0.12.6 app/jobs/disco_app/concerns/shop_update_job.rb