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 +4 -4
- data/lib/contact-data/contact.rb +4 -1
- data/lib/contact-data/version.rb +1 -1
- data/spec/contact-data_contact_spec.rb +27 -0
- data/spec/support/vcr_setup.rb +4 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7f52b3bd3c32a1ac86b82e28ced5f7f269bfc04
|
4
|
+
data.tar.gz: c10f5e26215b0211606828e3d516add1579b86b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 604f9a19c7721ada56b9ec9e7371f2b6bb56705a5437264d5e110d54c435cc8c3a7f3f725bfb91ee38aab955b0b2a343a51119f6f4915e631a6b27756542a415
|
7
|
+
data.tar.gz: da4a5d1d22a431a522431b9aae88cb9b421bff23a38fe520d1d19ff915cc78c157d1ca39da000484bea228d5a52ddef9b9eb6826eceef5e3b36ae70b3b5e4ed5
|
data/lib/contact-data/contact.rb
CHANGED
@@ -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] ||=
|
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
|
data/lib/contact-data/version.rb
CHANGED
@@ -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
|
data/spec/support/vcr_setup.rb
CHANGED
@@ -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 = {
|
7
|
+
c.default_cassette_options = {
|
8
|
+
# record: :new_episodes,
|
9
|
+
decode_compressed_response: true
|
10
|
+
}
|
8
11
|
end
|