Class: EpoOps::Factories::NameAndAddressFactory
- Inherits:
-
Object
- Object
- EpoOps::Factories::NameAndAddressFactory
- Defined in:
- lib/epo_ops/factories/name_and_address_factory.rb
Overview
Parses the addressbook data from EPO Ops into an ‘NameAndAddress’ object
Instance Attribute Summary collapse
-
#address_1 ⇒ Object
readonly
Returns the value of attribute address_1.
-
#address_2 ⇒ Object
readonly
Returns the value of attribute address_2.
-
#address_3 ⇒ Object
readonly
Returns the value of attribute address_3.
-
#address_4 ⇒ Object
readonly
Returns the value of attribute address_4.
-
#address_5 ⇒ Object
readonly
Returns the value of attribute address_5.
-
#cdsid ⇒ Object
readonly
Returns the value of attribute cdsid.
-
#country_code ⇒ Object
readonly
Returns the value of attribute country_code.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#raw_data ⇒ Object
readonly
Returns the value of attribute raw_data.
Class Method Summary collapse
-
.build(raw_data) ⇒ EpoOps::NameAndAddress
NameAndAddress filled with parsed data.
Instance Method Summary collapse
-
#initialize(raw_data) ⇒ NameAndAddressFactory
constructor
A new instance of NameAndAddressFactory.
Constructor Details
#initialize(raw_data) ⇒ NameAndAddressFactory
Returns a new instance of NameAndAddressFactory.
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/epo_ops/factories/name_and_address_factory.rb', line 35 def initialize(raw_data) @raw_data = raw_data @name = raw_data['name'] if raw_data['address'].is_a? Hash @address_1 = raw_data['address']['address_1'] @address_2 = raw_data['address']['address_2'] @address_3 = raw_data['address']['address_3'] @address_4 = raw_data['address']['address_4'] @address_5 = raw_data['address']['address_5'] @country_code = raw_data['address']['country'] end @cdsid = raw_data['cdsid'] end |
Instance Attribute Details
#address_1 ⇒ Object (readonly)
Returns the value of attribute address_1.
25 26 27 |
# File 'lib/epo_ops/factories/name_and_address_factory.rb', line 25 def address_1 @address_1 end |
#address_2 ⇒ Object (readonly)
Returns the value of attribute address_2.
25 26 27 |
# File 'lib/epo_ops/factories/name_and_address_factory.rb', line 25 def address_2 @address_2 end |
#address_3 ⇒ Object (readonly)
Returns the value of attribute address_3.
25 26 27 |
# File 'lib/epo_ops/factories/name_and_address_factory.rb', line 25 def address_3 @address_3 end |
#address_4 ⇒ Object (readonly)
Returns the value of attribute address_4.
25 26 27 |
# File 'lib/epo_ops/factories/name_and_address_factory.rb', line 25 def address_4 @address_4 end |
#address_5 ⇒ Object (readonly)
Returns the value of attribute address_5.
25 26 27 |
# File 'lib/epo_ops/factories/name_and_address_factory.rb', line 25 def address_5 @address_5 end |
#cdsid ⇒ Object (readonly)
Returns the value of attribute cdsid.
25 26 27 |
# File 'lib/epo_ops/factories/name_and_address_factory.rb', line 25 def cdsid @cdsid end |
#country_code ⇒ Object (readonly)
Returns the value of attribute country_code.
25 26 27 |
# File 'lib/epo_ops/factories/name_and_address_factory.rb', line 25 def country_code @country_code end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
25 26 27 |
# File 'lib/epo_ops/factories/name_and_address_factory.rb', line 25 def name @name end |
#raw_data ⇒ Object (readonly)
Returns the value of attribute raw_data.
25 26 27 |
# File 'lib/epo_ops/factories/name_and_address_factory.rb', line 25 def raw_data @raw_data end |
Class Method Details
.build(raw_data) ⇒ EpoOps::NameAndAddress
Returns NameAndAddress filled with parsed data.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/epo_ops/factories/name_and_address_factory.rb', line 9 def build(raw_data) factory = new(raw_data) EpoOps::NameAndAddress.new( factory.name, factory.address_1, factory.address_2, factory.address_3, factory.address_4, factory.address_5, factory.country_code, factory.cdsid ) end |