fc_enrich 0.1.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1147796dccb881da70e654d2b12e5cef243b66eff4feff1724ec687239d5cb9
4
- data.tar.gz: '09873689133407f5417ea027ef65bdff980fe94f55b12f1d9f627201146786a7'
3
+ metadata.gz: 28486a32bc0719b366a68da8ed39af8a2c61db9ce4fbc40ea504be13b44d4ef0
4
+ data.tar.gz: e5dd106359bf2fd9967c846b3cc4f3011aee2ffb2c2c76ce8efccb2277ab4045
5
5
  SHA512:
6
- metadata.gz: b9a4a0d143d97658d104dec92a3530842657db225b6fecb7d44ec7af394cf7286a30d472b50cd78da90181e52ac138d7186ec1093b6e06b4287660c7d2859f90
7
- data.tar.gz: 30390d4b4c729a78dd3a83a7cfb169593c083d88b250a1957f1cdbde2231d8be0b2dba9e51bbb8d9c279ef6ef8db115e0f5208f4ade334054b9bc23faff0c2fb
6
+ metadata.gz: 5c21fc3da004259439e6bf9ec06349fcc80a483c1f328a84e2cf343ab5f1370ec4224199068ed8270b2f48334b6ea389b00350f4ed5e8284a6dd2163d1dcd1d0
7
+ data.tar.gz: aed0a3f867c172266cde65284ae361350cc882cf7a2b99f7a1fc58804ca0c85fea0c361c28a9c34c407f06cac7a9b0936167e64fe221dbc683532097d5539ab0
@@ -1,2 +1,5 @@
1
+ ## [0.2.0]
2
+ * add fake mode for when testing
3
+
1
4
  ## [0.1.1]
2
5
  * PersonEnrichRequest
data/README.md CHANGED
@@ -64,6 +64,24 @@ see https://platform.fullcontact.com/docs/apis/enrich/multi-field-request
64
64
  data_filter: ["social", "employment_history"])
65
65
  ```
66
66
 
67
+ ## Usage Testing
68
+
69
+ Inside your tests can enable fake mode which will always return the same sample json
70
+
71
+ ```ruby
72
+ Rspec.describe "Test" do
73
+ before :each do
74
+ allow(FcEnrich).to receive(:use_fake?).and_return(true)
75
+ end
76
+
77
+ it 'returns sample client info' do
78
+ person_request = FcEnrich::PersonEnrichRequest.new(email: "any@email.com")
79
+ person = person_request.perform
80
+ expect(person.full_name).to eq("Bart Lorang")
81
+ end
82
+ end
83
+ ```
84
+
67
85
  ## Development
68
86
 
69
87
  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.
@@ -11,6 +11,15 @@ module FcEnrich
11
11
  def self.api_key
12
12
  @key
13
13
  end
14
+
15
+ def self.http_client
16
+ use_fake? ? FakeClient.new : HttpClient.new
17
+ end
18
+
19
+ def self.use_fake?
20
+ false
21
+ end
14
22
  end
15
23
 
16
24
  require 'fc_enrich/person_enrich_request'
25
+ require 'fc_enrich/fake_client'
@@ -0,0 +1,8 @@
1
+ module FcEnrich
2
+ class FakeClient
3
+ def post(path, _payload_hash)
4
+ data = File.read("#{__dir__}/fake_client/post#{path.tr("/", "_")}.json")
5
+ MultiJson.load(data)
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,14 @@
1
+ {
2
+ "fullName": "Bart Lorang",
3
+ "ageRange": "30-39",
4
+ "gender": "Male",
5
+ "location": "Denver, CO, United States",
6
+ "title": "Co-Founder & Managing Director",
7
+ "organization": "V1.vc",
8
+ "twitter": "https://twitter.com/bartlorang",
9
+ "linkedin": "https://www.linkedin.com/in/bartlorang",
10
+ "bio": "CEO & Co-Founder of @FullContact, Managing Director @v1vc_. Tech Entrepreneur, Investor. Husband to @parkerbenson and Father to Greyson Lorang",
11
+ "avatar": "https://d2ojpxxtu63wzl.cloudfront.net/static/a7e6a5aba590d4933e35eaadabd97fd2_44e00e968ac57725a15b32f9ca714827aff8e4818d290cb0c611f2e2585253b3",
12
+ "details": {}
13
+ }
14
+
@@ -21,7 +21,7 @@ module FcEnrich
21
21
  property :dataFilter, from: :data_filter
22
22
  property :infer
23
23
 
24
- def perform(http_client: HttpClient.new)
24
+ def perform(http_client: FcEnrich.http_client)
25
25
  Response.new(
26
26
  http_client.post("/v3/person.enrich", to_hash)
27
27
  )
@@ -1,3 +1,3 @@
1
1
  module FcEnrich
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fc_enrich
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Petersen-Speelman
@@ -111,6 +111,8 @@ files:
111
111
  - fc_enrich.gemspec
112
112
  - gems.rb
113
113
  - lib/fc_enrich.rb
114
+ - lib/fc_enrich/fake_client.rb
115
+ - lib/fc_enrich/fake_client/post_v3_person.enrich.json
114
116
  - lib/fc_enrich/http_client.rb
115
117
  - lib/fc_enrich/person_enrich_request.rb
116
118
  - lib/fc_enrich/version.rb