lib/imperituroard.rb in imperituroard-0.4.0 vs lib/imperituroard.rb in imperituroard-0.4.1

- old
+ new

@@ -798,22 +798,30 @@ end class Mhub_2 - attr_accessor :sk_url, :sk_login, :sk_password, :mhub_connector, :internal_func, :dabrab_connecter, :static_callback + attr_accessor :sk_url, + :sk_login, + :sk_password, + :mhub_connector, + :internal_func, + :dabrab_connecter, + :static_callback, + :crm_connector - def initialize(sk_url_simple, sk_login, sk_password, telegram_api_url, telegram_chat_id, sk_url_broadcast, static_callback) + 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) @internal_func = InternalFunc.new @dabrab_connecter = Dabrab.new @add_functions_connector = AdditionalFunc.new(telegram_api_url, telegram_chat_id) @static_callback = static_callback + @crm_connector = Crm_1.new(crm_callback_url, crm_login, crm_password) end #{"destinations"=>[{"to"=>{"phoneNumber"=>"375297116638", "emailAddress"=>nil}}], # "scenarioKey"=>"1", "viber"=>nil, "sms"=>{"text"=>"карточка готова"}, @@ -889,9 +897,34 @@ rescue output_params = {"code": 500, "result": "Unknown SDK error", "body": {"answer": {}, "sender": {"ip_src": ip_src, "ip_real": ip_real, "ip_vip": ip_vip}}} end internal_func.printer_texter({:input => input_params, :output => output_params, :hub_resp => hub_resp, :procedure => "Mhub_2.get_send_message"}, "debug") + output_params + + end + + + def recieve_delivery_report(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] + + 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}}} + 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 \ No newline at end of file