melissa_data 0.2.12 → 0.2.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f7348ac6f38585a500a3b5c8d6bcf9ba5d3becb
4
- data.tar.gz: e317fd80c04e14cb4abea0e6229ae29f4249de62
3
+ metadata.gz: 9396713cb4f41daf6d74fd6ad64bbb080156eb20
4
+ data.tar.gz: a38a780b35cf7badece913b9ccce0ab72dda97f5
5
5
  SHA512:
6
- metadata.gz: 13c7ccb7dd0283dce508fe42feff767463c5fc628b86b82f1451419f60fe5dbdca09f80f8164dda33ffca3969a27eeeabfd0ca9fae083a4d1d4c60e5716fa1dd
7
- data.tar.gz: 58e12f498d6461640672f9eec7cf71011e290120bfd07afca1b85c9921670abdba59f0034a85ff4ceb0cffa8147de857cd04c8e4f4c66d8aebc9efd71b389e19
6
+ metadata.gz: 84c3a718b4bad198c785667ccc9e09891e8f0c5646513b3b247f20bf7fd9b1e65b4685bf736a7c8e772ef4931091987674c5db45b49410afe67c04ebc699c08e
7
+ data.tar.gz: b0b50944871289d9e146fda85fd8026386f862f4128554be6c7e24ced3e4d75f44bf669aa09dee6335446c60439ae715e5d50e4e5eadccffc3894fb34c67a687
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ melissa_data
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.3.3
@@ -1,3 +1,3 @@
1
1
  module MelissaData
2
- VERSION = "0.2.12"
2
+ VERSION = "0.2.13"
3
3
  end
@@ -9,15 +9,23 @@ module MelissaData
9
9
  end
10
10
 
11
11
  def property_by_apn(fips:, apn:)
12
- res = process(@client.property_by_apn(fips: fips, apn: apn), 'property')
13
- add_coordinates(res) unless MelissaData::GeoLookup::Geocoder.coordinates? res
14
- res
12
+ @response = process(@client.property_by_apn(fips: fips, apn: apn), 'property')
13
+ resolve_response
15
14
  end
16
15
 
17
16
  def property_by_address_key(address_key:)
18
- res = process(@client.property_by_address_key(address_key: address_key), 'property')
19
- add_coordinates(res) unless MelissaData::GeoLookup::Geocoder.coordinates? res
20
- res
17
+ @response = process(@client.property_by_address_key(address_key: address_key), 'property')
18
+ resolve_response
19
+ end
20
+
21
+ def success?
22
+ !@response.key?(:errors)
23
+ end
24
+
25
+ def resolve_response
26
+ return @response unless success?
27
+ add_coordinates(@response) unless MelissaData::GeoLookup::Geocoder.coordinates? @response
28
+ @response
21
29
  end
22
30
 
23
31
  def address(address:, city:, state:, zip:, country: "USA")
@@ -30,10 +38,10 @@ module MelissaData
30
38
  end
31
39
 
32
40
  def add_coordinates(response)
33
- addr = response[:property_address][:address]
34
- city = response[:property_address][:city]
35
- state = response[:property_address][:state]
36
- zip = response[:property_address][:zip]
41
+ addr = response.dig(:property_address, :address)
42
+ city = response.dig(:property_address, :city)
43
+ state = response.dig(:property_address, :state)
44
+ zip = response.dig(:property_address, :zip)
37
45
  full_address = "#{addr}, #{city}, #{state}, #{zip}"
38
46
  MelissaData::GeoLookup::Geocoder
39
47
  .address_to_coordinates(full_address)
data/melissa_data.gemspec CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.bindir = "exe"
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
+ spec.required_ruby_version = '>= 2.3'
21
22
 
22
23
  spec.add_runtime_dependency "nokogiri"
23
24
  spec.add_runtime_dependency "rest-client"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: melissa_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.12
4
+ version: 0.2.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Grayson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-03-08 00:00:00.000000000 Z
12
+ date: 2017-05-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -133,7 +133,8 @@ extra_rdoc_files: []
133
133
  files:
134
134
  - ".gitignore"
135
135
  - ".rspec"
136
- - ".ruby_version"
136
+ - ".ruby-gemset"
137
+ - ".ruby-version"
137
138
  - ".travis.yml"
138
139
  - CHANGELOG
139
140
  - CODE_OF_CONDUCT.md
@@ -169,7 +170,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
169
170
  requirements:
170
171
  - - ">="
171
172
  - !ruby/object:Gem::Version
172
- version: '0'
173
+ version: '2.3'
173
174
  required_rubygems_version: !ruby/object:Gem::Requirement
174
175
  requirements:
175
176
  - - ">="
@@ -177,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
178
  version: '0'
178
179
  requirements: []
179
180
  rubyforge_project:
180
- rubygems_version: 2.4.5.1
181
+ rubygems_version: 2.6.12
181
182
  signing_key:
182
183
  specification_version: 4
183
184
  summary: A simple interface to Melissa Data's Web Smart Property API
data/.ruby_version DELETED
@@ -1 +0,0 @@
1
- 2.2.1