Class: Renalware::UKRDC::SendPatient::Payload

Inherits:
Object
  • Object
show all
Defined in:
app/models/renalware/ukrdc/send_patient.rb

Instance Method Summary collapse

Instance Method Details

#time_neutral_payloadObject

Remove the time elements from SendingFacility e.g.

<SendingFacility channelName='Renalware' time='2018-02-26T13:18:02+00:00'/>

becomes

<SendingFacility channelName='Renalware'/>

This allows us to do payload comparisons independent of the time they were sent.



100
101
102
103
104
105
# File 'app/models/renalware/ukrdc/send_patient.rb', line 100

def time_neutral_payload
  payload
    .gsub(/<Stream>[^<]*<\/Stream>/, "<Stream>removed</Stream>")
    .gsub(/ (time|start|stop)=["'][^'"]*['"]/, "")
    .gsub(/<UpdatedOn>[^<]*<\/UpdatedOn>/, "<UpdatedOn>removed</UpdatedOn>")
end

#to_md5_hashObject



90
91
92
# File 'app/models/renalware/ukrdc/send_patient.rb', line 90

def to_md5_hash
  @to_md5_hash ||= Digest::MD5.hexdigest(time_neutral_payload)
end