Produced by Araxis Merge on 8/4/2017 2:44:58 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | CUI-Release-v2.2.0-source.zip\CUI-Release-v2.2.0-source\app\jobs | vler_das_job.rb | Thu Jun 15 19:04:28 2017 UTC |
| 2 | CUI-Release-v2.2.0-source.zip\CUI-Release-v2.2.0-source\app\jobs | vler_das_job.rb | Fri Aug 4 14:48:07 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 358 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | require 'h ttpi' | |
| 2 | ||
| 3 | class Vler DASJob < A ctiveJob:: Base | |
| 4 | queue_as :renderin g | |
| 5 | ||
| 6 | def self .perform(e valuation) | |
| 7 | evalua tion_xml = evaluatio n.to_xml | |
| 8 | activi ty_log = E valuationL og.new(sub mitted_dat a: evaluat ion_xml, e valuation_ id: evalua tion.id, m essage: "V LER-DAS ev aluation s ubmission" ) | |
| 9 | valida tion_error s = evalua tion.valid ate_xml | |
| 10 | if eva luation.co mplete? | |
| 11 | url = ENV['VLE R_DAS_EXAM _RESPONSE_ URL'] | |
| 12 | if u rl != nil && url.len gth > 0 | |
| 13 | va lidation_e rrors = ev aluation.v alidate_xm l | |
| 14 | if validatio n_errors.e mpty? | |
| 15 | req = buil d_request( url, evalu ation_xml, "cui-#{ev aluation.g uid}.xml") | |
| 16 | response = HTTPI.pos t(req) | |
| 17 | activity_l og.respons e_body = r esponse.bo dy | |
| 18 | el se | |
| 19 | activity_l og.message = validat ion_errors .join("; " ) | |
| 20 | en d | |
| 21 | end | |
| 22 | else | |
| 23 | acti vity_log.m essage = " Evaluation is not co mplete." | |
| 24 | end | |
| 25 | activi ty_log.sav e | |
| 26 | end | |
| 27 | ||
| 28 | def self .sendExamR esponse(fu ll_body_ev aluation) | |
| 29 | full_b ody_evalua tion.exam_ responses. each do |t he_exam_re sponse_to_ send| | |
| 30 | self .builds_an d_sends_a_ single_exa m_response _message( full_body_ evaluation .id, | |
| 31 | "cui-#{ful l_body_eva luation.gu id}.xml", | |
| 32 | the_exam_r esponse_to _send ) | |
| 33 | end | |
| 34 | # evalu ation_xml = full_bod y_evaluati on.to_xml | |
| 35 | # activ ity_log = Evaluation Log.new(su bmitted_da ta: evalua tion_xml, evaluation _id: full_ body_evalu ation.id, message: " VLER-DAS e valuation submission ") | |
| 36 | # url = ENV['VLER _DAS_URL'] | |
| 37 | # url = "htt ps://silve rvler. DNS /ecrud/v1/ core/examR esponse/tr ansform" | |
| 38 | # #vali dation_err ors = eval uation.val idate_xml | |
| 39 | # req = build_req uest(url, evaluation _xml, "cui -#{full_bo dy_evaluat ion.guid}. xml") | |
| 40 | # respo nse = HTTP I.post(req ) | |
| 41 | # activ ity_log.re sponse_bod y = respon se.body | |
| 42 | # activ ity_log.sa ve | |
| 43 | end | |
| 44 | ||
| 45 | def self .builds_an d_sends_a_ single_exa m_response _message(t he_id, the _file_name , the_exam _response_ string) | |
| 46 | activi ty_log = E valuationL og.new( su bmitted_da ta: the_ex am_respons e_string, | |
| 47 | ev aluation_i d: the_id, | |
| 48 | me ssage: "VL ER-DAS eva luation su bmission") | |
| 49 | url = ENV['VLER_ DAS_EXAM_R ESPONSE_UR L'] | |
| 50 | ||
| 51 | if url != nil && url.lengt h > 0 | |
| 52 | #val idation_er rors = eva luation.va lidate_xml | |
| 53 | req = build_re quest(url, the_exam_ response_s tring, the _file_name ) | |
| 54 | resp onse = HTT PI.post(re q) | |
| 55 | acti vity_log.r esponse_bo dy = respo nse.body | |
| 56 | acti vity_log.s ave | |
| 57 | end | |
| 58 | end | |
| 59 | ||
| 60 | def self .postNotif ication(no tification Xml) | |
| 61 | HTTPI. log = false | |
| 62 | url = ENV['APP_U RL'] + "/a pi/v1/clai ms" | |
| 63 | reques t = HTTPI: :Request.n ew(url) | |
| 64 | ||
| 65 | reques t.auth.ssl .verify_mo de = :none | |
| 66 | ||
| 67 | reques t.body = n otificatio nXml | |
| 68 | respon se = HTTPI .post(requ est) | |
| 69 | respon seBody = r esponse.bo dy | |
| 70 | end | |
| 71 | ||
| 72 | def self .sendNotif ication(no tification Event, eve nt_id, cla im_id, not ification_ type) | |
| 73 | if (ev ent_id == nil) | |
| 74 | rais e Exceptio n, "Event Id cannot be empty" | |
| 75 | end | |
| 76 | if (cl aim_id == nil) | |
| 77 | rais e Exceptio n, "Claim Id cannot be empty" | |
| 78 | end | |
| 79 | valida tion_error s = notifi cationEven t.validate _xml | |
| 80 | # valid ation_erro rs = notif icationEve nt.errors | |
| 81 | ||
| 82 | url = ENV['VLER_ DAS_EXAM_M ANAGEMENT_ URL'] | |
| 83 | if url != nil && url.length > 0 | |
| 84 | notifi cationXml = notifica tionEvent. to_xml | |
| 85 | notifi cation_log = Notific ationLog.n ew(submitt ed_xml_dat a: notific ationXml, event_id: event_id, claim_id: claim_id, message: " VLER-DAS n otificatio n submissi on", notif ication_ty pe: notifi cation_typ e) | |
| 86 | if val idation_er rors.empty ? | |
| 87 | if n otificatio nXml != ni l | |
| 88 | re q = build_ notificati on_request (url, noti ficationXm l) | |
| 89 | ||
| 90 | if VLER_DAS_ ENABLE_NOT IFICATIONS | |
| 91 | response = HTTPI.pos t(req) | |
| 92 | responseBo dy = respo nse.body | |
| 93 | ||
| 94 | notificati on_log.res ponse_body = respons eBody | |
| 95 | el se | |
| 96 | notificati on_log.mes sage = "DA S Silver e nvironment seems to having iss ues. Notif ication ar e not bein g sent to DAS tempor arily." | |
| 97 | en d | |
| 98 | else | |
| 99 | no tification _log.messa ge = "Noti fication c annot be e mpty" | |
| 100 | end | |
| 101 | else | |
| 102 | noti fication_l og.message = validat ion_errors .join("; " ) | |
| 103 | end | |
| 104 | notifi cation_log .save | |
| 105 | end | |
| 106 | end | |
| 107 | ||
| 108 | def self .build_not ification_ request(ur l, notific ationXml) | |
| 109 | reques t = HTTPI: :Request.n ew(url) | |
| 110 | ||
| 111 | reques t.auth.ssl .verify_mo de = :none | |
| 112 | ||
| 113 | unless ENV['VLER _DAS_CERT' ].blank? | |
| 114 | requ est.auth.s sl.cert_ke y_file = (Rails. root + ENV ['VLER_DAS _KEYFILE'] ).to_s | |
| 115 | requ est.auth.s sl.cert_fi le = (Rails. root + ENV ['VLER_DAS _CERT']).t o_s | |
| 116 | requ est.auth.s sl.ca_cert _file = (Rails. root + ENV ['VLER_DAS _CACERT']) .to_s | |
| 117 | requ est.auth.s sl.verify_ mode = :peer | |
| 118 | end | |
| 119 | ||
| 120 | reques t.headers = {'Conten t-Type' => 'applicat ion/xml', | |
| 121 | 'Accept ' => 'applicat ion/xml'} | |
| 122 | reques t.body = n otificatio nXml | |
| 123 | reques t | |
| 124 | end | |
| 125 | ||
| 126 | # DAS eC RUD ICD se ction 4.10 : | |
| 127 | # | |
| 128 | # Create /POST Requ est STR PD F Document With Larg e File Upl oad Reques t | |
| 129 | # Reques t URL Patt ern: | |
| 130 | # POST http(s):/ /{host}:{p ort}/ecrud /v1/core/f s | |
| 131 | #  ï¿¼ï¿¼ï¿¼ï ¿¼ï¿¼ï¿¼ï¿ ¼ï¿¼ï¿¼eCR UD Service Interface Control D ocument 58 May 2014 | |
| 132 | # Requir ed Request Header(s) : Content- Type: “m ultipart/f orm-data†| |
| 133 | # Requir ed Multipa rt form re quirements in reques t body: | |
| 134 | # ◠†œpart†i s first an d only par t in multi part reque st; | |
| 135 | # ◠†œpart†c ontent-typ e attribut e is set, i.e. “ap plication/ pdfâ€; | |
| 136 | # ◠†œpart†i s in form element wi th a name of “file â€; | |
| 137 | # ◠†œpart†h as origina l filename stored in above “ file†el ement. | |
| 138 | # Reques t Payload: | |
| 139 | # Binary stream of applicati on/pdf sen t in “mu ltipart/fo rm-data†request. This is us ually hand led by the eCRUD Con sumer, i.e . “User Agentâ€. | |
| 140 | # | |
| 141 | # RFC 23 88: | |
| 142 | # Each p art is exp ected to c ontain a c ontent-dis position h eader [RFC 2183] whe re the | |
| 143 | # dispos ition type is "form- data", and where the dispositi on contain s | |
| 144 | # an (ad ditional) parameter of "name", where the value of that | |
| 145 | # parame ter is the original field name in the fo rm. For ex ample, a p art | |
| 146 | # might contain a header: | |
| 147 | # | |
| 148 | # Conten t-Disposit ion: form- data; name ="user" | |
| 149 | def self .form_enco de(data, f ilename) | |
| 150 | ERB.ne w(<<-EOF). result(bin ding) | |
| 151 | --3e776445 -b95f-4bc7 -9dca-38a8 9dc3a674\r | |
| 152 | Content-Di sposition: form-data ; name="fi le"; filen ame="<%= f ilename %> "\r | |
| 153 | Content-Ty pe: applic ation/xml\ r | |
| 154 | \r | |
| 155 | <%= data % >\r | |
| 156 | \r | |
| 157 | --3e776445 -b95f-4bc7 -9dca-38a8 9dc3a674-- \r | |
| 158 | EOF | |
| 159 | end | |
| 160 | ||
| 161 | def self .build_req uest(url, data, file name) | |
| 162 | reques t = HTTPI: :Request.n ew(url) | |
| 163 | ||
| 164 | reques t.auth.ssl .verify_mo de = :none | |
| 165 | ||
| 166 | unless ENV['VLER _DAS_CERT' ].blank? | |
| 167 | requ est.auth.s sl.cert_ke y_file = (Rails. root + ENV ['VLER_DAS _KEYFILE'] ).to_s | |
| 168 | requ est.auth.s sl.cert_fi le = (Rails. root + ENV ['VLER_DAS _CERT']).t o_s | |
| 169 | requ est.auth.s sl.ca_cert _file = (Rails. root + ENV ['VLER_DAS _CACERT']) .to_s | |
| 170 | requ est.auth.s sl.verify_ mode = :peer | |
| 171 | end | |
| 172 | ||
| 173 | reques t.headers = { | |
| 174 | 'Con tent-Type' => 'multi part/form- data; boun dary=3e776 445-b95f-4 bc7-9dca-3 8a89dc3a67 4', | |
| 175 | 'Acc ept' => 'a pplication /json' | |
| 176 | } | |
| 177 | reques t.body = f orm_encode (data, fil ename) | |
| 178 | reques t | |
| 179 | end | |
| 180 | end |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.