contact-data 0.0.20 → 0.1.0

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: db881d9279bf05f8e29a5061727511ea7d16b562
4
- data.tar.gz: f01b935abf8f2168eaa3d49a7faf9e4e510b2015
3
+ metadata.gz: e047c67be460d782f2b82819f4e83c9e0b4a0559
4
+ data.tar.gz: 27e01e968cd31a67276825899a8b60629cd9c1f6
5
5
  SHA512:
6
- metadata.gz: 8cca2ca481dd431965bf8fbd2f404fbd8147dbbeb8d5f453b809abe9ec31c8edf76536d086be780191818e6fcf2462c3ba4d8483a38ef13f3a13da71efb471c6
7
- data.tar.gz: 6a92b1b36a1e09bf2a28bc277a80a60209da113366795563e2b6430263e0aeec1272e6808134008c988dcbbeb07281ffb2af13dd8d7529092becd04972e04704
6
+ metadata.gz: a735e12d551c72399df8b724b7fd9223fbde49f61f88e05624b8102eb2bb7d449a9fd85fcd4d9c58fbbd9e2190bd087ece2a8b9f42b016bd9c651fa08fc93db7
7
+ data.tar.gz: ac9b74436b8e38a97a9908a54456e1c374ae8f8a397e3bfc62116d86616d8252ed2cbda49e0e876a6b7168deb54feb70da3b16d94416603442d9b0474dc74744
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- contact-data (0.0.19)
4
+ contact-data (0.0.20)
5
+ addressable (~> 2.3)
5
6
  rest-client (~> 1)
6
7
 
7
8
  GEM
data/contact-data.gemspec CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ['lib']
19
19
 
20
20
  spec.add_runtime_dependency 'rest-client', '~> 1'
21
+ spec.add_runtime_dependency 'addressable', '~> 2.3'
21
22
 
22
23
  spec.add_development_dependency 'bundler', '~> 1'
23
24
  spec.add_development_dependency 'rake', '~> 10'
@@ -3,7 +3,7 @@ module ContactData
3
3
  class Deprecated
4
4
  class << self
5
5
  def search(name)
6
- Fetcher.get("name/#{CGI.escape(name)}")
6
+ Fetcher.get("name/#{Fetcher.encode_component name}")
7
7
  end
8
8
 
9
9
  def find_contacts_in(text)
@@ -19,11 +19,15 @@ module ContactData
19
19
  end
20
20
  end
21
21
 
22
+ def encode_component(string)
23
+ Addressable::URI.encode_component(string, Addressable::URI::CharacterClasses::PATH)
24
+ end
25
+
22
26
  private
23
27
 
24
28
  def get_url_from(api_method, options = {})
25
29
  if api_method.is_a?(String)
26
- url = URI.escape("#{URL}/#{api_method}")
30
+ url = "#{URL}/#{api_method}"
27
31
  elsif options[:base]
28
32
  url = "#{URL}/#{API}/#{options[:base]}/#{api_method}"
29
33
  else
@@ -1,4 +1,4 @@
1
1
  # Gem version
2
2
  module ContactData
3
- VERSION = '0.0.20'
3
+ VERSION = '0.1.0'
4
4
  end
data/lib/contact-data.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require 'uri'
2
+ require 'addressable/uri'
3
3
  require 'json'
4
4
  require 'logger'
5
5
  require 'contact-data/contact'
@@ -11,6 +11,7 @@ describe ContactData::Deprecated do
11
11
  VCR.use_cassette('deprecated_contact_search') do
12
12
  result = ContactData::Deprecated.search(name)
13
13
  expect(result).to be_a(Hash)
14
+ expect(result[:count]).to eq(10)
14
15
  end
15
16
  end
16
17
 
@@ -29,6 +30,7 @@ describe ContactData::Deprecated do
29
30
  VCR.use_cassette('deprecated_contact_name_search') do
30
31
  result = ContactData::Deprecated.find_contacts_in(text)
31
32
  expect(result).to be_a(Hash)
33
+ expect(result[:contacts]).to eq(['lorem-ipsum', 'john-smith'])
32
34
  end
33
35
  end
34
36
  end
@@ -40,6 +42,7 @@ describe ContactData::Deprecated do
40
42
  VCR.use_cassette('deprecated_link_metadata') do
41
43
  result = ContactData::Deprecated.link_metadata(url)
42
44
  expect(result).to be_a(Hash)
45
+ expect(result[:title]).to eq('IANA — Number Resources')
43
46
  end
44
47
  end
45
48
  end
@@ -78,7 +78,7 @@ http_interactions:
78
78
  recorded_at: Thu, 12 Jun 2014 10:53:38 GMT
79
79
  - request:
80
80
  method: get
81
- uri: http://public.xenapto.com/name/XXXXX+%253F.json
81
+ uri: http://public.xenapto.com/name/XXXXXXXXXX%20%3F.json
82
82
  body:
83
83
  encoding: US-ASCII
84
84
  string: ''
@@ -95,7 +95,7 @@ http_interactions:
95
95
  message: OK
96
96
  headers:
97
97
  Date:
98
- - Wed, 13 Aug 2014 16:33:29 GMT
98
+ - Thu, 14 Aug 2014 11:01:50 GMT
99
99
  Status:
100
100
  - 200 OK
101
101
  Connection:
@@ -107,108 +107,18 @@ http_interactions:
107
107
  X-Ua-Compatible:
108
108
  - IE=Edge,chrome=1
109
109
  Etag:
110
- - '"50cd64a593ffbd41a6f90d88fafde183"'
110
+ - '"dfc3ae65d751e2a767eeafc22ea049a1"'
111
111
  Cache-Control:
112
112
  - max-age=0, private, must-revalidate
113
113
  X-Request-Id:
114
- - 296e310ed791fbad627564e461951566
114
+ - 715767cc28016598d996a86e9dc15446
115
115
  X-Runtime:
116
- - '0.032884'
116
+ - '0.025084'
117
117
  X-Rack-Cache:
118
118
  - miss
119
119
  body:
120
120
  encoding: UTF-8
121
- string: '{"contacts":[],"name":"Not found","slug":"xxxxx-plus","count":0,"version":"v1"}'
121
+ string: '{"contacts":[],"name":"Not found","slug":"xxxxxxxxxx","count":0,"version":"v1"}'
122
122
  http_version:
123
- recorded_at: Wed, 13 Aug 2014 16:33:29 GMT
124
- - request:
125
- method: get
126
- uri: http://public.xenapto.com/name/XXXXXXXXXX+%253F.json
127
- body:
128
- encoding: US-ASCII
129
- string: ''
130
- headers:
131
- Accept:
132
- - "*/*; q=0.5, application/xml"
133
- Accept-Encoding:
134
- - gzip, deflate
135
- User-Agent:
136
- - Ruby
137
- response:
138
- status:
139
- code: 200
140
- message: OK
141
- headers:
142
- Date:
143
- - Wed, 13 Aug 2014 16:35:55 GMT
144
- Status:
145
- - 200 OK
146
- Connection:
147
- - close
148
- Content-Type:
149
- - application/json; charset=utf-8
150
- Content-Length:
151
- - '84'
152
- X-Ua-Compatible:
153
- - IE=Edge,chrome=1
154
- Etag:
155
- - '"253398129d504e94f0911f40498f71b1"'
156
- Cache-Control:
157
- - max-age=0, private, must-revalidate
158
- X-Request-Id:
159
- - 7df57910c30b2c48aba43d05f6288798
160
- X-Runtime:
161
- - '0.044715'
162
- X-Rack-Cache:
163
- - miss
164
- body:
165
- encoding: UTF-8
166
- string: '{"contacts":[],"name":"Not found","slug":"xxxxxxxxxx-plus","count":0,"version":"v1"}'
167
- http_version:
168
- recorded_at: Wed, 13 Aug 2014 16:35:55 GMT
169
- - request:
170
- method: get
171
- uri: http://public.xenapto.com/name/Derek+Jones+III.json
172
- body:
173
- encoding: US-ASCII
174
- string: ''
175
- headers:
176
- Accept:
177
- - "*/*; q=0.5, application/xml"
178
- Accept-Encoding:
179
- - gzip, deflate
180
- User-Agent:
181
- - Ruby
182
- response:
183
- status:
184
- code: 200
185
- message: OK
186
- headers:
187
- Date:
188
- - Wed, 13 Aug 2014 16:35:55 GMT
189
- Status:
190
- - 200 OK
191
- Connection:
192
- - close
193
- Content-Type:
194
- - application/json; charset=utf-8
195
- Content-Length:
196
- - '94'
197
- X-Ua-Compatible:
198
- - IE=Edge,chrome=1
199
- Etag:
200
- - '"5e7d9fa614dc656a150e4fdca993850e"'
201
- Cache-Control:
202
- - max-age=0, private, must-revalidate
203
- X-Request-Id:
204
- - 4569407b925ec6da38345e3e4eac86cb
205
- X-Runtime:
206
- - '0.058324'
207
- X-Rack-Cache:
208
- - miss
209
- body:
210
- encoding: UTF-8
211
- string: '{"contacts":[],"name":"Not found","slug":"derek-plus-jones-plus-iii","count":0,"version":"v1"}'
212
- http_version:
213
- recorded_at: Wed, 13 Aug 2014 16:35:55 GMT
123
+ recorded_at: Thu, 14 Aug 2014 11:01:50 GMT
214
124
  recorded_with: VCR 2.9.2
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: http://public.xenapto.com/link/http%253A%252F%252Fwww.iana.org%252Fnumbers
5
+ uri: http://public.xenapto.com/link/http:%2F%2Fwww.iana.org%2Fnumbers
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -19,7 +19,7 @@ http_interactions:
19
19
  message: OK
20
20
  headers:
21
21
  Date:
22
- - Thu, 12 Jun 2014 10:59:29 GMT
22
+ - Thu, 14 Aug 2014 11:01:50 GMT
23
23
  Status:
24
24
  - 200 OK
25
25
  Connection:
@@ -27,23 +27,23 @@ http_interactions:
27
27
  Content-Type:
28
28
  - application/json; charset=utf-8
29
29
  Content-Length:
30
- - '304'
30
+ - '324'
31
31
  X-Ua-Compatible:
32
32
  - IE=Edge,chrome=1
33
33
  Etag:
34
- - '"1f393c600ab5ec1775f8dd15075384a5"'
34
+ - '"7dfe4d9eed07ad2ec06fffb55895e93b"'
35
35
  Cache-Control:
36
36
  - max-age=0, private, must-revalidate
37
37
  X-Request-Id:
38
- - a40aa477aa382d214fa9e0b0ccc5c459
38
+ - ae3abdfd5f8349271ed68511dea34866
39
39
  X-Runtime:
40
- - '0.111311'
40
+ - '0.493192'
41
41
  X-Rack-Cache:
42
42
  - miss
43
43
  body:
44
44
  encoding: UTF-8
45
- string: '{"id":1703498,"source":"API","source_contact_id":0,"url":"http%3a%2f%2fwww.iana.org/numbers","domain":"iana.org","title":null,"news_source":"Internet
46
- Assigned Numbers Authority","summary":null,"created_at":"2014-06-08T10:24:59Z","updated_at":"2014-06-08T10:24:59Z","publication_date":null,"version":"v1"}'
45
+ string: '{"id":2642376,"source":"API","source_contact_id":0,"url":"http://www.iana.org/numbers","domain":"iana.org","title":"IANA
46
+ \u2014 Number Resources","news_source":"Internet Assigned Numbers Authority","summary":null,"created_at":"2014-08-14T11:01:50Z","updated_at":"2014-08-14T11:01:50Z","publication_date":null,"version":"v1"}'
47
47
  http_version:
48
- recorded_at: Thu, 12 Jun 2014 10:59:29 GMT
48
+ recorded_at: Thu, 14 Aug 2014 11:01:50 GMT
49
49
  recorded_with: VCR 2.9.2
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contact-data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xenapto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-13 00:00:00.000000000 Z
11
+ date: 2014-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: addressable
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.3'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement