Class: Renalware::HD::SessionFactory

Inherits:
Object
  • Object
show all
Defined in:
app/models/renalware/hd/session_factory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(patient:, user:, type: nil) ⇒ SessionFactory

The optional :type argument has been passed into the controller as a query string parameter. The only valid values are nil or “dna”. If “dna”, it is signifies we should build a Session::DNA object. Otherwise we always build a Session::Open.



13
14
15
16
17
# File 'app/models/renalware/hd/session_factory.rb', line 13

def initialize(patient:, user:, type: nil)
  @patient = patient
  @user = user
  @type = type
end

Instance Attribute Details

#patientObject (readonly)

Returns the value of attribute patient.



8
9
10
# File 'app/models/renalware/hd/session_factory.rb', line 8

def patient
  @patient
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'app/models/renalware/hd/session_factory.rb', line 8

def type
  @type
end

#userObject (readonly)

Returns the value of attribute user.



8
9
10
# File 'app/models/renalware/hd/session_factory.rb', line 8

def user
  @user
end

Instance Method Details

#buildObject



19
20
21
22
23
24
25
# File 'app/models/renalware/hd/session_factory.rb', line 19

def build
  session = build_session
  apply_profile(session)
  set_default_access(session)
  build_prescription_administrations(session)
  session
end