fullcontact 0.10.0 → 0.11.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.
- data/README.md +54 -21
- data/fullcontact.gemspec +1 -1
- data/lib/fullcontact/configuration.rb +5 -0
- data/lib/fullcontact/connection.rb +1 -1
- data/lib/fullcontact/version.rb +1 -1
- data/spec/ruby_fullcontact/api_spec.rb +1 -0
- data/spec/ruby_fullcontact/client/person_spec.rb +18 -0
- metadata +26 -26
data/README.md
CHANGED
@@ -9,6 +9,7 @@ A Ruby wrapper for the [FullContact API](http://www.fullcontact.com/)
|
|
9
9
|
|
10
10
|
Changes
|
11
11
|
-------
|
12
|
+
- 0.11.0 - Plisskin transformation can be disabled by specifying a `skip_rubyize = true` in config block.
|
12
13
|
- 0.10.0 - Support for FullContact Company API
|
13
14
|
- 0.9.0 - Removed Rash gem and replaced with Mashify + Plisskin
|
14
15
|
- 0.8.2 - Fix for 0.8.0 constant resolution issue.
|
@@ -31,54 +32,86 @@ Documentation
|
|
31
32
|
Usage Examples
|
32
33
|
--------------
|
33
34
|
```ruby
|
34
|
-
require
|
35
|
+
require 'fullcontact'
|
35
36
|
|
36
37
|
# This could go in an initializer
|
37
38
|
FullContact.configure do |config|
|
38
|
-
config.api_key =
|
39
|
+
config.api_key = 'fullcontact_api_key_goes_here'
|
39
40
|
end
|
40
41
|
|
41
42
|
# Get information about an email address
|
42
|
-
person = FullContact.person(email:
|
43
|
-
|
43
|
+
person = FullContact.person(email: 'bart@fullcontact.com')
|
44
|
+
```
|
45
|
+
All returned values are Hashie structs. You can access fields as if they were fields:
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
# Get person's family_name
|
49
|
+
person.contact_info.family_name
|
50
|
+
=> "Lorang"
|
51
|
+
```
|
52
|
+
|
53
|
+
But you can also turn it into a normal hash
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
# Get person's family_name
|
57
|
+
person.to_hash['contact_info']['family_name']
|
58
|
+
=> "Lorang"
|
59
|
+
```
|
60
|
+
|
61
|
+
There's other ways you can query the Person API:
|
62
|
+
```ruby
|
44
63
|
# Get information about an email address, organized by hashes vs. lists
|
45
|
-
person2 = FullContact.person(email:
|
64
|
+
person2 = FullContact.person(email: 'bart@fullcontact.com', style: 'dictionary')
|
46
65
|
|
47
66
|
# You can pass in any arbitrary parameters the Person API supports
|
48
|
-
person3 = FullContact.person(email:
|
67
|
+
person3 = FullContact.person(email: 'bart@fullcontact.com', style: 'dictionary', webhookUrl: 'https://...')
|
49
68
|
|
50
69
|
# Get information about a twitter handle
|
51
|
-
person4 = FullContact.person(twitter: "
|
70
|
+
person4 = FullContact.person(twitter: "bartlorang")
|
52
71
|
|
53
72
|
# Get information about a facebook username
|
54
|
-
person5 = FullContact.person(facebookUsername:
|
73
|
+
person5 = FullContact.person(facebookUsername: 'bart.lorang')
|
55
74
|
|
56
75
|
# Get information from a phone number
|
57
76
|
person6 = FullContact.person(phone:13037170414)
|
58
|
-
|
59
|
-
# Get information about a company
|
60
|
-
company1 = FullContact.company(domain: 'fullcontact.com')
|
61
77
|
|
62
78
|
# Get information about a twitter and ensure a 30s socket open timeout and a 15s socket read timeout
|
63
79
|
# Can throw a Faraday::Error::TimeoutError if timeouts are exceeded
|
64
|
-
person7 = FullContact.person({:twitter => "
|
80
|
+
person7 = FullContact.person({:twitter => "bartlorang"}, {:request => {:timeout => 15, :open_timeout => 30}})
|
65
81
|
|
66
|
-
# Get person's family_name
|
67
|
-
puts person.contact_info.family_name
|
68
82
|
```
|
83
|
+
|
84
|
+
Response formats can more closely mirror FullContact's APIs by disabling snake_case transformation:
|
85
|
+
```ruby
|
86
|
+
FullContact.configure do |config|
|
87
|
+
config.api_key = "fullcontact_api_key_goes_here"
|
88
|
+
config.skip_rubyize = true
|
89
|
+
end
|
90
|
+
|
91
|
+
person8 = FullContact.person(email: "bart@fullcontact.com")
|
92
|
+
|
93
|
+
=> #<Hashie::Mash contactInfo=#<Hashie::Mash chats=[#<Hashie::Mash client="gtalk" handle="lorangb@gmail.com">,
|
94
|
+
#<Hashie::Mash client="skype" handle="bart.lorang">] familyName="Lorang" fullName="Bart Lorang" givenName="Bart...
|
95
|
+
```
|
96
|
+
|
97
|
+
You can also query the Company API
|
98
|
+
```ruby
|
99
|
+
# Get information about a company
|
100
|
+
company1 = FullContact.company(domain: 'fullcontact.com')
|
101
|
+
|
102
|
+
company1.organization.name
|
103
|
+
=> "FullContact Inc."
|
104
|
+
```
|
105
|
+
|
69
106
|
|
70
107
|
Contributions
|
71
108
|
-------------
|
72
|
-
|
73
|
-
-
|
74
|
-
- Ian Fisher (i-taptera)
|
75
|
-
- Scott Watermasysk (scottwater)
|
76
|
-
- Stefano Fontanelli (stefanofontanelli)
|
77
|
-
- John Bachir (jjb)
|
109
|
+
A full list of contributors can be found in
|
110
|
+
[GitHub](https://github.com/fullcontact/fullcontact-api-ruby/graphs/contributors)
|
78
111
|
|
79
112
|
License
|
80
113
|
---------
|
81
|
-
Copyright (c)
|
114
|
+
Copyright (c) 2015 FullContact Inc. and contributors
|
82
115
|
|
83
116
|
|
84
117
|
|
data/fullcontact.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
|
|
3
3
|
require 'fullcontact/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
|
-
s.add_development_dependency 'maruku', '~> 0.
|
6
|
+
s.add_development_dependency 'maruku', '~> 0.7'
|
7
7
|
s.add_development_dependency 'nokogiri', '~> 1.4'
|
8
8
|
s.add_development_dependency 'rake', '~> 0.9'
|
9
9
|
s.add_development_dependency 'rspec', '~> 3.1'
|
@@ -10,6 +10,7 @@ module FullContact
|
|
10
10
|
:api_key,
|
11
11
|
:endpoint,
|
12
12
|
:format,
|
13
|
+
:skip_rubyize,
|
13
14
|
:gateway,
|
14
15
|
:proxy,
|
15
16
|
:user_agent].freeze
|
@@ -34,6 +35,9 @@ module FullContact
|
|
34
35
|
# @note JSON is preferred over XML because it is more concise and faster to parse.
|
35
36
|
DEFAULT_FORMAT = :json
|
36
37
|
|
38
|
+
# Default transformation done to response
|
39
|
+
DEFAULT_SKIP_RUBYIZE = false
|
40
|
+
|
37
41
|
# By default, don't use a proxy server
|
38
42
|
DEFAULT_PROXY = nil
|
39
43
|
|
@@ -68,6 +72,7 @@ module FullContact
|
|
68
72
|
self.api_key = DEFAULT_API_KEY
|
69
73
|
self.endpoint = DEFAULT_ENDPOINT
|
70
74
|
self.format = DEFAULT_FORMAT
|
75
|
+
self.skip_rubyize = DEFAULT_SKIP_RUBYIZE
|
71
76
|
self.proxy = DEFAULT_PROXY
|
72
77
|
self.user_agent = DEFAULT_USER_AGENT
|
73
78
|
self.gateway = DEFAULT_GATEWAY
|
@@ -22,7 +22,7 @@ module FullContact
|
|
22
22
|
builder.use Faraday::Request::UrlEncoded
|
23
23
|
builder.use Faraday::Request::Gateway, gateway if gateway
|
24
24
|
builder.use FaradayMiddleware::Mashify unless raw
|
25
|
-
builder.use Faraday::Response::Rubyize unless raw
|
25
|
+
builder.use Faraday::Response::Rubyize unless raw or FullContact.skip_rubyize
|
26
26
|
unless raw
|
27
27
|
case format.to_s.downcase
|
28
28
|
when 'json'
|
data/lib/fullcontact/version.rb
CHANGED
@@ -34,4 +34,22 @@ describe FullContact::Client::Person do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
37
|
+
|
38
|
+
context "when parsing a response without rubyize" do
|
39
|
+
|
40
|
+
before do
|
41
|
+
FullContact.configure do |config|
|
42
|
+
config.api_key = "api_key"
|
43
|
+
config.skip_rubyize = true
|
44
|
+
end
|
45
|
+
|
46
|
+
stub_get("person.json").
|
47
|
+
with(:query => {:apiKey => "api_key", :email => "brawest@gmail.com"}).
|
48
|
+
to_return(:body => fixture("person.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'should not rubyize keys' do
|
52
|
+
expect(FullContact.person(email: "brawest@gmail.com").contactInfo.givenName).to(eq("Brandon"))
|
53
|
+
end
|
54
|
+
end
|
37
55
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fullcontact
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-06-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: maruku
|
16
|
-
requirement: &
|
16
|
+
requirement: &70098643701000 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '0.
|
21
|
+
version: '0.7'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70098643701000
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: nokogiri
|
27
|
-
requirement: &
|
27
|
+
requirement: &70098643699940 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '1.4'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70098643699940
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70098643698340 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0.9'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70098643698340
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &70098643696100 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '3.1'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70098643696100
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: simplecov
|
60
|
-
requirement: &
|
60
|
+
requirement: &70098643694760 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0.4'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70098643694760
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: webmock
|
71
|
-
requirement: &
|
71
|
+
requirement: &70098643694020 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '1.6'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70098643694020
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: yard
|
82
|
-
requirement: &
|
82
|
+
requirement: &70098643692980 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0.7'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70098643692980
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: hashie
|
93
|
-
requirement: &
|
93
|
+
requirement: &70098643691040 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -101,10 +101,10 @@ dependencies:
|
|
101
101
|
version: '4.0'
|
102
102
|
type: :runtime
|
103
103
|
prerelease: false
|
104
|
-
version_requirements: *
|
104
|
+
version_requirements: *70098643691040
|
105
105
|
- !ruby/object:Gem::Dependency
|
106
106
|
name: faraday
|
107
|
-
requirement: &
|
107
|
+
requirement: &70098643689560 !ruby/object:Gem::Requirement
|
108
108
|
none: false
|
109
109
|
requirements:
|
110
110
|
- - ~>
|
@@ -112,10 +112,10 @@ dependencies:
|
|
112
112
|
version: 0.9.0
|
113
113
|
type: :runtime
|
114
114
|
prerelease: false
|
115
|
-
version_requirements: *
|
115
|
+
version_requirements: *70098643689560
|
116
116
|
- !ruby/object:Gem::Dependency
|
117
117
|
name: faraday_middleware
|
118
|
-
requirement: &
|
118
|
+
requirement: &70098643688980 !ruby/object:Gem::Requirement
|
119
119
|
none: false
|
120
120
|
requirements:
|
121
121
|
- - ! '>='
|
@@ -123,10 +123,10 @@ dependencies:
|
|
123
123
|
version: '0.9'
|
124
124
|
type: :runtime
|
125
125
|
prerelease: false
|
126
|
-
version_requirements: *
|
126
|
+
version_requirements: *70098643688980
|
127
127
|
- !ruby/object:Gem::Dependency
|
128
128
|
name: plissken
|
129
|
-
requirement: &
|
129
|
+
requirement: &70098643688160 !ruby/object:Gem::Requirement
|
130
130
|
none: false
|
131
131
|
requirements:
|
132
132
|
- - ! '>='
|
@@ -134,7 +134,7 @@ dependencies:
|
|
134
134
|
version: '0'
|
135
135
|
type: :runtime
|
136
136
|
prerelease: false
|
137
|
-
version_requirements: *
|
137
|
+
version_requirements: *70098643688160
|
138
138
|
description: A Ruby wrapper for the FullContact API
|
139
139
|
email:
|
140
140
|
- support@fullcontact.com
|
@@ -190,7 +190,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
190
190
|
version: '0'
|
191
191
|
segments:
|
192
192
|
- 0
|
193
|
-
hash:
|
193
|
+
hash: -2691881462496632106
|
194
194
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
195
|
none: false
|
196
196
|
requirements:
|