fc_enrich 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/CHANGELOG.md +3 -0
- data/README.md +10 -0
- data/lib/fc_enrich.rb +5 -1
- data/lib/fc_enrich/fake_client.rb +26 -2
- data/lib/fc_enrich/fake_client/{post_v3_company.enrich.json → post_v3_company.enrich/domain=fullcontact_com.json} +0 -0
- data/lib/fc_enrich/fake_client/{post_v3_person.enrich.json → post_v3_person.enrich/email=bart@fullcontact_com.json} +0 -0
- data/lib/fc_enrich/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 674198f3d7e1795ba7bd01a9bcb1a7087b54b9fc40aaf3a405107368b4bd221b
|
4
|
+
data.tar.gz: fcd477d908b2de754ffbb1e4b1a4208a854687894c5fd555a0bdb12aa6c275cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84975fdd172df8d266b5132f427eacbfc136363ef6e8688f6656e17a69b8d92c191431bfa431899aced71238e798973c8a0583ae812044d9057ea7f13f99cc41
|
7
|
+
data.tar.gz: 9f609871a99d8b2d5fd04731e8fb1bebc34c61c19104ca71c9f8e1f1a7b05b8181abb6ed747795a8600f139f4c2f5c8e6429fa7578f1ba9874f0ecd4dcda3c85
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -114,6 +114,16 @@ Rspec.describe "Test" do
|
|
114
114
|
end
|
115
115
|
```
|
116
116
|
|
117
|
+
there is an option to enable fake mode all the time
|
118
|
+
|
119
|
+
```ruby
|
120
|
+
FcEnrich.use_fake
|
121
|
+
|
122
|
+
# allows you to set a folder where fake data is pulled from
|
123
|
+
# this will created the folder with examples in it
|
124
|
+
FcEnrich::FakeClient.folder = "data/fc_enrich"
|
125
|
+
```
|
126
|
+
|
117
127
|
## Development
|
118
128
|
|
119
129
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/fc_enrich.rb
CHANGED
@@ -1,8 +1,32 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
1
3
|
module FcEnrich
|
2
4
|
class FakeClient
|
3
|
-
def
|
4
|
-
|
5
|
+
def self.folder=(val)
|
6
|
+
@folder = val
|
7
|
+
FileUtils.mkdir_p(@folder)
|
8
|
+
FileUtils.cp_r "#{default_folder}/post_v3_company.enrich", @folder
|
9
|
+
FileUtils.cp_r "#{default_folder}/post_v3_person.enrich", @folder
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.folder
|
13
|
+
@folder || default_folder
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.reset_folder
|
17
|
+
@folder = nil
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.default_folder
|
21
|
+
"#{__dir__}/fake_client"
|
22
|
+
end
|
23
|
+
|
24
|
+
def post(path, payload_hash)
|
25
|
+
add = payload_hash.to_a.map { |v| v.join("=") }.join("&").tr(".", "_")
|
26
|
+
data = File.read("#{self.class.folder}/post#{path.tr("/", "_")}/#{add}.json")
|
5
27
|
MultiJson.load(data)
|
28
|
+
rescue Errno::ENOENT
|
29
|
+
nil
|
6
30
|
end
|
7
31
|
end
|
8
32
|
end
|
File without changes
|
File without changes
|
data/lib/fc_enrich/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fc_enrich
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grant Petersen-Speelman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -113,8 +113,8 @@ files:
|
|
113
113
|
- lib/fc_enrich.rb
|
114
114
|
- lib/fc_enrich/company_enrich_request.rb
|
115
115
|
- lib/fc_enrich/fake_client.rb
|
116
|
-
- lib/fc_enrich/fake_client/post_v3_company.enrich.json
|
117
|
-
- lib/fc_enrich/fake_client/post_v3_person.enrich.json
|
116
|
+
- lib/fc_enrich/fake_client/post_v3_company.enrich/domain=fullcontact_com.json
|
117
|
+
- lib/fc_enrich/fake_client/post_v3_person.enrich/email=bart@fullcontact_com.json
|
118
118
|
- lib/fc_enrich/http_client.rb
|
119
119
|
- lib/fc_enrich/person_enrich_request.rb
|
120
120
|
- lib/fc_enrich/version.rb
|