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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f240ac261cc95ac2e06e3dfc699c269550a5a7c24fbebf65115f8d517ea46306
4
- data.tar.gz: 489a78df78e4b6f246cf4a8ed9bd93b4b239b2e9a0b1dcf3bae99d4febf45d6c
3
+ metadata.gz: 674198f3d7e1795ba7bd01a9bcb1a7087b54b9fc40aaf3a405107368b4bd221b
4
+ data.tar.gz: fcd477d908b2de754ffbb1e4b1a4208a854687894c5fd555a0bdb12aa6c275cf
5
5
  SHA512:
6
- metadata.gz: 22b749b5fdf8e9f0f70ec20c0d94c191aa882658813a53c9942c9693f03655a806a79b8f5fa3014f47ee5392dcf1b3515203b907bc11b3503af6d584597b7b84
7
- data.tar.gz: a647676169c8e010e3ae7b5e673545431318a08686c4cf2730c256f3eb1ba082c6abec5fc0041e97a1c5d9003d7fd530c46aec8cac4833cba6892f2c178dda40
6
+ metadata.gz: 84975fdd172df8d266b5132f427eacbfc136363ef6e8688f6656e17a69b8d92c191431bfa431899aced71238e798973c8a0583ae812044d9057ea7f13f99cc41
7
+ data.tar.gz: 9f609871a99d8b2d5fd04731e8fb1bebc34c61c19104ca71c9f8e1f1a7b05b8181abb6ed747795a8600f139f4c2f5c8e6429fa7578f1ba9874f0ecd4dcda3c85
data/.gitignore CHANGED
@@ -10,4 +10,5 @@
10
10
  /.rspec_status
11
11
  /gems.locked
12
12
  /vendor/bundle
13
- /.vscode
13
+ /.vscode
14
+ /spec/tmp
@@ -1,3 +1,6 @@
1
+ ## [0.3.1]
2
+ * Additional fake options to make integration testing easier
3
+
1
4
  ## [0.3.0]
2
5
  * CompanyEnrichRequest
3
6
 
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.
@@ -16,8 +16,12 @@ module FcEnrich
16
16
  use_fake? ? FakeClient.new : HttpClient.new
17
17
  end
18
18
 
19
+ def self.use_fake
20
+ @use_fake = true
21
+ end
22
+
19
23
  def self.use_fake?
20
- false
24
+ @use_fake
21
25
  end
22
26
  end
23
27
 
@@ -1,8 +1,32 @@
1
+ require 'fileutils'
2
+
1
3
  module FcEnrich
2
4
  class FakeClient
3
- def post(path, _payload_hash)
4
- data = File.read("#{__dir__}/fake_client/post#{path.tr("/", "_")}.json")
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
@@ -1,3 +1,3 @@
1
1
  module FcEnrich
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
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.0
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-02 00:00:00.000000000 Z
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