Class: AQI::ICEvent
- Inherits:
-
Object
- Object
- AQI::ICEvent
- Defined in:
- lib/aqi/ic_event.rb
Instance Attribute Summary collapse
-
#category ⇒ Object
Returns the value of attribute category.
-
#description ⇒ Object
Returns the value of attribute description.
-
#event_time_date ⇒ Object
Returns the value of attribute event_time_date.
-
#name ⇒ Object
Returns the value of attribute name.
-
#notes ⇒ Object
Returns the value of attribute notes.
-
#severity ⇒ Object
Returns the value of attribute severity.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options) ⇒ ICEvent
constructor
A new instance of ICEvent.
- #to_xml ⇒ Object
- #validate_category(value) ⇒ Object
Constructor Details
#initialize(options) ⇒ ICEvent
Returns a new instance of ICEvent.
10 11 12 13 14 15 16 17 18 |
# File 'lib/aqi/ic_event.rb', line 10 def initialize() self.event_time_date = .delete(:event_time_date) self.category = .delete(:category) self.severity = .delete(:severity) self.name = .delete(:name) self.description = .delete(:description) self.value = .delete(:value) self.notes = .delete(:notes) end |
Instance Attribute Details
#category ⇒ Object
Returns the value of attribute category.
3 4 5 |
# File 'lib/aqi/ic_event.rb', line 3 def category @category end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/aqi/ic_event.rb', line 3 def description @description end |
#event_time_date ⇒ Object
Returns the value of attribute event_time_date.
3 4 5 |
# File 'lib/aqi/ic_event.rb', line 3 def event_time_date @event_time_date end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/aqi/ic_event.rb', line 3 def name @name end |
#notes ⇒ Object
Returns the value of attribute notes.
3 4 5 |
# File 'lib/aqi/ic_event.rb', line 3 def notes @notes end |
#severity ⇒ Object
Returns the value of attribute severity.
3 4 5 |
# File 'lib/aqi/ic_event.rb', line 3 def severity @severity end |
#value ⇒ Object
Returns the value of attribute value.
3 4 5 |
# File 'lib/aqi/ic_event.rb', line 3 def value @value end |
Class Method Details
.categories ⇒ Object
5 6 7 8 |
# File 'lib/aqi/ic_event.rb', line 5 def self.categories ["MEDICAL DEVICE/EQUIPMENT","MEDICATION", "INFRASTRUCTURE/SYSTEM", "ASSESSMENT/DOCUMENTATION", "RESPIRATORY/AIRWAY", "CARDIOVASCULAR", "PROCEDURE RELATED", "OTHER", "UNKNOWN" ] end |
Instance Method Details
#to_xml ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/aqi/ic_event.rb', line 24 def to_xml builder = Builder::XmlMarkup.new builder.ICEvent do |ice| ice.ICEventTimeDate(event_time_date.strftime('%FT%T')) if event_time_date ice.ICCategory(validate_category(category)) ice.ICSeverity(severity) ice.ICName(name) ice.ICDesciption(description) ice.ICValue(value) ice.ICNotes(notes) end end |
#validate_category(value) ⇒ Object
20 21 22 |
# File 'lib/aqi/ic_event.rb', line 20 def validate_category(value) self.class.categories.include?(value) ? value : "UNKNOWN" end |