Module: EVSS::PCIUAddress

Defined in:
lib/evss/pciu_address.rb,
lib/evss/pciu_address/address.rb,
lib/evss/pciu_address/service.rb,
lib/evss/pciu_address/configuration.rb,
lib/evss/pciu_address/states_response.rb,
lib/evss/pciu_address/address_response.rb,
lib/evss/pciu_address/domestic_address.rb,
lib/evss/pciu_address/military_address.rb,
lib/evss/pciu_address/response_strategy.rb,
lib/evss/pciu_address/countries_response.rb,
lib/evss/pciu_address/control_information.rb,
lib/evss/pciu_address/international_address.rb

Defined Under Namespace

Classes: Address, AddressResponse, Configuration, ControlInformation, CountriesResponse, DomesticAddress, InternationalAddress, MilitaryAddress, ResponseStrategy, Service, StatesResponse

Class Method Summary collapse

Class Method Details

.build_address(attrs) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/evss/pciu_address.rb', line 10

def self.build_address(attrs)
  case attrs['type']
  when Address::ADDRESS_TYPES[:domestic]
    EVSS::PCIUAddress::DomesticAddress.new(attrs)
  when Address::ADDRESS_TYPES[:international]
    EVSS::PCIUAddress::InternationalAddress.new(attrs)
  when Address::ADDRESS_TYPES[:military]
    EVSS::PCIUAddress::MilitaryAddress.new(attrs)
  else
    raise ArgumentError, "Unsupported address type: #{attrs['type']}"
  end
end