class Dhl::Bcs::V2::Locator
finds proper class from attributes and builds object
Public Class Methods
for(attributes = {})
click to toggle source
# 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)
click to toggle source
# 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)
click to toggle source
# 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