Sha256: 8019ab0d403fe634588778ff284d1352577afeca3a352af8102794bb17b38a5e
Contents?: true
Size: 916 Bytes
Versions: 7
Compression:
Stored size: 916 Bytes
Contents
module Trello class WebhooksController < ApplicationController skip_before_action :verify_authenticity_token before_action :authorize def complete return head :ok end def receive if params[:event][:data].include?('listAfter') board_list_id = params[:event][:data][:listAfter][:id] card_id = params[:model][:id] associations = DealAssociation.where(card_id: card_id) associations.each do |association| deal_id = association.deal_id deal = Services::Hubspot::Deals::GetById.new(deal_id).call mapping = Mapping.where(board_list_id: board_list_id, pipeline_id: deal.properties['pipeline']).first if mapping.present? Services::Hubspot::Deals::Update.new(deal_id, properties: { dealstage: mapping.pipeline_stage_id }).call end end end render json: {} end end end
Version data entries
7 entries across 7 versions & 1 rubygems