contact-data 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/contact-data/link.rb +15 -2
- data/lib/contact-data/version.rb +1 -1
- data/spec/contact-data_link_spec.rb +16 -0
- data/spec/support/cassettes/links_info_search.yml +49 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c36b492ae663e188b2b761af1716c716b6c118b0
|
4
|
+
data.tar.gz: cc0469ace681b08d32e4d1cc3e2ef5fc89fd518e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9503ca0875dc3403bd1e7a6af3d3118ecf9811f0e00c73700b4c1ad9c22eb33c78adbb71d7db89b832a1630530cf0988ec32379a19c3214138baafcd0865a751
|
7
|
+
data.tar.gz: 0e0421f1afcc35dafafd8c2d3b8fa562664d6cf832ee93fab9f6e9e5ba3744f0a43ee1ced46e6e5a5ee47cd961f301245f72c2d83ac8d0f6ea40647bf9f39df8
|
data/Gemfile.lock
CHANGED
data/lib/contact-data/link.rb
CHANGED
@@ -5,12 +5,25 @@ module ContactData
|
|
5
5
|
|
6
6
|
class << self
|
7
7
|
def latest(params = {})
|
8
|
+
Fetcher.get :latest, options_from(params)
|
9
|
+
end
|
10
|
+
|
11
|
+
def info(params = {})
|
12
|
+
Fetcher.get :info, options_from(params)
|
13
|
+
end
|
14
|
+
|
15
|
+
def search(params = {})
|
16
|
+
Fetcher.get :search, options_from(params)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def options_from(params = {})
|
8
22
|
options = { base: BASE }
|
9
23
|
|
10
24
|
options[:verbose] = params.delete(:verbose) if params.key? :verbose
|
11
25
|
options[:params] = params unless params.empty?
|
12
|
-
|
13
|
-
Fetcher.get(:latest, options)
|
26
|
+
options
|
14
27
|
end
|
15
28
|
end
|
16
29
|
end
|
data/lib/contact-data/version.rb
CHANGED
@@ -3,10 +3,26 @@ require 'spec_helper'
|
|
3
3
|
require 'contact-data'
|
4
4
|
|
5
5
|
describe ContactData::Link do
|
6
|
+
let(:url) { 'http://iana.org' }
|
7
|
+
|
6
8
|
it 'gets latest links with related slug' do
|
7
9
|
VCR.use_cassette('links_latest') do
|
8
10
|
result = ContactData::Link.latest verbose: true
|
9
11
|
expect(result).to be_an(Array)
|
10
12
|
end
|
11
13
|
end
|
14
|
+
|
15
|
+
it 'gets metadata about a url' do
|
16
|
+
VCR.use_cassette('links_info_search') do
|
17
|
+
result = ContactData::Link.info url: url, verbose: true
|
18
|
+
expect(result).to be_a(Hash)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'gets metadata & contact from a url' do
|
23
|
+
VCR.use_cassette('links_info_search') do
|
24
|
+
result = ContactData::Link.info url: url, verbose: true
|
25
|
+
expect(result).to be_a(Hash)
|
26
|
+
end
|
27
|
+
end
|
12
28
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://public.xenapto.com/api/v2/links/info.json?url=http://iana.org
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*; q=0.5, application/xml"
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Date:
|
22
|
+
- Thu, 19 Jun 2014 12:06:08 GMT
|
23
|
+
Status:
|
24
|
+
- 200 OK
|
25
|
+
Connection:
|
26
|
+
- close
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Content-Length:
|
30
|
+
- '173'
|
31
|
+
X-Ua-Compatible:
|
32
|
+
- IE=Edge,chrome=1
|
33
|
+
Etag:
|
34
|
+
- '"2707cf5ee98546925da299413db23e80"'
|
35
|
+
Cache-Control:
|
36
|
+
- max-age=0, private, must-revalidate
|
37
|
+
X-Request-Id:
|
38
|
+
- 6d6c131fdadd35379e43054289e29558
|
39
|
+
X-Runtime:
|
40
|
+
- '0.019251'
|
41
|
+
X-Rack-Cache:
|
42
|
+
- miss
|
43
|
+
body:
|
44
|
+
encoding: UTF-8
|
45
|
+
string: '{"url":"http://iana.org","domain":"iana.org","title":"Internet Assigned
|
46
|
+
Numbers Authority","news_source":"Internet Assigned Numbers Authority","summary":null,"version":"v2"}'
|
47
|
+
http_version:
|
48
|
+
recorded_at: Thu, 19 Jun 2014 12:06:08 GMT
|
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.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xenapto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -173,6 +173,7 @@ files:
|
|
173
173
|
- spec/support/cassettes/deprecated_contact_name_search.yml
|
174
174
|
- spec/support/cassettes/deprecated_contact_search.yml
|
175
175
|
- spec/support/cassettes/deprecated_link_metadata.yml
|
176
|
+
- spec/support/cassettes/links_info_search.yml
|
176
177
|
- spec/support/cassettes/links_latest.yml
|
177
178
|
- spec/support/cassettes/name_search.yml
|
178
179
|
- spec/support/vcr_setup.rb
|
@@ -208,6 +209,7 @@ test_files:
|
|
208
209
|
- spec/support/cassettes/deprecated_contact_name_search.yml
|
209
210
|
- spec/support/cassettes/deprecated_contact_search.yml
|
210
211
|
- spec/support/cassettes/deprecated_link_metadata.yml
|
212
|
+
- spec/support/cassettes/links_info_search.yml
|
211
213
|
- spec/support/cassettes/links_latest.yml
|
212
214
|
- spec/support/cassettes/name_search.yml
|
213
215
|
- spec/support/vcr_setup.rb
|