lib/imperituroard/projects/mhub.rb in imperituroard-0.5.0 vs lib/imperituroard/projects/mhub.rb in imperituroard-0.5.1
- old
+ new
@@ -20,23 +20,24 @@
:sk_password,
:mhub_connector,
:internal_func,
:dabrab_connecter,
:static_callback,
- :crm_connector
+ :crm_connector,
+ :telegram_connector
def initialize(sk_url_simple, sk_login, sk_password, telegram_api_url, telegram_chat_id, sk_url_broadcast, static_callback, crm_callback_url, crm_login, crm_password)
@sk_url = sk_url_simple
@sk_login = sk_login
@sk_password = sk_password
@internal_func = InternalFunc.new
- @mhub_connector = Sksk_1.new(sk_url_simple, sk_login, sk_password, sk_url_broadcast)
+ @mhub_connector = Sksk_2.new(sk_url_simple, sk_login, sk_password, sk_url_broadcast, telegram_api_url, telegram_chat_id)
@internal_func = InternalFunc.new
@dabrab_connecter = Dabrab.new
- @add_functions_connector = AdditionalFunc.new(telegram_api_url, telegram_chat_id)
+ @telegram_connector = Telegram_2.new(telegram_api_url, telegram_chat_id)
@static_callback = static_callback
- @crm_connector = Crm_1.new(crm_callback_url, crm_login, crm_password)
+ @crm_connector = Crm_2.new(crm_callback_url, crm_login, crm_password, telegram_api_url, telegram_chat_id)
end
#{"destinations"=>[{"to"=>{"phoneNumber"=>"375297116638", "emailAddress"=>nil}}],
# "scenarioKey"=>"1", "viber"=>nil, "sms"=>{"text"=>"карточка готова"},
@@ -108,11 +109,12 @@
p hub_resp
output_params = {"code": 200, "result": "Data processed", "body": {"answer": mes_data[:body][:mess_to_recip], "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
rescue
- output_params = {"code": 500, "result": "Unknown SDK error", "body": {"answer": {}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
+ output_params = {"code": 500, "result": "MhubFunctions_2.get_send_message_2: Unknown SDK error", "body": {"answer": {}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
+ telegram_connector.telegram_message(output_params)
end
internal_func.printer_texter({:input => input_params, :output => output_params, :hub_resp => hub_resp, :procedure => "Mhub_2.get_send_message"}, "debug")
output_params
@@ -121,37 +123,26 @@
def rec_deliv_report_2(params, ip_src, ip_real, ip_vip)
input_params = {:params => params, :ip_src => ip_src, :ip_real => ip_real, :ip_vip => ip_vip}
output_params = {}
hub_resp = {}
- null_statement = [nil, "nil", "", "null"]
begin
-
mes_report = dabrab_connecter.delivery_report_transform(params)[:body][:report_to_recip]
-
- p "mes_report"
- p mes_report
- p "mes_report"
-
result = crm_connector.crm_status_1(mes_report)
-
output_params = {"code": 200, "result": "Data processed", "body": {"answer": {"code": 200, "status": "Success"}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
-
rescue
- output_params = {"code": 500, "result": "Unknown SDK error", "body": {"answer": {}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
+ output_params = {"code": 500, "result": "MhubFunctions_2.rec_deliv_report_2: Unknown SDK error", "body": {"answer": {}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}}
+ telegram_connector.telegram_message(output_params)
end
-
internal_func.printer_texter({:input => input_params, :output => output_params, :hub_resp => hub_resp, :procedure => "Mhub_2.recieve_delivery_report"}, "debug")
output_params
-
end
def test2
hh = Infobip_1.new
hh.test
end
-
end
\ No newline at end of file