Class: AQI::ProcedureLocation

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ProcedureLocation

Returns a new instance of ProcedureLocation.



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

def initialize(options)
  self.type    = validate_type_code(options[:type])
  self.details = options[:details]
end

Instance Attribute Details

#detailsObject

Returns the value of attribute details.



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

def details
  @details
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

Class Method Details

.typesObject



5
6
7
8
9
10
11
# File 'lib/aqi/procedure_location.rb', line 5

def self.types
  ["In-Patient", "Post In-Patient", "Out-Patient", "Post Out-Patient", "Obstetrics", "Surgery Center",
    "Surgery Center Post Out-Patient", "Office", "Home", "Ambulatory Surgical Center", "Pharmacy",
    "Skilled Nursing Facility", "Ambulance - Land", "Emergency Room Hospital", "Urgent Care Facility",
    "Inpatient Psychiatric Facility", "School", "Custodial Care Facility",
    "Residential Substance Abuse Treatment Facility", "Military Treatment Facility", "OTHER", "UNKNOWN"]
end

Instance Method Details

#to_xmlObject



26
27
28
29
30
31
32
# File 'lib/aqi/procedure_location.rb', line 26

def to_xml
  builder = Builder::XmlMarkup.new
  builder.ProcedureLocation do |pl|
    pl.LocationType(type)
    pl.LocationDetails(details)
  end
end

#validate_type_code(code) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/aqi/procedure_location.rb', line 18

def validate_type_code(code)
  if self.class.types.include?(code)
    code
  else
    'UNKNOWN'
  end
end