contact-data 0.4.4 → 0.4.5

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: dfee0c544453be0ef2f7c377e4f2f16df5a4680a
4
- data.tar.gz: 03760b8159918a0f0a3958af533eb957c0d3b250
3
+ metadata.gz: a7f52b3bd3c32a1ac86b82e28ced5f7f269bfc04
4
+ data.tar.gz: c10f5e26215b0211606828e3d516add1579b86b0
5
5
  SHA512:
6
- metadata.gz: 07d00e6d5142bb0320c5d32fcb1b43baeb9d7127ef052c84dcd7f29cd05e7cb81820f2b4fe21129959502c41537aa567f1f384acb0700cc768d8942ff1ff57f4
7
- data.tar.gz: 76c888302f59444078c2b53ec79fc069cbe63f0582bcbb2a98bc7ad27f76c3373ac3c3e6ef6cd13fe6d938713632b0dee0b095b5a5984705e140f3c881f69e50
6
+ metadata.gz: 604f9a19c7721ada56b9ec9e7371f2b6bb56705a5437264d5e110d54c435cc8c3a7f3f725bfb91ee38aab955b0b2a343a51119f6f4915e631a6b27756542a415
7
+ data.tar.gz: da4a5d1d22a431a522431b9aae88cb9b421bff23a38fe520d1d19ff915cc78c157d1ca39da000484bea228d5a52ddef9b9eb6826eceef5e3b36ae70b3b5e4ed5
@@ -17,10 +17,13 @@ module ContactData
17
17
  end
18
18
 
19
19
  def from_domain(domain, options = {})
20
+ explicit_contact_type = options.delete(:contact_type)
21
+
20
22
  options[:base] ||= BASE
21
23
  options[:api_base] ||= 'api/v3'
22
24
  options[:params] ||= { domain: domain }
23
- options[:params][:contact_type] ||= options.delete(:contact_type)
25
+ options[:params][:contact_type] ||= explicit_contact_type if explicit_contact_type
26
+
24
27
  Fetcher.get(:from_domain, options)
25
28
  end
26
29
  end
@@ -1,4 +1,4 @@
1
1
  # Gem version
2
2
  module ContactData
3
- VERSION = '0.4.4'.freeze
3
+ VERSION = '0.4.5'.freeze
4
4
  end
@@ -6,6 +6,7 @@ describe ContactData::Contact do
6
6
  let(:name) { 'Derek Jones III' }
7
7
  let(:source) { 'angel_list' }
8
8
  let(:slug) { 'derek-jones' }
9
+ let(:domain) { 'anthemis.com' }
9
10
 
10
11
  it 'searches for a contact by name' do
11
12
  VCR.use_cassette('name_search') do
@@ -24,4 +25,30 @@ describe ContactData::Contact do
24
25
  expect(result[:data].first[:source_identities].count).to eq(5)
25
26
  end
26
27
  end
28
+
29
+ it 'retrieves an organization contact from a domain name' do
30
+ VCR.use_cassette('domain_name') do
31
+ result = ContactData::Contact.from_domain(domain, verbose: true)
32
+ expect(result).to be_a(Hash)
33
+ expect(result[:contacts].first[:slug]).to eq('anthemis-group')
34
+ expect(result[:contacts].count).to eq(1)
35
+ end
36
+ end
37
+
38
+ it 'retrieves a person contact from a domain name' do
39
+ VCR.use_cassette('domain_name') do
40
+ result = ContactData::Contact.from_domain(domain, contact_type: 'person', verbose: true)
41
+ expect(result).to be_a(Hash)
42
+ expect(result[:contacts].first[:slug]).to eq('sean-park')
43
+ expect(result[:contacts].count).to eq(1)
44
+ end
45
+ end
46
+
47
+ it 'retrieves all contacts for a domain name' do
48
+ VCR.use_cassette('domain_name') do
49
+ result = ContactData::Contact.from_domain(domain, contact_type: 'all', verbose: true)
50
+ expect(result).to be_a(Hash)
51
+ expect(result[:contacts].count).to eq(2)
52
+ end
53
+ end
27
54
  end
@@ -4,5 +4,8 @@ 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, decode_compressed_response: true }
7
+ c.default_cassette_options = {
8
+ # record: :new_episodes,
9
+ decode_compressed_response: true
10
+ }
8
11
  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.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xenapto