complyadvantage 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/complyadvantage.rb +18 -8
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f43c443891018571f89d9839fcbff1b9e872ff01
4
- data.tar.gz: 1a24a427d0dcc2dae7ec2a9e20bbcf46a02e5949
3
+ metadata.gz: 88b107dac97da65ab51f0f82a054d9f1edfaa1bf
4
+ data.tar.gz: 80da11eb29c13a21fe352308417cc17528d994e7
5
5
  SHA512:
6
- metadata.gz: 76cbdfa8290f20582bb077a44aabda0f98c7710914f6ddfcf9fe5a872067874b69ab78dfa30920a588a6f84c3a66d13c40716de7c0bde79d8cd57b31b7438974
7
- data.tar.gz: 46598cf037b73be302c49b27cf583c97ab65a0739fa603fdb29a92ba02893d642afd66adecad07c07208acdc9d070ea2ae026ae401077e0ba63efbbe0c7ef7db
6
+ metadata.gz: c3e91683c1c1cb3e487426ea0038eaafcbb63a409ce97b2ff76d0594be2cf1c43e0c08210465c54eea19a16efc4c6ff578126f6a89650434e2a6dfe0362ef0dc
7
+ data.tar.gz: c38e7a13a2b8ea78eb318db829d5749555debf3512586cd282fccccf7881401e1b9612140ded3834c38783c058d209f34ef0378589ecdbccbf4342e8c3b5a660
@@ -19,26 +19,36 @@ class ComplyAdvantage
19
19
  raise ArgumentError, "You must pass an array of names"
20
20
  end
21
21
  response = post("/search", {:names => names})
22
+ return check_response(response)
23
+ end
24
+
25
+ def get(id)
26
+ response = _get("/get/#{id}")
27
+ return check_response(response)
28
+ end
29
+
30
+ private
31
+
32
+ def check_response(response)
22
33
  case response.code
23
34
  when 200
24
35
  return response.parsed_response
25
36
  when 401
26
- raise ComplyAdvantageAuthenticationError, "Invalid API Key"
27
- when 500
28
- raise ComplyAdvantageError, "There was an error with your input or the complyadvantage API"
37
+ raise ComplyAdvantageAuthenticationError, "Invalid API Key"
29
38
  end
30
-
31
- return response
39
+ raise ComplyAdvantageError, "There was an error with your input or the complyadvantage API"
32
40
  end
33
41
 
34
- private
35
-
36
42
  # Internal: Fire POST HTTP request.
37
- # We only need POST right now
38
43
  def post(path, params, auth=nil)
39
44
  request(:post, path, :body => params.to_json, :basic_auth => @auth)
40
45
  end
41
46
 
47
+ # Internal: Fire GET HTTP request.
48
+ def _get(path, query=nil, auth=nil)
49
+ request(:get, path, :query => query, :basic_auth => @auth)
50
+ end
51
+
42
52
  # Internal: Does the actual requests.
43
53
  def request(method, path, params)
44
54
  self.class.send(method, path, params)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: complyadvantage
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ComplyAdvantage