Sha256: 9e39a5b7041c145da616eafb907ae22aef355b42d63fc73a2bb395dbe7baff84

Contents?: true

Size: 949 Bytes

Versions: 4

Compression:

Stored size: 949 Bytes

Contents

# typed: false
# frozen_string_literal: true

# Send updated data to Yetto to store in the database
# This can be used to update installation data or message data

class UpdateYettoJob < ApplicationJob
  queue_as :update_yetto

  def perform(params)
    type = params.delete(:type)

    inbox_id = params.fetch(:inbox, {}).fetch(:id, nil)
    plug_installation_id = params.fetch(:plug_installation, {}).fetch(:id, nil)
    message_id = params.fetch(:message, {}).fetch(:id, nil)

    case type
    when "update_plug_installation"
      YettoService.update_installation(plug_installation_id, params)
    when "create_inbox_switch"
      YettoService.create_inbox_switch(inbox_id, plug_installation_id, params)
    when "create_message_reply"
      YettoService.create_message_reply(message_id, plug_installation_id, params)
    when "add_message_metadata"
      YettoService.update_message(message_id, plug_installation_id, params)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hephaestus-0.5.2 templates/app/jobs/update_yetto_job.rb
hephaestus-0.5.1 templates/app/jobs/update_yetto_job.rb
hephaestus-0.5.0 templates/app/jobs/update_yetto_job.rb
hephaestus-0.4.0 templates/app/jobs/update_yetto_job.rb