create.rb 435 B

1234567891011121314151617181920
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Service::Channel::Whatsapp
  3. class Create < Base
  4. def initialize(params:)
  5. super()
  6. @params = params
  7. end
  8. def execute
  9. ActiveRecord::Base.transaction do
  10. ::Channel.create!(
  11. area: area,
  12. **attributes_hash
  13. ).tap { |channel| add_metadata(channel:, initial: true) }
  14. end
  15. end
  16. end
  17. end