contact-data 0.4.10 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00a7f1fb8c7f336891d329dc9c7a38bd47debb6b
4
- data.tar.gz: fe1267727a6dbab5f7ae76b9f776031c774e582f
3
+ metadata.gz: 36ef4568d918918e0b6efaade87838e48a05d7b0
4
+ data.tar.gz: 8a1c36558784c2a40293814c605b29553d95931e
5
5
  SHA512:
6
- metadata.gz: 97ef820e23ba7ec85adea3caabde6656907e4082d04863037f9cf3a25fe4926e12a0a71608ed76df581cb6abe42d06f2fa30dc664d020797828ef27a5f36338e
7
- data.tar.gz: fbf8150597d15237494c3e245c5298c2862f01169a61f1d28ad8c5b97e4ba273f94a2e574ae91bc16e9fb9f8ea955495a938d9d7cc39f7a45727b9ef5a868992
6
+ metadata.gz: 8a073972fcbb46b05266b28932952462b2608c10aeebe245c7d719218a41ea7656ed3b8f4eca5fa89e4d04532c217bfdbb8bf3f187d6186ea6d1f124183e632c
7
+ data.tar.gz: b334b3d8e08ec3f01767d66e59937602f5dff5cffd348297ca0a0ca30fc032b9c8a476d645e8a3703dc7ef7697dee68d3bddd4f78da1a8327d6fb725a14d54ec
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --profile
3
+ --require spec_helper
4
+ --format Fuubar
data/.rubocop.yml CHANGED
@@ -1,6 +1,4 @@
1
1
  ---
2
- # These are OK:
3
-
4
2
  StringLiterals:
5
3
  EnforcedStyle: single_quotes
6
4
  Enabled: true
@@ -21,26 +19,22 @@ Documentation:
21
19
 
22
20
  Output:
23
21
  Description: 'Checks for calls to puts, print, etc.'
24
- Enabled: false
22
+ Enabled: true
25
23
 
26
24
  ExtraSpacing:
27
- Enabled: false
25
+ Enabled: true
28
26
 
29
27
  FileName:
30
28
  Description: 'Use snake_case for source file names.'
31
- Enabled: true
29
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
30
+ Enabled: false
32
31
 
33
32
  Eval:
34
- Enabled: false
33
+ Enabled: true
35
34
 
36
35
  LineLength:
37
36
  Max: 120
38
37
  Enabled: true
39
38
 
40
- FileName:
41
- Description: 'Use snake_case for source file names.'
42
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
43
- Enabled: false
44
-
45
39
  ExtraSpacing:
46
40
  Enabled: true
data/circle.yml ADDED
@@ -0,0 +1,6 @@
1
+ test:
2
+ override:
3
+ - RAILS_ENV=test bundle exec rspec -r rspec_junit_formatter --format RspecJunitFormatter -o $CIRCLE_TEST_REPORTS/rspec/junit.xml:
4
+ parallel: true
5
+ files:
6
+ - spec/**/*.rb
data/contact-data.gemspec CHANGED
@@ -18,11 +18,13 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features|coverage)\/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_runtime_dependency 'rest-client', '~> 1'
21
+ spec.add_runtime_dependency 'rest-client', '~> 2' # https://github.com/rest-client/rest-client/issues/369
22
22
  spec.add_runtime_dependency 'addressable', '~> 2.3'
23
23
 
24
24
  spec.add_development_dependency 'rake', '~> 11'
25
25
  spec.add_development_dependency 'rspec', '~> 3'
26
+ spec.add_development_dependency 'fuubar', '~> 2'
27
+ spec.add_development_dependency 'rspec_junit_formatter', '~> 0'
26
28
  spec.add_development_dependency 'gem-release', '~> 0'
27
29
  spec.add_development_dependency 'simplecov', '~> 0'
28
30
  spec.add_development_dependency 'coveralls', '~> 0'
@@ -23,7 +23,7 @@ module ContactData
23
23
  end
24
24
 
25
25
  def parsed_json
26
- logger.info { "Parsing #{json.length} characters of JSON" }
26
+ logger.debug { "Parsing #{json.length} characters of JSON" }
27
27
  JSON.parse(json, symbolize_names: true, allow_nan: true)
28
28
  end
29
29
 
@@ -61,7 +61,7 @@ module ContactData
61
61
 
62
62
  def json
63
63
  return @json if @json
64
- logger.info { "Using #{display_method} for #{url}" }
64
+ logger.debug { "Using #{display_method} for #{url}" }
65
65
  @json = RestClient::Request.new(args).execute
66
66
  rescue RestClient::Exception, SocketError, Net::HTTPBadGateway => e
67
67
  message = "#{e.message} when trying to #{display_method} url: #{url} with options #{options}"
@@ -0,0 +1,17 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+ module ContactData
4
+ class Identity
5
+ BASE = :identities
6
+
7
+ class << self
8
+ def for_url(url, options = {})
9
+ options[:base] ||= BASE
10
+ options[:api_base] ||= 'api/v3'
11
+ options[:params] ||= { url: url }
12
+
13
+ Fetcher.get(:for_url, options)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  # Gem version
3
3
  module ContactData
4
- VERSION = '0.4.10'
4
+ VERSION = '0.5.0'
5
5
  end
data/lib/contact-data.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
  # frozen_string_literal: true
3
3
  require 'contact-data/contact'
4
+ require 'contact-data/identity'
4
5
  require 'contact-data/link'
5
6
  require 'contact-data/text'
6
7
  require 'contact-data/fetcher'
@@ -1,8 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # frozen_string_literal: true
3
- require 'spec_helper'
4
- require 'contact-data'
5
-
6
3
  describe ContactData::Contact do
7
4
  let(:name) { 'Derek Jones III' }
8
5
  let(:source) { 'angel_list' }
@@ -11,7 +8,7 @@ describe ContactData::Contact do
11
8
 
12
9
  it 'searches for a contact by name' do
13
10
  VCR.use_cassette('name_search') do
14
- result = ContactData::Contact.search(name, verbose: true)
11
+ result = ContactData::Contact.search name # , verbose: true
15
12
  expect(result).to be_a(Hash)
16
13
  expect(result[:slug]).to eq('derek-jones')
17
14
  expect(result[:identities].count).to eq(15)
@@ -20,7 +17,7 @@ describe ContactData::Contact do
20
17
 
21
18
  it 'retrieves a contact from a source' do
22
19
  VCR.use_cassette('source_slug') do
23
- result = ContactData::Contact.from(source, slug, verbose: true)
20
+ result = ContactData::Contact.from source, slug # , verbose: true
24
21
  expect(result).to be_a(Hash)
25
22
  expect(result[:slug]).to eq(slug)
26
23
  expect(result[:data].first[:source_identities].count).to eq(5)
@@ -29,7 +26,7 @@ describe ContactData::Contact do
29
26
 
30
27
  it 'retrieves an organization contact from a domain name' do
31
28
  VCR.use_cassette('domain_name') do
32
- result = ContactData::Contact.from_domain(domain, verbose: true)
29
+ result = ContactData::Contact.from_domain domain # , verbose: true
33
30
  expect(result).to be_a(Hash)
34
31
  expect(result[:contacts].first[:slug]).to eq('anthemis-group')
35
32
  expect(result[:contacts].count).to eq(1)
@@ -38,7 +35,7 @@ describe ContactData::Contact do
38
35
 
39
36
  it 'retrieves a person contact from a domain name' do
40
37
  VCR.use_cassette('domain_name') do
41
- result = ContactData::Contact.from_domain(domain, contact_type: 'person', verbose: true)
38
+ result = ContactData::Contact.from_domain domain, contact_type: 'person' # , verbose: true
42
39
  expect(result).to be_a(Hash)
43
40
  expect(result[:contacts].first[:slug]).to eq('sean-park')
44
41
  expect(result[:contacts].count).to eq(1)
@@ -47,7 +44,7 @@ describe ContactData::Contact do
47
44
 
48
45
  it 'retrieves all contacts for a domain name' do
49
46
  VCR.use_cassette('domain_name') do
50
- result = ContactData::Contact.from_domain(domain, contact_type: 'all', verbose: true)
47
+ result = ContactData::Contact.from_domain domain, contact_type: 'all' # , verbose: true
51
48
  expect(result).to be_a(Hash)
52
49
  expect(result[:contacts].count).to eq(2)
53
50
  end
@@ -1,8 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # frozen_string_literal: true
3
- require 'spec_helper'
4
- require 'contact-data'
5
-
6
3
  describe ContactData::Deprecated do
7
4
  let(:name) { 'Derek Jones III' }
8
5
  let(:name_xml_bug) { 'XXXXXXXXXX ?' }
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+ describe ContactData::Identity do
4
+ it 'retrieves an organization contact from a url name' do
5
+ VCR.use_cassette('identity') do
6
+ result = ContactData::Identity.for_url 'http://xenapto.com' # , verbose: true
7
+ expect(result).to be_a(Hash)
8
+ expect(result[:stale]).to be_falsey
9
+ expect(result[:identities].count).to eq(2)
10
+ end
11
+ end
12
+ end
@@ -1,8 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # frozen_string_literal: true
3
- require 'spec_helper'
4
- require 'contact-data'
5
-
6
3
  describe ContactData::Link do
7
4
  let(:url) { 'http://iana.org' }
8
5
 
@@ -15,7 +12,7 @@ describe ContactData::Link do
15
12
 
16
13
  it 'gets metadata about a url' do
17
14
  VCR.use_cassette('links_info_search') do
18
- result = ContactData::Link.search url: url, verbose: true
15
+ result = ContactData::Link.search url: url # , verbose: true
19
16
  expect(result).to be_a(Hash)
20
17
  end
21
18
  end
@@ -29,7 +26,7 @@ describe ContactData::Link do
29
26
 
30
27
  it 'gets metadata & contact from a url' do
31
28
  VCR.use_cassette('links_info_search') do
32
- result = ContactData::Link.info url: url, verbose: true
29
+ result = ContactData::Link.info url: url # , verbose: true
33
30
  expect(result).to be_a(Hash)
34
31
  end
35
32
  end
@@ -1,8 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # frozen_string_literal: true
3
- require 'spec_helper'
4
- require 'contact-data'
5
-
6
3
  describe ContactData::Text do
7
4
  let(:text) do
8
5
  <<-HTML
@@ -17,7 +14,7 @@ describe ContactData::Text do
17
14
 
18
15
  it 'gets metadata about text' do
19
16
  VCR.use_cassette('text_search') do
20
- result = ContactData::Text.search text, verbose: true
17
+ result = ContactData::Text.search text # , verbose: true
21
18
  expect(result).to be_a(ContactData::Text::Results)
22
19
  expect(result.slugs).to include('neue')
23
20
  expect(result.slugs_and_mentions).not_to include('max-williams')
@@ -27,7 +24,7 @@ describe ContactData::Text do
27
24
 
28
25
  it 'gets metadata about html, correctly identifying the text elements' do
29
26
  VCR.use_cassette('text_search') do
30
- result = ContactData::Text.search text, input_format: :html, verbose: true
27
+ result = ContactData::Text.search text, input_format: :html # , verbose: true
31
28
  expect(result).to be_a(ContactData::Text::Results)
32
29
  expect(result.slugs).not_to include('neue')
33
30
  expect(result.slugs_and_mentions).to include('max-williams', 'maxwilliams')
@@ -37,7 +34,7 @@ describe ContactData::Text do
37
34
 
38
35
  it 'gets metadata about html, correctly identifying the text & title elements' do
39
36
  VCR.use_cassette('text_search') do
40
- result = ContactData::Text.search text, input_format: :html, verbose: true, title: 'Re: Sherry Coutu'
37
+ result = ContactData::Text.search text, input_format: :html, title: 'Re: Sherry Coutu' # , verbose: true
41
38
  expect(result).to be_a(ContactData::Text::Results)
42
39
  expect(result.slugs).not_to include('neue')
43
40
  expect(result.slugs_and_mentions).to include('max-williams', 'maxwilliams', 'sherry-coutu')
data/spec/fetcher_spec.rb CHANGED
@@ -1,8 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # frozen_string_literal: true
3
- require 'spec_helper'
4
- require 'contact-data'
5
-
6
3
  describe ContactData::Fetcher do
7
4
  let(:method) { 'method' }
8
5
  let(:url) { ContactData::Fetcher::URL }
@@ -26,7 +23,7 @@ describe ContactData::Fetcher do
26
23
  { method: :method, options: { base: 'base' }, url: "#{url}/api/v2/base/method.json" },
27
24
  { method: :method, options: { url_base: url2 }, url: "#{url2}/api/v2/method.json" }
28
25
  ].each do |url_data|
29
- puts "#{url_data[:method].class}\t#{url_data[:options]}"
26
+ # puts "#{url_data[:method].class}\t#{url_data[:options]}"
30
27
  expect(
31
28
  ContactData::Fetcher.new(
32
29
  :get, url_data[:method], url_data[:options]
data/spec/spec_helper.rb CHANGED
@@ -4,6 +4,8 @@ require 'coveralls'
4
4
  SimpleCov.start
5
5
  Coveralls.wear!('rails') if ENV['COVERALLS_REPO_TOKEN']
6
6
 
7
+ require 'contact-data'
8
+
7
9
  # Requires supporting ruby files with custom matchers and macros, etc,
8
10
  # in spec/support/ and its subdirectories.
9
11
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
@@ -14,9 +16,5 @@ RSpec.configure do |config|
14
16
  # the seed, which is printed after each run.
15
17
  # --seed 1234
16
18
  config.order = 'random'
17
-
18
- # Manually-added
19
- config.color = true
20
19
  config.tty = true
21
- config.formatter = :documentation
22
20
  end
@@ -0,0 +1,51 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://public.xenapto.com/api/v3/identities/for_url.json?url=http://xenapto.com
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
+ Server:
22
+ - nginx/1.10.1
23
+ Date:
24
+ - Thu, 04 Aug 2016 12:51:37 GMT
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Content-Length:
28
+ - '339'
29
+ Connection:
30
+ - keep-alive
31
+ X-Frame-Options:
32
+ - SAMEORIGIN
33
+ X-Xss-Protection:
34
+ - 1; mode=block
35
+ X-Content-Type-Options:
36
+ - nosniff
37
+ Etag:
38
+ - W/"3370733a5b38a02339926cc6baf1dc5e"
39
+ Cache-Control:
40
+ - max-age=0, private, must-revalidate
41
+ X-Request-Id:
42
+ - ae623cf6-fad3-4e2a-b666-20daf0b35b71
43
+ X-Runtime:
44
+ - '0.050932'
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"identities":[{"name_slug":"xenapto","contact_type":"organization","service":"url","identity_slug":"http://xenapto.com","description":"Home
48
+ page"},{"name_slug":"xenapto-administrator","contact_type":"person","service":"url","identity_slug":"http://xenapto.com","description":null}],"url":"http://xenapto.com","stale":false,"version":"v3"}'
49
+ http_version:
50
+ recorded_at: Thu, 04 Aug 2016 12:51:37 GMT
51
+ recorded_with: VCR 2.9.3
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.4.10
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xenapto
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1'
19
+ version: '2'
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: '1'
26
+ version: '2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: addressable
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: fuubar
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec_junit_formatter
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: gem-release
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -235,9 +263,9 @@ extensions: []
235
263
  extra_rdoc_files: []
236
264
  files:
237
265
  - ".coveralls.yml"
238
- - ".env"
239
266
  - ".gitignore"
240
267
  - ".hound.yml"
268
+ - ".rspec"
241
269
  - ".rubocop.yml"
242
270
  - ".ruby-gemset"
243
271
  - ".ruby-version"
@@ -247,18 +275,21 @@ files:
247
275
  - README.md
248
276
  - Rakefile
249
277
  - bin/ssl_doctor.rb
278
+ - circle.yml
250
279
  - contact-data.gemspec
251
280
  - lib/contact-data.rb
252
281
  - lib/contact-data/contact.rb
253
282
  - lib/contact-data/deprecated.rb
254
283
  - lib/contact-data/exception.rb
255
284
  - lib/contact-data/fetcher.rb
285
+ - lib/contact-data/identity.rb
256
286
  - lib/contact-data/link.rb
257
287
  - lib/contact-data/text.rb
258
288
  - lib/contact-data/text/results.rb
259
289
  - lib/contact-data/version.rb
260
290
  - spec/contact-data_contact_spec.rb
261
291
  - spec/contact-data_deprecated_spec.rb
292
+ - spec/contact-data_identity_spec.rb
262
293
  - spec/contact-data_link_spec.rb
263
294
  - spec/contact-data_text_spec.rb
264
295
  - spec/fetcher_spec.rb
@@ -267,6 +298,7 @@ files:
267
298
  - spec/support/cassettes/deprecated_contact_search.yml
268
299
  - spec/support/cassettes/deprecated_link_metadata.yml
269
300
  - spec/support/cassettes/domain_name.yml
301
+ - spec/support/cassettes/identity.yml
270
302
  - spec/support/cassettes/links_info_search.yml
271
303
  - spec/support/cassettes/links_latest.yml
272
304
  - spec/support/cassettes/name_search.yml
@@ -300,6 +332,7 @@ summary: 'Example: ContactData.search(''John Smith III'')'
300
332
  test_files:
301
333
  - spec/contact-data_contact_spec.rb
302
334
  - spec/contact-data_deprecated_spec.rb
335
+ - spec/contact-data_identity_spec.rb
303
336
  - spec/contact-data_link_spec.rb
304
337
  - spec/contact-data_text_spec.rb
305
338
  - spec/fetcher_spec.rb
@@ -308,6 +341,7 @@ test_files:
308
341
  - spec/support/cassettes/deprecated_contact_search.yml
309
342
  - spec/support/cassettes/deprecated_link_metadata.yml
310
343
  - spec/support/cassettes/domain_name.yml
344
+ - spec/support/cassettes/identity.yml
311
345
  - spec/support/cassettes/links_info_search.yml
312
346
  - spec/support/cassettes/links_latest.yml
313
347
  - spec/support/cassettes/name_search.yml
data/.env DELETED
@@ -1 +0,0 @@
1
- PATH=/home/build/.rvm/gems/ruby-2.1.1/bin:/home/build/.rvm/gems/ruby-2.1.1@global/bin:/home/build/.rvm/rubies/ruby-2.1.1/bin:/home/build/.rvm/bin:/usr/local/heroku/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/build/.rvm/gems/ruby-2.1.1@global/bin/bundle