Class: Renalware::UKRDC::SendPatients

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(changed_since: nil, patient_ids: nil, logger: nil) ⇒ SendPatients

Returns a new instance of SendPatients.



10
11
12
13
14
15
# File 'app/models/renalware/ukrdc/send_patients.rb', line 10

def initialize(changed_since: nil, patient_ids: nil, logger: nil)
  @changed_since = Time.zone.parse(changed_since) if changed_since.present?
  @patient_ids = Array(patient_ids)
  @logger = logger || Rails.logger
  @request_uuid = SecureRandom.uuid # helps group logs together
end

Instance Attribute Details

#changed_sinceObject (readonly)

Returns the value of attribute changed_since.



8
9
10
# File 'app/models/renalware/ukrdc/send_patients.rb', line 8

def changed_since
  @changed_since
end

#loggerObject (readonly)

Returns the value of attribute logger.



8
9
10
# File 'app/models/renalware/ukrdc/send_patients.rb', line 8

def logger
  @logger
end

#patient_idsObject (readonly)

Returns the value of attribute patient_ids.



8
9
10
# File 'app/models/renalware/ukrdc/send_patients.rb', line 8

def patient_ids
  @patient_ids
end

#request_uuidObject (readonly)

Returns the value of attribute request_uuid.



8
9
10
# File 'app/models/renalware/ukrdc/send_patients.rb', line 8

def request_uuid
  @request_uuid
end

Instance Method Details

#callObject



17
18
19
20
21
22
23
24
# File 'app/models/renalware/ukrdc/send_patients.rb', line 17

def call
  logger.info "Request #{request_uuid}"

  ms = Benchmark.ms do
    send_patients
  end
  print_summary(ms)
end