chore: Upgrade to Rails 7 (#6719)

fixes: #6736
This commit is contained in:
Sojan Jose
2023-05-06 10:44:52 +05:30
committed by GitHub
parent 59433d9d3c
commit 022383d942
53 changed files with 1696 additions and 682 deletions

View File

@@ -1,3 +1,5 @@
require 'google/cloud/dialogflow/v2'
class Integrations::Dialogflow::ProcessorService < Integrations::BotProcessorService
pattr_initialize [:event_name!, :hook!, :event_data!]
@@ -17,11 +19,15 @@ class Integrations::Dialogflow::ProcessorService < Integrations::BotProcessorSer
Rails.logger.warn "Account: #{hook.try(:account_id)} Hook: #{hook.id} credentials are not present." && return
end
Google::Cloud::Dialogflow.configure { |config| config.credentials = hook.settings['credentials'] }
session_client = Google::Cloud::Dialogflow.sessions
session = session_client.session_path project: hook.settings['project_id'], session: session_id
::Google::Cloud::Dialogflow::V2::Sessions::Client.configure do |config|
config.timeout = 10.0
config.credentials = hook.settings['credentials']
end
client = ::Google::Cloud::Dialogflow::V2::Sessions::Client.new
session = "projects/#{hook.settings['project_id']}/agent/sessions/#{session_id}"
query_input = { text: { text: message, language_code: 'en-US' } }
session_client.detect_intent session: session, query_input: query_input
client.detect_intent session: session, query_input: query_input
end
def process_response(message, response)

View File

@@ -1,3 +1,4 @@
require 'google/cloud/translate/v3'
class Integrations::GoogleTranslate::DetectLanguageService
pattr_initialize [:hook!, :message!]
@@ -33,7 +34,7 @@ class Integrations::GoogleTranslate::DetectLanguageService
end
def client
@client ||= Google::Cloud::Translate.translation_service do |config|
@client ||= ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config|
config.credentials = hook.settings['credentials']
end
end

View File

@@ -1,3 +1,4 @@
require 'google/cloud/translate/v3'
class Integrations::GoogleTranslate::ProcessorService
pattr_initialize [:message!, :target_language!]
@@ -23,7 +24,7 @@ class Integrations::GoogleTranslate::ProcessorService
end
def client
@client ||= Google::Cloud::Translate.translation_service do |config|
@client ||= ::Google::Cloud::Translate::V3::TranslationService::Client.new do |config|
config.credentials = hook.settings['credentials']
end
end