Class: NetworkPostSyncJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- NetworkPostSyncJob
- Defined in:
- app/jobs/network_post_sync_job.rb
Overview
Parse post body and synchronize post with main site
Instance Method Summary collapse
Instance Method Details
#perform(entity_id, for_update = false) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/jobs/network_post_sync_job.rb', line 9 def perform(entity_id, for_update = false) entity = Post.find_by(id: entity_id) return if entity.nil? handler = NetworkManager::PostHandler.new entity.update(parsed_body: PostManager.new(entity).parsed_body) return unless Rails.env.production? for_update ? handler.update_remote(entity) : handler.create_remote(entity) end |