resource_feedback.rb 612 B

12345678910111213141516171819
  1. # frozen_string_literal: true
  2. module ShopifyAPI
  3. class ResourceFeedback < Base
  4. class ExistingFeedbackSaved < StandardError; end
  5. include DisablePrefixCheck
  6. self.collection_name = 'resource_feedback'
  7. conditional_prefix :product, false
  8. EXISTING_FEEDBACK_SAVED_ERROR_MESSAGE = 'WARNING: Attempted call to ShopifyAPI::ResourceFeedback#save' \
  9. 'after it was already persisted. Updating an existing ShopifyAPI::ResourceFeedback is not supported.'
  10. def save
  11. return super unless persisted?
  12. raise ExistingFeedbackSaved, EXISTING_FEEDBACK_SAVED_ERROR_MESSAGE
  13. end
  14. end
  15. end