Sha256: 91a170cb91ecd6800192552d9eac41be7af32b82defaee2de5ce9db02d12c740

Contents?: true

Size: 828 Bytes

Versions: 5

Compression:

Stored size: 828 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)

    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_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

5 entries across 5 versions & 1 rubygems

Version Path
hephaestus-0.6.4 templates/app/jobs/update_yetto_job.rb
hephaestus-0.6.3 templates/app/jobs/update_yetto_job.rb
hephaestus-0.6.2 templates/app/jobs/update_yetto_job.rb
hephaestus-0.6.1 templates/app/jobs/update_yetto_job.rb
hephaestus-0.6.0 templates/app/jobs/update_yetto_job.rb