miami_dade_geo 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 35f9933574eeb9f7163ed1c107c53da3fc116da8
4
- data.tar.gz: 0bf8e191958d06929163a30f80b3e8268d997b73
3
+ metadata.gz: 210a82e58eb4f992fa654034a01607526b98802a
4
+ data.tar.gz: 10d42cedd1ca2c88dd62fe9d6d5ba8842a487519
5
5
  SHA512:
6
- metadata.gz: 0045aef7a298c51c5ace220ddfbad3fd27a6f3ae462562b220cc4452cada9f5b61c2e6b665e218dbf027f3e12f5070cd5d8c5c3b0e151bf4f4f9cb51c81ae624
7
- data.tar.gz: c0ee7540fd3626cf8c36483a0b4358479fbd02696faaa4f68c3e51eb2c67897b67f37e18de2f99052454ab2a14ba85d7ef32d3e7a7ec5c5a777d3f2fdfb3997e
6
+ metadata.gz: 389e3de1c57bab9936f87708e8c40b96cce18d71620d492f01b1df1b87907a96645f5e32550e528a6e6f9984dcbcb2a54db2c630ced36cdb50d36047696ad1c7
7
+ data.tar.gz: 829b850d956e8a7b3dac2ca62bf71f63470a3b48842a4a2bb0cfd4a39147d062bed4e5acc1f1303e51f3c133df9e8164ac5849d3deb58492cc0fe7bff3697cd8
@@ -1,6 +1,7 @@
1
1
  require 'miami_dade_geo/addr_xy_client'
2
2
  require 'miami_dade_geo/latlong_client'
3
3
  require 'miami_dade_geo/municipality'
4
+ require 'miami_dade_geo/errors/invalid_address_error'
4
5
 
5
6
  module MiamiDadeGeo
6
7
  class Address
@@ -39,6 +40,7 @@ module MiamiDadeGeo
39
40
  end
40
41
 
41
42
  private
43
+
42
44
  def latlong
43
45
  return @latlong if defined? @latlong
44
46
  body = latlong_client.
@@ -51,8 +53,8 @@ module MiamiDadeGeo
51
53
  double = result[:double]
52
54
 
53
55
  @latlong = {
54
- lat: double[0].to_f,
55
- long: double[1].to_f
56
+ long: double[0].to_f,
57
+ lat: double[1].to_f
56
58
  }
57
59
  end
58
60
 
@@ -63,6 +65,10 @@ module MiamiDadeGeo
63
65
  call(:xy_address, message: { myAddress: address}).
64
66
  body
65
67
 
68
+ if body[:xy_address_response][:xy_address_result][:count] == '0'
69
+ raise MiamiDadeGeo::InvalidAddressError
70
+ end
71
+
66
72
  @xy_addr = body[:xy_address_response][:xy_address_result][:xy][:arr_xy]
67
73
  end
68
74
 
@@ -0,0 +1,4 @@
1
+ module MiamiDadeGeo
2
+ class Error < StandardError
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ require 'miami_dade_geo/errors/base'
2
+
3
+ module MiamiDadeGeo
4
+ class InvalidAddressError < Error
5
+ end
6
+ end
@@ -1,5 +1,6 @@
1
1
  require 'miami_dade_geo/geo_attribute_client'
2
2
  require 'miami_dade_geo/get_closest_feature_client'
3
+ require 'miami_dade_geo/latlong_client'
3
4
 
4
5
  module MiamiDadeGeo
5
6
  class Municipality
@@ -44,6 +45,20 @@ module MiamiDadeGeo
44
45
  new poly
45
46
  end
46
47
 
48
+ def self.new_with_latlong(latlong_hash)
49
+ body = LatlongClient.instance.savon.
50
+ call(:get_x_yfrom_lat_long_dec,
51
+ message: { 'LNG' => latlong_hash[:long].to_f,
52
+ 'LAT' => latlong_hash[:lat].to_f} ).
53
+ body
54
+
55
+ resp = body[:get_x_yfrom_lat_long_dec_response]
56
+ result = resp[:get_x_yfrom_lat_long_dec_result]
57
+ double = result[:double]
58
+
59
+ new_with_xy(x: double[0], y: double[1])
60
+ end
61
+
47
62
  private
48
63
 
49
64
  def initialize(poly)
@@ -1,3 +1,3 @@
1
1
  module MiamiDadeGeo
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miami_dade_geo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryce Kerley
@@ -131,6 +131,8 @@ files:
131
131
  - lib/miami_dade_geo.rb
132
132
  - lib/miami_dade_geo/addr_xy_client.rb
133
133
  - lib/miami_dade_geo/address.rb
134
+ - lib/miami_dade_geo/errors/base.rb
135
+ - lib/miami_dade_geo/errors/invalid_address_error.rb
134
136
  - lib/miami_dade_geo/geo_attribute_client.rb
135
137
  - lib/miami_dade_geo/get_closest_feature_client.rb
136
138
  - lib/miami_dade_geo/latlong_client.rb