dc_address_lookup 0.1.0 → 0.1.1

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: f181d968548753a0c74c76ccd6f3faba519888a5
4
- data.tar.gz: 1f2f4fd41beb2fb6cf0a9218a1472286f1aebd4e
3
+ metadata.gz: 7a2291c014d6a5c70163931f2f2655c9a60af457
4
+ data.tar.gz: 2f5be82346f439570c86fe2324cc6cce117d4f59
5
5
  SHA512:
6
- metadata.gz: 364c0f5114556101606b9dfb862d0407b150f16a900907cdb37c63735b6b30d43fe261ad9305d4b9d9affc502f84ab0865ed3ccd62ad5a502cdeb1c88d584fcc
7
- data.tar.gz: 9120f379ebcb5c1bb4456262afa90c841ebdd75f5911963d7f7335df80b2c045c7aa605057ce1eb8c2b37830b1437e219e79ce1e7514f0ada3a752faae0d47d5
6
+ metadata.gz: dca53f7c48de5da73127fae32e76589df525412ce4dd219182c3fdd111f9bac62b01a6405883f68ae73b4f3a183b16497bdfeba2bbdcae625439dd430be68e81
7
+ data.tar.gz: 2bb1aeac22a971c8941bb5231b867eeb1f852f870ae966ad3e0644a7b0a31a492965e589484673b26ea30ee93b715e3ca511492c001a055b7d734778cb2fa180
@@ -18,9 +18,10 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "typhoeus"
22
- spec.add_dependency "nokogiri"
23
- spec.add_dependency "addressable"
21
+ spec.add_dependency "rest-client", "~> 1.8"
22
+ spec.add_dependency "rest-client-components", "~> 1.4"
23
+ spec.add_dependency "nokogiri", "~> 1.6"
24
+ spec.add_dependency "rack-cache", "~> 1.5"
24
25
 
25
26
  spec.add_development_dependency "bundler", "~> 1.10"
26
27
  spec.add_development_dependency "rake", "~> 10.0"
@@ -1,22 +1,17 @@
1
1
  require 'nokogiri'
2
- require 'typhoeus'
3
- require 'addressable/uri'
4
- require "addressable/template"
2
+ require 'rest-client'
3
+ require 'restclient/components'
4
+ require 'rack/cache'
5
+
5
6
  require "dc_address_lookup/version"
6
7
  require "dc_address_lookup/client"
7
- require "dc_address_lookup/query"
8
8
  require "dc_address_lookup/response"
9
9
  require "dc_address_lookup/location"
10
10
 
11
+ RestClient.enable Rack::Cache
12
+
11
13
  module DcAddressLookup
12
14
  ENDPOINT = "http://citizenatlas.dc.gov/newwebservices/locationverifier.asmx/findLocation"
13
- QUERY_TEMPLATE = Addressable::Template.new "#{ENDPOINT}{?query*}"
14
- TYPHOEUS_OPTIONS = {
15
- accept_encoding: "gzip",
16
- headers: {
17
- "User-Agent" => "Mozilla/5.0 (compatible; dc-address-lookup/#{DcAddressLookup::VERSION}; +https://github.com/benbalter/dc-address-lookup)"
18
- }
19
- }
20
15
 
21
16
  def self.lookup(address)
22
17
  Client.new.lookup(address)
@@ -1,7 +1,8 @@
1
1
  module DcAddressLookup
2
2
  class Client
3
3
  def lookup(query)
4
- Query.new(query).response.location
4
+ response = RestClient.get DcAddressLookup::ENDPOINT, { params: { str: query } }
5
+ Response.new(response).location
5
6
  end
6
7
  end
7
8
  end
@@ -1,3 +1,3 @@
1
1
  module DcAddressLookup
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,57 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dc_address_lookup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-14 00:00:00.000000000 Z
11
+ date: 2015-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: typhoeus
14
+ name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1.8'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '1.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rest-client-components
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.4'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.4'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: nokogiri
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - ">="
45
+ - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '0'
47
+ version: '1.6'
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - ">="
52
+ - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '0'
54
+ version: '1.6'
41
55
  - !ruby/object:Gem::Dependency
42
- name: addressable
56
+ name: rack-cache
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - ">="
59
+ - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '0'
61
+ version: '1.5'
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - ">="
66
+ - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '0'
68
+ version: '1.5'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -126,7 +140,6 @@ files:
126
140
  - lib/dc_address_lookup.rb
127
141
  - lib/dc_address_lookup/client.rb
128
142
  - lib/dc_address_lookup/location.rb
129
- - lib/dc_address_lookup/query.rb
130
143
  - lib/dc_address_lookup/response.rb
131
144
  - lib/dc_address_lookup/version.rb
132
145
  - script/console
@@ -1,27 +0,0 @@
1
- module DcAddressLookup
2
- class HttpError < StandardError; end
3
-
4
- class Query
5
-
6
- attr_reader :query
7
-
8
- def initialize(query)
9
- @query = query
10
- end
11
-
12
- def response
13
- raise HttpError unless raw_response.success?
14
- @response ||= Response.new(raw_response.body)
15
- end
16
-
17
- private
18
-
19
- def uri
20
- DcAddressLookup::QUERY_TEMPLATE.expand query: { str: query }
21
- end
22
-
23
- def raw_response
24
- @raw_response ||= Typhoeus.get uri, TYPHOEUS_OPTIONS
25
- end
26
- end
27
- end