Class: Dhl::Bcs::V2::Locator
- Inherits:
-
Object
- Object
- Dhl::Bcs::V2::Locator
- Defined in:
- lib/dhl/bcs/v2/locator.rb
Overview
finds proper class from attributes and builds object
Class Method Summary collapse
- .for(attributes = {}) ⇒ Object
- .location_builder(attributes = {}, location_class: Address) ⇒ Object
- .location_class_finder(attributes) ⇒ Object
Class Method Details
.for(attributes = {}) ⇒ Object
5 6 7 8 |
# File 'lib/dhl/bcs/v2/locator.rb', line 5 def self.for(attributes = {}) location_class = location_class_finder(attributes) location_builder(attributes, location_class: location_class) end |
.location_builder(attributes = {}, location_class: Address) ⇒ Object
22 23 24 |
# File 'lib/dhl/bcs/v2/locator.rb', line 22 def self.location_builder(attributes = {}, location_class: Address) location_class.build(attributes) end |
.location_class_finder(attributes) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/dhl/bcs/v2/locator.rb', line 10 def self.location_class_finder(attributes) if attributes.key?(:packstation_number) Packstation elsif attributes.key?(:postfilial_number) Postfiliale elsif attributes.key?(:parcel_shop_number) ParcelShop else Address end end |