Sha256: 0930ec5110cf2fed4634131574e3fa10450aaf9abae54dad5e73122a0762fb04

Contents?: true

Size: 832 Bytes

Versions: 3

Compression:

Stored size: 832 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 :default

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

    organization_id = params.fetch(:organization, {}).fetch(:id, nil)
    inbox_id = params.fetch(:inbox, {}).fetch(:id, nil)
    plug_installation_id = params.fetch(:plug_installation, {}).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"
      YettoService.create_message(inbox_id, plug_installation_id, params)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hephaestus-0.3.1 templates/app/jobs/update_yetto_job.rb
hephaestus-0.2.3 templates/app/jobs/update_yetto_job.rb
hephaestus-0.2.2 templates/app/jobs/update_yetto_job.rb