Sha256: c8d0052b6666e76acc8a91fb79ca7b73c1aa20ee2f10c2485fded0abcbc0fbd4

Contents?: true

Size: 876 Bytes

Versions: 5

Compression:

Stored size: 876 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 "installation"
      YettoService.update_installation(organization_id, inbox_id, plug_installation_id, params)
    when "switch"
      plug_id = params.fetch(:plug, {}).fetch(:id, nil)
      YettoService.create_switch(organization_id, inbox_id, plug_id, params)
    when "message"
      YettoService.create_message(organization_id, inbox_id, params)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hephaestus-0.1.3 templates/app/jobs/update_yetto_job.rb
hephaestus-0.1.2 templates/app/jobs/update_yetto_job.rb
hephaestus-0.1.1 templates/app/jobs/update_yetto_job.rb
hephaestus-0.0.2 templates/app/jobs/update_yetto_job.rb
hephaestus-0.0.1 templates/app/jobs/update_yetto_job.rb