contact-data 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +10 -10
- data/contact-data.gemspec +1 -1
- data/lib/contact-data/contact.rb +3 -0
- data/lib/contact-data/exception.rb +9 -0
- data/lib/contact-data/version.rb +1 -1
- data/spec/contact-data_contact_spec.rb +4 -1
- data/spec/fetcher_spec.rb +18 -0
- data/spec/support/cassettes/name_search.yml +28 -38
- data/spec/support/vcr_setup.rb +1 -1
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64b030ebd50147457d027469443614dee8f0b61d
|
4
|
+
data.tar.gz: b5be157f0fdde8b6d1897b38683996008132e400
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73495ac9ccae0a573c42a70fb4345adc918b5c907246627152d9f15037b6e228dab6670d0f7a7b5d95de7ab434a6878b3a9af62d7374cc9b117100d7717b66fc
|
7
|
+
data.tar.gz: 37c9ceb5f36e55b9b15dfe1baa1cc9a66ad57593c34b3ccd0c6e501af8d0db692365f514eec472c9775ed60283ed56c46d2149ef5f1badf0be9dd26bbd36d9b2
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
contact-data (0.2.
|
4
|
+
contact-data (0.2.1)
|
5
5
|
addressable (~> 2.3)
|
6
6
|
rest-client (~> 1)
|
7
7
|
|
@@ -14,7 +14,7 @@ GEM
|
|
14
14
|
debugger-linecache (~> 1.2)
|
15
15
|
slop (~> 3.6)
|
16
16
|
columnize (0.8.9)
|
17
|
-
coveralls (0.7.
|
17
|
+
coveralls (0.7.1)
|
18
18
|
multi_json (~> 1.3)
|
19
19
|
rest-client
|
20
20
|
simplecov (>= 0.7)
|
@@ -37,23 +37,23 @@ GEM
|
|
37
37
|
rspec-core (~> 2.99.0)
|
38
38
|
rspec-expectations (~> 2.99.0)
|
39
39
|
rspec-mocks (~> 2.99.0)
|
40
|
-
rspec-core (2.99.
|
40
|
+
rspec-core (2.99.2)
|
41
41
|
rspec-expectations (2.99.2)
|
42
42
|
diff-lcs (>= 1.1.3, < 2.0)
|
43
43
|
rspec-mocks (2.99.2)
|
44
|
-
safe_yaml (1.0.
|
45
|
-
simplecov (0.9.
|
44
|
+
safe_yaml (1.0.4)
|
45
|
+
simplecov (0.9.1)
|
46
46
|
docile (~> 1.1.0)
|
47
|
-
multi_json
|
47
|
+
multi_json (~> 1.0)
|
48
48
|
simplecov-html (~> 0.8.0)
|
49
49
|
simplecov-html (0.8.0)
|
50
50
|
slop (3.6.0)
|
51
51
|
term-ansicolor (1.3.0)
|
52
52
|
tins (~> 1.0)
|
53
53
|
thor (0.19.1)
|
54
|
-
tins (1.3.
|
55
|
-
vcr (2.9.
|
56
|
-
webmock (1.
|
54
|
+
tins (1.3.3)
|
55
|
+
vcr (2.9.3)
|
56
|
+
webmock (1.20.4)
|
57
57
|
addressable (>= 2.3.6)
|
58
58
|
crack (>= 0.3.2)
|
59
59
|
|
@@ -62,7 +62,7 @@ PLATFORMS
|
|
62
62
|
|
63
63
|
DEPENDENCIES
|
64
64
|
bundler (~> 1)
|
65
|
-
byebug
|
65
|
+
byebug (~> 3)
|
66
66
|
contact-data!
|
67
67
|
coveralls (~> 0)
|
68
68
|
gem-release (~> 0)
|
data/contact-data.gemspec
CHANGED
@@ -28,5 +28,5 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency 'coveralls', '~> 0'
|
29
29
|
spec.add_development_dependency 'vcr', '~> 2'
|
30
30
|
spec.add_development_dependency 'webmock', '~> 1'
|
31
|
-
spec.add_development_dependency 'byebug'
|
31
|
+
spec.add_development_dependency 'byebug', '~> 3'
|
32
32
|
end
|
data/lib/contact-data/contact.rb
CHANGED
data/lib/contact-data/version.rb
CHANGED
@@ -7,7 +7,10 @@ describe ContactData::Contact do
|
|
7
7
|
|
8
8
|
it 'searches for a contact by name' do
|
9
9
|
VCR.use_cassette('name_search') do
|
10
|
-
|
10
|
+
result = ContactData::Contact.search(name, verbose: true)
|
11
|
+
expect(result).to be_a(Hash)
|
12
|
+
expect(result[:slug]).to eq('derek-jones')
|
13
|
+
expect(result[:identities].count).to eq(15)
|
11
14
|
end
|
12
15
|
end
|
13
16
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'contact-data'
|
4
|
+
require 'byebug'
|
5
|
+
|
6
|
+
describe ContactData::Fetcher do
|
7
|
+
let(:method) { 'method' }
|
8
|
+
|
9
|
+
it 'adds diagnostic information to a RestClient exception' do
|
10
|
+
RestClient::Request.any_instance.stub(:execute).and_raise RestClient::InternalServerError.new(nil, 500)
|
11
|
+
|
12
|
+
expect { ContactData::Fetcher.get(method) }.to raise_error { |e|
|
13
|
+
expect(e).to be_an(ContactData::FetchError)
|
14
|
+
message = "500 Internal Server Error when trying to GET url: #{ContactData::Fetcher::URL}/#{method}.json"
|
15
|
+
expect(e.message).to eq(message)
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: http://public.xenapto.com/api/v2/search.json?name=Derek%20Jones%20III
|
5
|
+
uri: http://public.xenapto.com/api/v2/contacts/search.json?name=Derek%20Jones%20III
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -15,54 +15,44 @@ http_interactions:
|
|
15
15
|
- Ruby
|
16
16
|
response:
|
17
17
|
status:
|
18
|
-
code:
|
19
|
-
message:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
20
|
headers:
|
21
21
|
Date:
|
22
|
-
-
|
22
|
+
- Tue, 11 Nov 2014 16:28:14 GMT
|
23
23
|
Status:
|
24
|
-
-
|
24
|
+
- 200 OK
|
25
25
|
Connection:
|
26
26
|
- close
|
27
27
|
Content-Type:
|
28
|
-
-
|
28
|
+
- application/json; charset=utf-8
|
29
29
|
Content-Length:
|
30
|
-
- '
|
30
|
+
- '2650'
|
31
|
+
X-Ua-Compatible:
|
32
|
+
- IE=Edge,chrome=1
|
33
|
+
Etag:
|
34
|
+
- '"987eaf76c45a1d317b3c8fad8f7e15d8"'
|
35
|
+
Cache-Control:
|
36
|
+
- max-age=0, private, must-revalidate
|
31
37
|
X-Request-Id:
|
32
|
-
-
|
38
|
+
- f04039bd77cd67d31d529101bc4642b9
|
33
39
|
X-Runtime:
|
34
|
-
- '0.
|
40
|
+
- '0.060992'
|
35
41
|
X-Rack-Cache:
|
36
42
|
- miss
|
37
43
|
body:
|
38
44
|
encoding: UTF-8
|
39
|
-
string:
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
border: 1px solid #ccc;
|
51
|
-
border-right-color: #999;
|
52
|
-
border-bottom-color: #999;
|
53
|
-
}
|
54
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
55
|
-
</style>
|
56
|
-
</head>
|
57
|
-
|
58
|
-
<body>
|
59
|
-
<!-- This file lives in public/404.html -->
|
60
|
-
<div class="dialog">
|
61
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
63
|
-
</div>
|
64
|
-
</body>
|
65
|
-
</html>
|
45
|
+
string: '{"name":"Derek Jones III","slug":"derek-jones","version":"v2","identities":[{"contact_type":"person","description":null,"identity_slug":"derek-jones","service":"angel_list","url":"https://angel.co/derek-jones"},{"contact_type":"person","description":null,"identity_slug":"https://d1qb2nb5cznatu.cloudfront.net/users/165075-medium_jpg?1405505118","service":"avatar","url":"https://d1qb2nb5cznatu.cloudfront.net/users/165075-medium_jpg?1405505118"},{"contact_type":"person","description":null,"identity_slug":"dereknakano.com","service":"domain","url":"http://www.dereknakano.com"},{"contact_type":"person","description":"Derek
|
46
|
+
Andrew Jones","identity_slug":"daj01053","service":"fsa","url":"http://www.fsa.gov.uk/register//indivbasicdetails.do?sid=368843"},{"contact_type":"person","description":"Derek
|
47
|
+
John Jones","identity_slug":"djj01040","service":"fsa","url":"http://www.fsa.gov.uk/register//indivbasicdetails.do?sid=360573"},{"contact_type":"person","description":"Derek
|
48
|
+
Leslie Jones","identity_slug":"dlj01043","service":"fsa","url":"http://www.fsa.gov.uk/register//indivbasicdetails.do?sid=568698"},{"contact_type":"person","description":"Derek
|
49
|
+
Powell Jones","identity_slug":"dpj01022","service":"fsa","url":"http://www.fsa.gov.uk/register//indivbasicdetails.do?sid=370909"},{"contact_type":"person","description":"Derek
|
50
|
+
Peter Jones","identity_slug":"dpj01028","service":"fsa","url":"http://www.fsa.gov.uk/register//indivbasicdetails.do?sid=521125"},{"contact_type":"person","description":"Derek
|
51
|
+
Robert Jones","identity_slug":"drj01066","service":"fsa","url":"http://www.fsa.gov.uk/register//indivbasicdetails.do?sid=720500"},{"contact_type":"person","description":"Derek
|
52
|
+
Jones","identity_slug":"dxj00016","service":"fsa","url":"http://www.fsa.gov.uk/register//indivbasicdetails.do?sid=267093"},{"contact_type":"person","description":"Derek
|
53
|
+
Jones","identity_slug":"dxj00029","service":"fsa","url":"http://www.fsa.gov.uk/register//indivbasicdetails.do?sid=282759"},{"contact_type":"person","description":"Derek
|
54
|
+
Jones","identity_slug":"dxj01164","service":"fsa","url":"http://www.fsa.gov.uk/register//indivbasicdetails.do?sid=490042"},{"contact_type":"person","description":"Derek
|
55
|
+
Jones","identity_slug":"dxj01321","service":"fsa","url":"http://www.fsa.gov.uk/register//indivbasicdetails.do?sid=729794"},{"contact_type":"person","description":null,"identity_slug":"pub/derek-jones/15/b2/55b","service":"linked_in","url":"http://www.linkedin.com/pub/derek-jones/15/b2/55b"},{"contact_type":"person","description":null,"identity_slug":"http://www.dereknakano.com","service":"url","url":"http://www.dereknakano.com"}],"relationships":[],"links":[]}'
|
66
56
|
http_version:
|
67
|
-
recorded_at:
|
68
|
-
recorded_with: VCR 2.9.
|
57
|
+
recorded_at: Tue, 11 Nov 2014 16:28:14 GMT
|
58
|
+
recorded_with: VCR 2.9.3
|
data/spec/support/vcr_setup.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contact-data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xenapto
|
@@ -160,16 +160,16 @@ dependencies:
|
|
160
160
|
name: byebug
|
161
161
|
requirement: !ruby/object:Gem::Requirement
|
162
162
|
requirements:
|
163
|
-
- - "
|
163
|
+
- - "~>"
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version: '
|
165
|
+
version: '3'
|
166
166
|
type: :development
|
167
167
|
prerelease: false
|
168
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
169
|
requirements:
|
170
|
-
- - "
|
170
|
+
- - "~>"
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version: '
|
172
|
+
version: '3'
|
173
173
|
description: A Ruby gem to retrieve data about people and organizations from http://public.xenapto.com
|
174
174
|
email:
|
175
175
|
- developers@xenapto.com
|
@@ -192,12 +192,14 @@ files:
|
|
192
192
|
- lib/contact-data.rb
|
193
193
|
- lib/contact-data/contact.rb
|
194
194
|
- lib/contact-data/deprecated.rb
|
195
|
+
- lib/contact-data/exception.rb
|
195
196
|
- lib/contact-data/fetcher.rb
|
196
197
|
- lib/contact-data/link.rb
|
197
198
|
- lib/contact-data/version.rb
|
198
199
|
- spec/contact-data_contact_spec.rb
|
199
200
|
- spec/contact-data_deprecated_spec.rb
|
200
201
|
- spec/contact-data_link_spec.rb
|
202
|
+
- spec/fetcher_spec.rb
|
201
203
|
- spec/spec_helper.rb
|
202
204
|
- spec/support/cassettes/deprecated_contact_name_search.yml
|
203
205
|
- spec/support/cassettes/deprecated_contact_search.yml
|
@@ -234,6 +236,7 @@ test_files:
|
|
234
236
|
- spec/contact-data_contact_spec.rb
|
235
237
|
- spec/contact-data_deprecated_spec.rb
|
236
238
|
- spec/contact-data_link_spec.rb
|
239
|
+
- spec/fetcher_spec.rb
|
237
240
|
- spec/spec_helper.rb
|
238
241
|
- spec/support/cassettes/deprecated_contact_name_search.yml
|
239
242
|
- spec/support/cassettes/deprecated_contact_search.yml
|