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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1cab0068423542a42926b2b0a56312f9410dba18
4
- data.tar.gz: daa1b2a29efdb94eed0d37ec1cb520dcbbb3dada
3
+ metadata.gz: 64b030ebd50147457d027469443614dee8f0b61d
4
+ data.tar.gz: b5be157f0fdde8b6d1897b38683996008132e400
5
5
  SHA512:
6
- metadata.gz: 0faf6f889688acf0b44613ad59d2100e09c159cc5ae14dd2f0b8807d3434803d603ea6511d2552373a2e352cfdf4b3e59f0d0ed55e3bf648e5b8259983f37cf2
7
- data.tar.gz: 1484b54086c2a71b5e86f4c11570480eb8c45c078ccdc7def5729e5c1de49075bd13d4c1de679b9f79cd1c37dff319d2b89f59d24cb27dd2126dbdf7a64efb98
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.0)
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.0)
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.1)
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.3)
45
- simplecov (0.9.0)
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.0)
55
- vcr (2.9.2)
56
- webmock (1.18.0)
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
@@ -1,8 +1,11 @@
1
1
  # encoding: utf-8
2
2
  module ContactData
3
3
  class Contact
4
+ BASE = :contacts
5
+
4
6
  class << self
5
7
  def search(name, options = {})
8
+ options[:base] = BASE
6
9
  options[:params] = { name: name }
7
10
  Fetcher.get(:search, options)
8
11
  end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+
3
+ module ContactData
4
+ class Exception < RuntimeError
5
+ end
6
+
7
+ class FetchError < Exception
8
+ end
9
+ end
@@ -1,4 +1,4 @@
1
1
  # Gem version
2
2
  module ContactData
3
- VERSION = '0.2.1'
3
+ VERSION = '0.2.2'
4
4
  end
@@ -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
- expect { ContactData::Contact.search(name, verbose: true) }.to raise_error(RestClient::ResourceNotFound)
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: 404
19
- message: Not Found
18
+ code: 200
19
+ message: OK
20
20
  headers:
21
21
  Date:
22
- - Thu, 12 Jun 2014 10:59:45 GMT
22
+ - Tue, 11 Nov 2014 16:28:14 GMT
23
23
  Status:
24
- - 404 Not Found
24
+ - 200 OK
25
25
  Connection:
26
26
  - close
27
27
  Content-Type:
28
- - text/html; charset=utf-8
28
+ - application/json; charset=utf-8
29
29
  Content-Length:
30
- - '728'
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
- - 90f7aaf2536951016e1548cce21ffc5f
38
+ - f04039bd77cd67d31d529101bc4642b9
33
39
  X-Runtime:
34
- - '0.006338'
40
+ - '0.060992'
35
41
  X-Rack-Cache:
36
42
  - miss
37
43
  body:
38
44
  encoding: UTF-8
39
- string: |
40
- <!DOCTYPE html>
41
- <html>
42
- <head>
43
- <title>The page you were looking for doesn't exist (404)</title>
44
- <style type="text/css">
45
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
46
- div.dialog {
47
- width: 25em;
48
- padding: 0 4em;
49
- margin: 4em auto 0 auto;
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: Thu, 12 Jun 2014 10:59:45 GMT
68
- recorded_with: VCR 2.9.2
57
+ recorded_at: Tue, 11 Nov 2014 16:28:14 GMT
58
+ recorded_with: VCR 2.9.3
@@ -4,5 +4,5 @@ VCR.configure do |c|
4
4
  c.configure_rspec_metadata!
5
5
  c.cassette_library_dir = 'spec/support/cassettes'
6
6
  c.hook_into :webmock
7
- # c.default_cassette_options = { record: :new_episodes }
7
+ c.default_cassette_options = { record: :new_episodes }
8
8
  end
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.1
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: '0'
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: '0'
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