blockscore 2.1.2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/blockscore.gemspec +5 -3
- data/lib/blockscore/client.rb +29 -1
- data/lib/blockscore/watchlist.rb +15 -0
- data/lib/blockscore/watchlist_candidate.rb +47 -0
- data/test/test_blockscore.rb +63 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83a4c79fe8834cb3203e601c81f111a1d2196be1
|
4
|
+
data.tar.gz: 8110c2543cc606784141cd06f907fdf5a8b6673d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 698928ba260af8aea1bf2c4dcd3f6f63e8431a6fd9f027c3e3820fc3bb09f8a53802509e14d5d56eb5d2dbf279f8bc4efe14b4c5732838d796fa3c19e0c299e2
|
7
|
+
data.tar.gz: 6d6e8dab0c96d22fde5be3cbb54f24ed60bf863e6b6c1725aa9e6e4395824e1fc51146947603d91e7d920ecf3074af7e585716095c25ee5428cb93a142f9572d
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.0
|
data/blockscore.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: blockscore
|
5
|
+
# stub: blockscore 3.0.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "blockscore"
|
9
|
-
s.version = "
|
9
|
+
s.version = "3.0.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Alain Meier"]
|
14
|
-
s.date = "2014-
|
14
|
+
s.date = "2014-08-05"
|
15
15
|
s.description = "A ruby client library for the BlockScore API."
|
16
16
|
s.email = "alain@blockscore.com"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -41,6 +41,8 @@ Gem::Specification.new do |s|
|
|
41
41
|
"lib/blockscore/errors.rb",
|
42
42
|
"lib/blockscore/question_set.rb",
|
43
43
|
"lib/blockscore/verification.rb",
|
44
|
+
"lib/blockscore/watchlist.rb",
|
45
|
+
"lib/blockscore/watchlist_candidate.rb",
|
44
46
|
"test/helper.rb",
|
45
47
|
"test/test_blockscore.rb"
|
46
48
|
]
|
data/lib/blockscore/client.rb
CHANGED
@@ -2,7 +2,7 @@ module BlockScore
|
|
2
2
|
class Client
|
3
3
|
include HTTParty
|
4
4
|
|
5
|
-
attr_reader :verification, :question_set, :company
|
5
|
+
attr_reader :verification, :question_set, :company, :watchlist_candidate, :watchlist
|
6
6
|
|
7
7
|
def initialize(api_key, version, options = {})
|
8
8
|
@api_key = api_key
|
@@ -10,6 +10,8 @@ module BlockScore
|
|
10
10
|
@verification = BlockScore::Verification.new(self)
|
11
11
|
@question_set = BlockScore::QuestionSet.new(self)
|
12
12
|
@company = BlockScore::Company.new(self)
|
13
|
+
@watchlist_candidate = BlockScore::WatchlistCandidate.new(self)
|
14
|
+
@watchlist = BlockScore::Watchlist.new(self)
|
13
15
|
@error_handler = BlockScore::ErrorHandler.new
|
14
16
|
|
15
17
|
options[:base_uri] ||= "https://api.blockscore.com"
|
@@ -46,5 +48,31 @@ module BlockScore
|
|
46
48
|
|
47
49
|
end
|
48
50
|
|
51
|
+
def put(path, options = {})
|
52
|
+
options = { :body => options, :basic_auth => @auth }
|
53
|
+
|
54
|
+
response = self.class.put(path, options)
|
55
|
+
|
56
|
+
begin
|
57
|
+
result = @error_handler.check_error(response)
|
58
|
+
rescue BlockScore::BlockscoreError => e
|
59
|
+
raise
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
def delete(path, options = {})
|
65
|
+
options = { :body => options, :basic_auth => @auth }
|
66
|
+
|
67
|
+
response = self.class.delete(path, options)
|
68
|
+
|
69
|
+
begin
|
70
|
+
result = @error_handler.check_error(response)
|
71
|
+
rescue BlockScore::BlockscoreError => e
|
72
|
+
raise
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
49
77
|
end
|
50
78
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module BlockScore
|
2
|
+
class Watchlist
|
3
|
+
def initialize(client)
|
4
|
+
@client = client
|
5
|
+
end
|
6
|
+
# POST https://api.blockscore.com/watchlists
|
7
|
+
def search(watchlist_candidate_id, match_type = nil)
|
8
|
+
body = {}
|
9
|
+
body[:watchlist_candidate_id] = watchlist_candidate_id
|
10
|
+
body[:match_type] = match_type
|
11
|
+
|
12
|
+
@client.post '/watchlists', body
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module BlockScore
|
2
|
+
class WatchlistCandidate
|
3
|
+
def initialize(client)
|
4
|
+
@client = client
|
5
|
+
end
|
6
|
+
|
7
|
+
# POST https://api.blockscore.com/watchlist_candidates
|
8
|
+
def create(options = {})
|
9
|
+
response = @client.post '/watchlist_candidates', options
|
10
|
+
end
|
11
|
+
|
12
|
+
# PATCH https://api.blockscore.com/watchlist_candidates/{WATCHLIST_CANDIDATE_ID}
|
13
|
+
def edit(watchlist_candidate_id, options = {})
|
14
|
+
response = @client.put "/watchlist_candidates/#{watchlist_candidate_id}", options
|
15
|
+
end
|
16
|
+
|
17
|
+
# DELETE https://api.blockscore.com/watchlist_candidates/{WATCHLIST_CANDIDATE_ID}
|
18
|
+
def delete(watchlist_candidate_id)
|
19
|
+
response = @client.delete "/watchlist_candidates/#{watchlist_candidate_id}"
|
20
|
+
end
|
21
|
+
|
22
|
+
# GET https://api.blockscore.com/watchlist_candidates/{WATCHLIST_CANDIDATE_ID}
|
23
|
+
def retrieve(watchlist_candidate_id)
|
24
|
+
response = @client.get "/watchlist_candidates/#{watchlist_candidate_id}"
|
25
|
+
end
|
26
|
+
|
27
|
+
# GET https://api.blockscore.com/watchlist_candidates
|
28
|
+
def all(count = nil, offset = nil, options = {})
|
29
|
+
body = (options.include? :body) ? options[:body] : {}
|
30
|
+
|
31
|
+
body[:count] = count
|
32
|
+
body[:offset] = offset
|
33
|
+
|
34
|
+
@client.get '/watchlist_candidates', body
|
35
|
+
end
|
36
|
+
|
37
|
+
# GET https://api.blockscore.com/watchlist_candidates/:id/history
|
38
|
+
def history(watchlist_candidate_id)
|
39
|
+
response = @client.get "/watchlist_candidates/#{watchlist_candidate_id}/history"
|
40
|
+
end
|
41
|
+
|
42
|
+
# GET https://api.blockscore.com/watchlist_candidates/:id/hits
|
43
|
+
def hits(watchlist_candidate_id)
|
44
|
+
response = @client.get "/watchlist_candidates/#{watchlist_candidate_id}/hits"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/test/test_blockscore.rb
CHANGED
@@ -2,15 +2,77 @@ require File.join(File.dirname(__FILE__), 'helper')
|
|
2
2
|
|
3
3
|
class TestBlockScore < Test::Unit::TestCase
|
4
4
|
# If you'd like to run the test suite, fill in your API key,
|
5
|
-
# a verification ID
|
5
|
+
# a verification ID, a question set ID, a company ID, and a watchlist candidate ID below.
|
6
6
|
@version = 3
|
7
7
|
@api_key = ""
|
8
8
|
|
9
9
|
@@verification_id = ""
|
10
10
|
@@question_set_id = ""
|
11
11
|
@@company_id = ""
|
12
|
+
@@watchlist_candidate_id = ""
|
13
|
+
|
12
14
|
@@client = BlockScore::Client.new(@api_key, version = @version)
|
13
15
|
|
16
|
+
context "a watchlist" do
|
17
|
+
should "return search watchlists" do
|
18
|
+
response = @@client.watchlist.search(@@watchlist_candidate_id)
|
19
|
+
assert_equal 200, response.code
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "a watchlist candidate" do
|
24
|
+
should "return create a watchlist candidate" do
|
25
|
+
watchlist_params = {
|
26
|
+
:note => "12341234",
|
27
|
+
:ssn => "0001",
|
28
|
+
:date_of_birth => "1940-08-11",
|
29
|
+
:name_first => "John",
|
30
|
+
:name_middle => "",
|
31
|
+
:name_last => "Bredenkamp",
|
32
|
+
:address_street1 => "1 Infinite Loop",
|
33
|
+
:address_city => "Cupertino",
|
34
|
+
:address_country_code => "US"
|
35
|
+
}
|
36
|
+
response = @@client.watchlist_candidate.create(watchlist_params)
|
37
|
+
assert_equal 201, response.code
|
38
|
+
end
|
39
|
+
|
40
|
+
should "return edit a watchlist candidate" do
|
41
|
+
watchlist_params = {
|
42
|
+
:date_of_birth => "1945-05-08",
|
43
|
+
:name_middle => "Jones"
|
44
|
+
}
|
45
|
+
response = @@client.watchlist_candidate.edit(@@watchlist_candidate_id, watchlist_params)
|
46
|
+
assert_equal 200, response.code
|
47
|
+
end
|
48
|
+
|
49
|
+
should "return retrieve a watchlist candidate" do
|
50
|
+
response = @@client.watchlist_candidate.retrieve(@@watchlist_candidate_id)
|
51
|
+
assert_equal 200, response.code
|
52
|
+
end
|
53
|
+
|
54
|
+
should "return a list of wachlist candidates" do
|
55
|
+
response = @@client.watchlist_candidate.all
|
56
|
+
assert_equal 200, response.code
|
57
|
+
end
|
58
|
+
|
59
|
+
should "return a history of a wachlist candidate" do
|
60
|
+
response = @@client.watchlist_candidate.history(@@watchlist_candidate_id)
|
61
|
+
assert_equal 200, response.code
|
62
|
+
end
|
63
|
+
|
64
|
+
should "return the hits of a wachlist candidate" do
|
65
|
+
response = @@client.watchlist_candidate.hits(@@watchlist_candidate_id)
|
66
|
+
assert_equal 200, response.code
|
67
|
+
end
|
68
|
+
|
69
|
+
should "return delete a watchlist candidate" do
|
70
|
+
response = @@client.watchlist_candidate.delete(@@watchlist_candidate_id)
|
71
|
+
assert_equal 200, response.code
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
14
76
|
context "a company" do
|
15
77
|
should "return a list of companies" do
|
16
78
|
response = @@client.company.all
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blockscore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alain Meier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -124,6 +124,8 @@ files:
|
|
124
124
|
- lib/blockscore/errors.rb
|
125
125
|
- lib/blockscore/question_set.rb
|
126
126
|
- lib/blockscore/verification.rb
|
127
|
+
- lib/blockscore/watchlist.rb
|
128
|
+
- lib/blockscore/watchlist_candidate.rb
|
127
129
|
- test/helper.rb
|
128
130
|
- test/test_blockscore.rb
|
129
131
|
homepage: http://github.com/blockscore/blockscore-ruby
|