Sha256: 98776b6b6e92bd16ba23eda838b5b4a677cf692e5170ba6555e91408287509a3

Contents?: true

Size: 643 Bytes

Versions: 5

Compression:

Stored size: 643 Bytes

Contents

module SolidusMailchimpSync
  class VariantSynchronizer < BaseSynchronizer
    self.serializer_class_name = "::SolidusMailchimpSync::VariantSerializer"
    # Price updates are caught from after commit on Spree::Price
    self.synced_attributes = %w{id sku}

    def sync
      put
    rescue SolidusMailchimpSync::Error => e
      tries ||= 0 ; tries += 1
      if tries <= 1 && e.status == 400 && e.title == 'Parent Product Does Not Exist'
        ProductSynchronizer.new(model.product).sync
        retry
      else
        raise e
      end
    end

    def path
      "/products/#{model.product.id}/variants/#{model.id}"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
solidus_mailchimp_sync-1.0.0.beta05 app/synchronizers/solidus_mailchimp_sync/variant_synchronizer.rb
solidus_mailchimp_sync-1.0.0.beta04 app/synchronizers/solidus_mailchimp_sync/variant_synchronizer.rb
solidus_mailchimp_sync-1.0.0.beta03 app/synchronizers/solidus_mailchimp_sync/variant_synchronizer.rb
solidus_mailchimp_sync-1.0.0.beta02 app/synchronizers/solidus_mailchimp_sync/variant_synchronizer.rb
solidus_mailchimp_sync-1.0.0.beta01 app/synchronizers/solidus_mailchimp_sync/variant_synchronizer.rb