fullcontact-api-ruby 0.1.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 +7 -0
- data/.document +5 -0
- data/.gitignore +53 -0
- data/.rspec +3 -0
- data/.travis.yml +18 -0
- data/Gemfile +6 -0
- data/LICENSE.md +21 -0
- data/README.md +153 -0
- data/Rakefile +25 -0
- data/fullcontact.gemspec +34 -0
- data/lib/faraday/request/gateway.rb +18 -0
- data/lib/faraday/response/add_headers.rb +8 -0
- data/lib/faraday/response/fullcontact_errors.rb +36 -0
- data/lib/faraday/response/rubyize.rb +14 -0
- data/lib/fullcontact/api.rb +21 -0
- data/lib/fullcontact/client/company.rb +16 -0
- data/lib/fullcontact/client/person.rb +20 -0
- data/lib/fullcontact/client.rb +16 -0
- data/lib/fullcontact/configuration.rb +94 -0
- data/lib/fullcontact/connection.rb +39 -0
- data/lib/fullcontact/error.rb +47 -0
- data/lib/fullcontact/ext/hash/to_snake_keys.rb +41 -0
- data/lib/fullcontact/request.rb +28 -0
- data/lib/fullcontact/version.rb +3 -0
- data/lib/fullcontact.rb +29 -0
- data/spec/faraday/response_spec.rb +57 -0
- data/spec/fixtures/company.json +191 -0
- data/spec/fixtures/person.json +48 -0
- data/spec/fullcontact_spec.rb +145 -0
- data/spec/helper.rb +23 -0
- data/spec/ruby_fullcontact/api_spec.rb +68 -0
- data/spec/ruby_fullcontact/client/company_spec.rb +37 -0
- data/spec/ruby_fullcontact/client/person_spec.rb +93 -0
- data/spec/ruby_fullcontact/client_spec.rb +10 -0
- metadata +245 -0
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe FullContact::Client::Person do
|
4
|
+
FullContact::Configuration::VALID_FORMATS.each do |format|
|
5
|
+
context ".new(:format => '#{format}')" do
|
6
|
+
before do
|
7
|
+
@client = FullContact::Client.new(:format => format, :api_key => 'api_key')
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
context "when parsing a response" do
|
14
|
+
|
15
|
+
before do
|
16
|
+
FullContact.configure do |config|
|
17
|
+
config.api_key = "api_key"
|
18
|
+
end
|
19
|
+
|
20
|
+
stub_get("person.json").
|
21
|
+
with(:query => {:apiKey => "api_key", :email => "brawest@gmail.com"}).
|
22
|
+
to_return(:body => fixture("person.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
23
|
+
|
24
|
+
stub_get("person.json").
|
25
|
+
with(:query => {:apiKey => "api_key", :twitter => "brawtest"}).
|
26
|
+
to_return(:body => fixture("person.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should rubyize keys' do
|
30
|
+
expect(FullContact.person(email: "brawest@gmail.com").contact_info.given_name).to(eq("Brandon"))
|
31
|
+
|
32
|
+
expect(FullContact.person(email: "brawest@gmail.com")).to satisfy do |v|
|
33
|
+
v.keys.all? { |k| !k.match(/[A-Z]/) }
|
34
|
+
end
|
35
|
+
end
|
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
|
55
|
+
|
56
|
+
context "with headers enabled" do
|
57
|
+
|
58
|
+
before do
|
59
|
+
FullContact.configure do |config|
|
60
|
+
config.api_key = "api_key"
|
61
|
+
config.include_headers_in_response = true
|
62
|
+
end
|
63
|
+
|
64
|
+
stub_get("person.json").
|
65
|
+
with(:query => {:apiKey => "api_key", :email => "brawest@gmail.com"}).
|
66
|
+
to_return(:body => fixture("person.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should include http headers from response' do
|
70
|
+
expect(FullContact.person(email: "brawest@gmail.com").http_headers['content-type'])
|
71
|
+
.to(eq("application/json; charset=utf-8"))
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context "facebook queries removed" do
|
76
|
+
|
77
|
+
before do
|
78
|
+
FullContact.configure do |config|
|
79
|
+
config.api_key = "api_key"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'should not allow querying by facebookUsername' do
|
84
|
+
expect { FullContact.person(facebookUsername: "brawest") }.to raise_error(ArgumentError)
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'should not allow querying by facebookId' do
|
89
|
+
expect { FullContact.person(facebookId: "123") }.to raise_error(ArgumentError)
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe FullContact::Client do
|
4
|
+
it "should connect using the endpoint configuration" do
|
5
|
+
client = FullContact::Client.new
|
6
|
+
endpoint = URI.parse(client.api_endpoint)
|
7
|
+
connection = "#{client.send(:connection).build_url(nil).to_s}"
|
8
|
+
connection.should == endpoint.to_s
|
9
|
+
end
|
10
|
+
end
|
metadata
ADDED
@@ -0,0 +1,245 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fullcontact-api-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ratnam Yadav
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-02-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: maruku
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: nokogiri
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.9'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.9'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: codeclimate-test-reporter
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.0.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.0.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: webmock
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.6'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.6'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: yard
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.9.11
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.9.11
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: hashie
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.0'
|
132
|
+
- - "<"
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '4.0'
|
135
|
+
type: :runtime
|
136
|
+
prerelease: false
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '2.0'
|
142
|
+
- - "<"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '4.0'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: faraday
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - "~>"
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '1'
|
152
|
+
type: :runtime
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - "~>"
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '1'
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: faraday_middleware
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - "~>"
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '1'
|
166
|
+
type: :runtime
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - "~>"
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '1'
|
173
|
+
description: A Ruby wrapper for the FullContact API
|
174
|
+
email:
|
175
|
+
- support@fullcontact.com
|
176
|
+
executables: []
|
177
|
+
extensions: []
|
178
|
+
extra_rdoc_files: []
|
179
|
+
files:
|
180
|
+
- ".document"
|
181
|
+
- ".gitignore"
|
182
|
+
- ".rspec"
|
183
|
+
- ".travis.yml"
|
184
|
+
- Gemfile
|
185
|
+
- LICENSE.md
|
186
|
+
- README.md
|
187
|
+
- Rakefile
|
188
|
+
- fullcontact.gemspec
|
189
|
+
- lib/faraday/request/gateway.rb
|
190
|
+
- lib/faraday/response/add_headers.rb
|
191
|
+
- lib/faraday/response/fullcontact_errors.rb
|
192
|
+
- lib/faraday/response/rubyize.rb
|
193
|
+
- lib/fullcontact.rb
|
194
|
+
- lib/fullcontact/api.rb
|
195
|
+
- lib/fullcontact/client.rb
|
196
|
+
- lib/fullcontact/client/company.rb
|
197
|
+
- lib/fullcontact/client/person.rb
|
198
|
+
- lib/fullcontact/configuration.rb
|
199
|
+
- lib/fullcontact/connection.rb
|
200
|
+
- lib/fullcontact/error.rb
|
201
|
+
- lib/fullcontact/ext/hash/to_snake_keys.rb
|
202
|
+
- lib/fullcontact/request.rb
|
203
|
+
- lib/fullcontact/version.rb
|
204
|
+
- spec/faraday/response_spec.rb
|
205
|
+
- spec/fixtures/company.json
|
206
|
+
- spec/fixtures/person.json
|
207
|
+
- spec/fullcontact_spec.rb
|
208
|
+
- spec/helper.rb
|
209
|
+
- spec/ruby_fullcontact/api_spec.rb
|
210
|
+
- spec/ruby_fullcontact/client/company_spec.rb
|
211
|
+
- spec/ruby_fullcontact/client/person_spec.rb
|
212
|
+
- spec/ruby_fullcontact/client_spec.rb
|
213
|
+
homepage: https://github.com/ratnamyadav/fullcontact-api-ruby
|
214
|
+
licenses:
|
215
|
+
- MIT
|
216
|
+
metadata: {}
|
217
|
+
post_install_message: ''
|
218
|
+
rdoc_options: []
|
219
|
+
require_paths:
|
220
|
+
- lib
|
221
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
222
|
+
requirements:
|
223
|
+
- - ">="
|
224
|
+
- !ruby/object:Gem::Version
|
225
|
+
version: '0'
|
226
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
|
+
requirements:
|
228
|
+
- - ">="
|
229
|
+
- !ruby/object:Gem::Version
|
230
|
+
version: 1.3.6
|
231
|
+
requirements: []
|
232
|
+
rubygems_version: 3.1.6
|
233
|
+
signing_key:
|
234
|
+
specification_version: 4
|
235
|
+
summary: Ruby wrapper for the FullContact API
|
236
|
+
test_files:
|
237
|
+
- spec/faraday/response_spec.rb
|
238
|
+
- spec/fixtures/company.json
|
239
|
+
- spec/fixtures/person.json
|
240
|
+
- spec/fullcontact_spec.rb
|
241
|
+
- spec/helper.rb
|
242
|
+
- spec/ruby_fullcontact/api_spec.rb
|
243
|
+
- spec/ruby_fullcontact/client/company_spec.rb
|
244
|
+
- spec/ruby_fullcontact/client/person_spec.rb
|
245
|
+
- spec/ruby_fullcontact/client_spec.rb
|