module MITS::V3_0::Mapper::AddressMapper
Public Instance Methods
address(tag, secondary_tag = nil, entity = Address)
click to toggle source
# File lib/mits/v3.0/mapper/address_mapper.rb, line 5 def address(tag, secondary_tag = nil, entity = Address) attrs = address_attributes(tag) if secondary_tag attrs[:latitude] = try(secondary_tag[:Latitude], :to_f) attrs[:longitude] = try(secondary_tag[:Longitude], :to_f) end entity.new(attrs) end
Private Instance Methods
address_attributes(tag)
click to toggle source
# File lib/mits/v3.0/mapper/address_mapper.rb, line 18 def address_attributes(tag) { address: try(tag[:Address], :strip), city: try(tag[:City], :strip), country: try(tag[:Country], :strip), country_name: try(tag[:CountyName], :strip), description: try(tag[:Description], :strip), email: try(tag[:Email], :strip), postal_code: try(tag[:PostalCode], :strip), province: try(tag[:Province], :strip), state: try(tag[:State], :strip), type: try(tag[:AddressType], :strip), unparsed_address: try(tag[:UnparsedAddress], :strip) } end