Class: MiamiDadeGeo::AddrXyClient Private

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/miami_dade_geo/addr_xy_client.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Singleton SOAP client for converting an address to NAD 83 x-y coordinates. Makes one SOAP request for WSDL on first instantiation.

Constant Summary collapse

WSDL_URL =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

URL to AddrXy service WSDL

"http://gisws.miamidade.gov/gisaddress/addrxy.asmx?wsdl"

Instance Method Summary collapse

Instance Method Details

#savonSavon::Client

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a Savon SOAP client instance

Returns:

  • (Savon::Client)


30
31
32
# File 'lib/miami_dade_geo/addr_xy_client.rb', line 30

def savon
  @savon ||= Savon.client(wsdl: WSDL_URL)
end

#xy_for_address(address) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/miami_dade_geo/addr_xy_client.rb', line 15

def xy_for_address(address)
  body = savon.
         call(:xy_address, message: { myAddress: address}).
         body

  if body[:xy_address_response][:xy_address_result][:count] == '0'
    raise MiamiDadeGeo::InvalidAddressError
  end

  body[:xy_address_response][:xy_address_result][:xy][:arr_xy]
end