Class: MiamiDadeGeo::GeoAttributeClient Private

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/miami_dade_geo/geo_attribute_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 searching geographic attributes. Used to search for municipalities by name or ‘munic_code`. 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 GeoAttribute service WSDL

"http://gisws.miamidade.gov/gisdata/GeoAttribute.asmx?wsdl"

Instance Method Summary collapse

Instance Method Details

#all_fields(table, field_name, value) ⇒ Hash

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.

Performs a search for geo-attributes.

Parameters:

  • table (String)

    the table to search

  • field_name (String)

    the field/column to search in the given table

  • value (String)

    string value to search in the given field and table

Returns:

  • (Hash)

    search results



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/miami_dade_geo/geo_attribute_client.rb', line 22

def all_fields(table, field_name, value)
  body = savon.
         call(:get_all_fields_records_given_a_field_name_and_value,
              message: {
                'strFeatureClassOrTableName' => table,
                'strFieldNameToSearchOn' => field_name,
                'strValueOfFieldToSearchOn' => value
              }).
         body

  resp = body[:get_all_fields_records_given_a_field_name_and_value_response]
  rslt = resp[:get_all_fields_records_given_a_field_name_and_value_result]
  polys = rslt[:diffgram][:document_element][:municipality_poly]

  poly = if polys.is_a? Array
           polys.first
         elsif polys.is_a? Hash
           polys
         else
           fail "Unexpected polys #{polys.class.name}, wanted Array or Hash"
         end
end

#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)


48
49
50
# File 'lib/miami_dade_geo/geo_attribute_client.rb', line 48

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