Class: MiamiDadeGeo::GeoAttributeClient

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

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#all_fields(table, field_name, value) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/miami_dade_geo/geo_attribute_client.rb', line 10

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

#savonObject



33
34
35
# File 'lib/miami_dade_geo/geo_attribute_client.rb', line 33

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