Class: Roqua::Healthy::A19::AddressParser
- Inherits:
-
Object
- Object
- Roqua::Healthy::A19::AddressParser
- Defined in:
- lib/roqua/healthy/a19/address_parser.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
- #address_type ⇒ Object
- #city ⇒ Object
- #country ⇒ Object
-
#initialize(message) ⇒ AddressParser
constructor
A new instance of AddressParser.
- #record ⇒ Object
- #street ⇒ Object
- #zipcode ⇒ Object
Constructor Details
#initialize(message) ⇒ AddressParser
Returns a new instance of AddressParser.
8 9 10 |
# File 'lib/roqua/healthy/a19/address_parser.rb', line 8 def initialize() @message = end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
6 7 8 |
# File 'lib/roqua/healthy/a19/address_parser.rb', line 6 def @message end |
Instance Method Details
#address_type ⇒ Object
12 13 14 15 |
# File 'lib/roqua/healthy/a19/address_parser.rb', line 12 def address_type return nil unless record record.fetch('PID.11.7') end |
#city ⇒ Object
30 31 32 33 |
# File 'lib/roqua/healthy/a19/address_parser.rb', line 30 def city return nil unless record record.fetch('PID.11.3') end |
#country ⇒ Object
40 41 42 43 |
# File 'lib/roqua/healthy/a19/address_parser.rb', line 40 def country return nil unless record record.fetch('PID.11.6') end |
#record ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/roqua/healthy/a19/address_parser.rb', line 45 def record # PID.11.7 address types: # M: Mailing # P: Permanent # H: Home # L: Legal address @record ||= get_address_of_type(, 'M') || get_address_of_type(, 'P') || get_address_of_type(, 'H') || get_address_of_type(, 'L') end |
#street ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/roqua/healthy/a19/address_parser.rb', line 17 def street return nil if record.blank? || record.fetch('PID.11.1').blank? street = record.fetch('PID.11.1').fetch('PID.11.1.1') suffix = record.fetch('PID.11.2', nil) if suffix.present? && !street.end_with?(suffix) street + suffix else street end end |
#zipcode ⇒ Object
35 36 37 38 |
# File 'lib/roqua/healthy/a19/address_parser.rb', line 35 def zipcode return nil unless record record.fetch('PID.11.5') end |