Class: AQI::AnesthesiaRecords

Inherits:
Object
  • Object
show all
Defined in:
lib/aqi/anesthesia_records.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ AnesthesiaRecords

Returns a new instance of AnesthesiaRecords.



5
6
7
8
# File 'lib/aqi/anesthesia_records.rb', line 5

def initialize(options = {})
  self.encounters = options.delete(:encounters)
  self.practice_id = options.delete(:practice_id)
end

Instance Attribute Details

#encountersObject

Returns the value of attribute encounters.



3
4
5
# File 'lib/aqi/anesthesia_records.rb', line 3

def encounters
  @encounters
end

#practice_idObject

Returns the value of attribute practice_id.



3
4
5
# File 'lib/aqi/anesthesia_records.rb', line 3

def practice_id
  @practice_id
end

Instance Method Details

#anesthesia_recordsObject



14
15
16
# File 'lib/aqi/anesthesia_records.rb', line 14

def anesthesia_records
  encounters.collect{|e| AnesthesiaRecord.new(e)}
end

#record_headerObject



10
11
12
# File 'lib/aqi/anesthesia_records.rb', line 10

def record_header
  RecordHeader.new(practice_id).to_xml
end

#to_xmlObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/aqi/anesthesia_records.rb', line 18

def to_xml
  builder = Builder::XmlMarkup.new
  builder.instruct!
  builder.AnesthesiaRecords do |ars|
    ars << record_header

    anesthesia_records.each do |anes_record|
      ars << anes_record.to_xml
    end
  end
end