blockscore 3.0.1 → 4.0.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 +4 -4
- data/Gemfile +3 -1
- data/README.md +4 -4
- data/VERSION +1 -1
- data/blockscore.gemspec +17 -11
- data/lib/blockscore/candidates.rb +49 -0
- data/lib/blockscore/client.rb +11 -8
- data/lib/blockscore/{company.rb → companies.rb} +5 -4
- data/lib/blockscore/people.rb +37 -0
- data/lib/blockscore/question_sets.rb +49 -0
- data/lib/blockscore/{watchlist.rb → watchlists.rb} +7 -4
- data/test/helper.rb +4 -1
- data/test/test_blockscore.rb +69 -73
- metadata +37 -9
- data/lib/blockscore/question_set.rb +0 -49
- data/lib/blockscore/verification.rb +0 -36
- data/lib/blockscore/watchlist_candidate.rb +0 -47
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e88b157232ca06038bc84c1ac5b2a396faa9653f
|
|
4
|
+
data.tar.gz: 3a3298c56a4aeccead937ab406797257e057a4b0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 059eeb15b132025b08fe50e95ecf554af98f2fd781025123eb7c1fb654493028037ea96886f3ac2e76895e8135c32bba03b11ae65d29e02c72466d82e4a4ca93
|
|
7
|
+
data.tar.gz: f20a55a0e6a8d49819398d0bbcc6c83ddf65052fb61f58a6fb5a0442bf74e9a73e11d2725d549ca56e1124555fefbf6ae61fe0c84948b5e1b8c28d69b53e6df5
|
data/Gemfile
CHANGED
|
@@ -5,9 +5,11 @@ gem 'httparty', '~> 0.11'
|
|
|
5
5
|
# Add dependencies to develop your gem here.
|
|
6
6
|
# Include everything needed to run rake, tests, features, etc.
|
|
7
7
|
group :development do
|
|
8
|
-
gem "shoulda", "~> 3.
|
|
8
|
+
gem "shoulda", "~> 3.5.0"
|
|
9
9
|
gem "rdoc", "~> 3.12"
|
|
10
10
|
gem "bundler", "~> 1.0"
|
|
11
11
|
gem "jeweler", "~> 2.0.1"
|
|
12
12
|
gem "simplecov", ">= 0"
|
|
13
|
+
gem "minitest", "~> 4.0"
|
|
14
|
+
gem 'shoulda-context', '~> 1.2'
|
|
13
15
|
end
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# blockscore-ruby
|
|
2
2
|
|
|
3
|
-
This is the official library for Ruby clients of the BlockScore API. [Click here to read the full documentation including code examples](http://docs.blockscore.com/
|
|
3
|
+
This is the official library for Ruby clients of the BlockScore API. [Click here to read the full documentation including code examples](http://docs.blockscore.com/v4.0/ruby/).
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -13,7 +13,7 @@ gem install blockscore
|
|
|
13
13
|
If you are using Rails, add the following to your `Gemfile`:
|
|
14
14
|
|
|
15
15
|
```ruby
|
|
16
|
-
gem 'blockscore', '~>
|
|
16
|
+
gem 'blockscore', '~> 4.0.0'
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## Getting Started
|
|
@@ -21,10 +21,10 @@ gem 'blockscore', '~> 3.0.0'
|
|
|
21
21
|
To get started, you can initialize the library with one line:
|
|
22
22
|
|
|
23
23
|
```ruby
|
|
24
|
-
client = BlockScore::Client.new('your-api-key'
|
|
24
|
+
client = BlockScore::Client.new('your-api-key')
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
To see the list of calls you can make, please visit out [full Ruby API reference](http://docs.blockscore.com/ruby).
|
|
27
|
+
To see the list of calls you can make, please visit out [full Ruby API reference](http://docs.blockscore.com/4.0/ruby).
|
|
28
28
|
|
|
29
29
|
## Exceptions and Errors
|
|
30
30
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4.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 4.0.0 ruby lib
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
8
|
s.name = "blockscore"
|
|
9
|
-
s.version = "
|
|
9
|
+
s.version = "4.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-11-17"
|
|
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 = [
|
|
@@ -28,8 +28,9 @@ Gem::Specification.new do |s|
|
|
|
28
28
|
"blockscore-ruby.sublime-project",
|
|
29
29
|
"blockscore.gemspec",
|
|
30
30
|
"lib/blockscore.rb",
|
|
31
|
+
"lib/blockscore/candidates.rb",
|
|
31
32
|
"lib/blockscore/client.rb",
|
|
32
|
-
"lib/blockscore/
|
|
33
|
+
"lib/blockscore/companies.rb",
|
|
33
34
|
"lib/blockscore/error/authorization_error.rb",
|
|
34
35
|
"lib/blockscore/error/blockscore_error.rb",
|
|
35
36
|
"lib/blockscore/error/error_handler.rb",
|
|
@@ -38,10 +39,9 @@ Gem::Specification.new do |s|
|
|
|
38
39
|
"lib/blockscore/error/parameter_error.rb",
|
|
39
40
|
"lib/blockscore/error/validation_error.rb",
|
|
40
41
|
"lib/blockscore/errors.rb",
|
|
41
|
-
"lib/blockscore/
|
|
42
|
-
"lib/blockscore/
|
|
43
|
-
"lib/blockscore/
|
|
44
|
-
"lib/blockscore/watchlist_candidate.rb",
|
|
42
|
+
"lib/blockscore/people.rb",
|
|
43
|
+
"lib/blockscore/question_sets.rb",
|
|
44
|
+
"lib/blockscore/watchlists.rb",
|
|
45
45
|
"test/helper.rb",
|
|
46
46
|
"test/test_blockscore.rb"
|
|
47
47
|
]
|
|
@@ -55,26 +55,32 @@ Gem::Specification.new do |s|
|
|
|
55
55
|
|
|
56
56
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
57
57
|
s.add_runtime_dependency(%q<httparty>, ["~> 0.11"])
|
|
58
|
-
s.add_development_dependency(%q<shoulda>, ["~> 3.
|
|
58
|
+
s.add_development_dependency(%q<shoulda>, ["~> 3.5.0"])
|
|
59
59
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
|
60
60
|
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
|
61
61
|
s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
|
|
62
62
|
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
|
63
|
+
s.add_development_dependency(%q<minitest>, ["~> 4.0"])
|
|
64
|
+
s.add_development_dependency(%q<shoulda-context>, ["~> 1.2"])
|
|
63
65
|
else
|
|
64
66
|
s.add_dependency(%q<httparty>, ["~> 0.11"])
|
|
65
|
-
s.add_dependency(%q<shoulda>, ["~> 3.
|
|
67
|
+
s.add_dependency(%q<shoulda>, ["~> 3.5.0"])
|
|
66
68
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
|
67
69
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
|
68
70
|
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
|
69
71
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
|
72
|
+
s.add_dependency(%q<minitest>, ["~> 4.0"])
|
|
73
|
+
s.add_dependency(%q<shoulda-context>, ["~> 1.2"])
|
|
70
74
|
end
|
|
71
75
|
else
|
|
72
76
|
s.add_dependency(%q<httparty>, ["~> 0.11"])
|
|
73
|
-
s.add_dependency(%q<shoulda>, ["~> 3.
|
|
77
|
+
s.add_dependency(%q<shoulda>, ["~> 3.5.0"])
|
|
74
78
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
|
75
79
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
|
76
80
|
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
|
77
81
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
|
82
|
+
s.add_dependency(%q<minitest>, ["~> 4.0"])
|
|
83
|
+
s.add_dependency(%q<shoulda-context>, ["~> 1.2"])
|
|
78
84
|
end
|
|
79
85
|
end
|
|
80
86
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module BlockScore
|
|
2
|
+
class Candidates
|
|
3
|
+
PATH = '/candidates'
|
|
4
|
+
|
|
5
|
+
def initialize(client)
|
|
6
|
+
@client = client
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# POST https://api.blockscore.com/candidates
|
|
10
|
+
def create(options = {})
|
|
11
|
+
response = @client.post PATH, options
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# PATCH https://api.blockscore.com/candidates/{CANDIDATE_ID}
|
|
15
|
+
def edit(candidate_id, options = {})
|
|
16
|
+
response = @client.put "#{PATH}/#{candidate_id}", options
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# DELETE https://api.blockscore.com/candidates/{CANDIDATE_ID}
|
|
20
|
+
def delete(candidate_id)
|
|
21
|
+
response = @client.delete "#{PATH}/#{candidate_id}"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# GET https://api.blockscore.com/candidates/{CANDIDATE_ID}
|
|
25
|
+
def retrieve(candidate_id)
|
|
26
|
+
response = @client.get "#{PATH}/#{candidate_id}"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# GET https://api.blockscore.com/candidates
|
|
30
|
+
def all(count = nil, offset = nil, options = {})
|
|
31
|
+
body = (options.include? :body) ? options[:body] : {}
|
|
32
|
+
|
|
33
|
+
body[:count] = count
|
|
34
|
+
body[:offset] = offset
|
|
35
|
+
|
|
36
|
+
@client.get PATH, body
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# GET https://api.blockscore.com/candidates/:id/history
|
|
40
|
+
def history(candidate_id)
|
|
41
|
+
response = @client.get "#{PATH}/#{candidate_id}/history"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# GET https://api.blockscore.com/candidates/:id/hits
|
|
45
|
+
def hits(candidate_id)
|
|
46
|
+
response = @client.get "#{PATH}/#{candidate_id}/hits"
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
data/lib/blockscore/client.rb
CHANGED
|
@@ -2,20 +2,23 @@ module BlockScore
|
|
|
2
2
|
class Client
|
|
3
3
|
include HTTParty
|
|
4
4
|
|
|
5
|
-
attr_reader :
|
|
5
|
+
attr_reader :people, :question_sets, :companies, :candidates, :watchlists
|
|
6
6
|
|
|
7
|
-
def initialize(api_key,
|
|
7
|
+
def initialize(api_key, options = {})
|
|
8
8
|
@api_key = api_key
|
|
9
9
|
@auth = { :username => @api_key, :password => "" }
|
|
10
|
-
@
|
|
11
|
-
@
|
|
12
|
-
@
|
|
13
|
-
@
|
|
14
|
-
@
|
|
10
|
+
@people = BlockScore::People.new(self)
|
|
11
|
+
@question_sets = BlockScore::QuestionSets.new(self)
|
|
12
|
+
@companies = BlockScore::Companies.new(self)
|
|
13
|
+
@candidates = BlockScore::Candidates.new(self)
|
|
14
|
+
@watchlists = BlockScore::Watchlists.new(self)
|
|
15
15
|
@error_handler = BlockScore::ErrorHandler.new
|
|
16
16
|
|
|
17
17
|
options[:base_uri] ||= "https://api.blockscore.com"
|
|
18
|
-
options[:headers] = {
|
|
18
|
+
options[:headers] = {
|
|
19
|
+
'Accept' => 'application/vnd.blockscore+json;version=4',
|
|
20
|
+
'User-Agent' => 'blockscore-ruby/4.0.0 (https://github.com/BlockScore/blockscore-ruby)'
|
|
21
|
+
}
|
|
19
22
|
|
|
20
23
|
options.each do |k,v|
|
|
21
24
|
self.class.send k, v
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
module BlockScore
|
|
2
|
-
class
|
|
2
|
+
class Companies
|
|
3
|
+
PATH = '/companies'
|
|
3
4
|
|
|
4
5
|
def initialize(client)
|
|
5
6
|
@client = client
|
|
@@ -9,7 +10,7 @@ module BlockScore
|
|
|
9
10
|
# /companies POST
|
|
10
11
|
#
|
|
11
12
|
def create(options = {})
|
|
12
|
-
response = @client.post
|
|
13
|
+
response = @client.post PATH, options
|
|
13
14
|
end
|
|
14
15
|
|
|
15
16
|
#
|
|
@@ -17,7 +18,7 @@ module BlockScore
|
|
|
17
18
|
#
|
|
18
19
|
def retrieve(id, options = {})
|
|
19
20
|
body = (options.include? :query) ? options[:body] : {}
|
|
20
|
-
response = @client.get "
|
|
21
|
+
response = @client.get "#{PATH}/#{id.to_s}", body
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
#
|
|
@@ -29,7 +30,7 @@ module BlockScore
|
|
|
29
30
|
body[:count] = count
|
|
30
31
|
body[:offset] = offset
|
|
31
32
|
|
|
32
|
-
@client.get
|
|
33
|
+
@client.get PATH, body
|
|
33
34
|
end
|
|
34
35
|
end
|
|
35
36
|
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module BlockScore
|
|
2
|
+
class People
|
|
3
|
+
PATH = '/people'
|
|
4
|
+
|
|
5
|
+
def initialize(client)
|
|
6
|
+
@client = client
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
#
|
|
10
|
+
# /people POST
|
|
11
|
+
#
|
|
12
|
+
def create(options = {})
|
|
13
|
+
response = @client.post PATH, options
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
#
|
|
17
|
+
# /people/:id GET
|
|
18
|
+
#
|
|
19
|
+
# id - ID of the person to retrieve.
|
|
20
|
+
def retrieve(id, options = {})
|
|
21
|
+
body = (options.include? :query) ? options[:body] : {}
|
|
22
|
+
response = @client.get "#{PATH}/#{id.to_s}", body
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
#
|
|
26
|
+
# '/people' GET
|
|
27
|
+
#
|
|
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 PATH, body
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module BlockScore
|
|
2
|
+
class QuestionSets
|
|
3
|
+
PATH = '/question_sets'
|
|
4
|
+
|
|
5
|
+
def initialize(client)
|
|
6
|
+
@client = client
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def create(person_id, options = {})
|
|
10
|
+
body = (options.include? :body) ? options[:body] : {}
|
|
11
|
+
body[:person_id] = person_id
|
|
12
|
+
|
|
13
|
+
response = @client.post PATH, body
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
#
|
|
17
|
+
# '/question_sets/:id/score' POST
|
|
18
|
+
#
|
|
19
|
+
# answers -
|
|
20
|
+
def score(id, answers)
|
|
21
|
+
body = {}
|
|
22
|
+
body[:answers] = answers
|
|
23
|
+
|
|
24
|
+
response = @client.post "#{PATH}/#{id.to_s}/score", body
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
#
|
|
28
|
+
# /question_sets/:id GET
|
|
29
|
+
#
|
|
30
|
+
# id -
|
|
31
|
+
def retrieve(id)
|
|
32
|
+
body = Hash.new
|
|
33
|
+
|
|
34
|
+
response = @client.get "#{PATH}/#{id.to_s}", body
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
#
|
|
38
|
+
# '/question_sets' GET
|
|
39
|
+
#
|
|
40
|
+
def all(count = nil, offset = nil, options = {})
|
|
41
|
+
body = (options.include? :body) ? options[:body] : {}
|
|
42
|
+
|
|
43
|
+
body[:count] = count
|
|
44
|
+
body[:offset] = offset
|
|
45
|
+
|
|
46
|
+
@client.get PATH, body
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
module BlockScore
|
|
2
|
-
class
|
|
2
|
+
class Watchlists
|
|
3
|
+
PATH = '/watchlists'
|
|
4
|
+
|
|
3
5
|
def initialize(client)
|
|
4
6
|
@client = client
|
|
5
7
|
end
|
|
8
|
+
|
|
6
9
|
# POST https://api.blockscore.com/watchlists
|
|
7
|
-
def search(
|
|
10
|
+
def search(candidate_id, match_type = nil)
|
|
8
11
|
body = {}
|
|
9
|
-
body[:
|
|
12
|
+
body[:candidate_id] = candidate_id
|
|
10
13
|
body[:match_type] = match_type
|
|
11
14
|
|
|
12
|
-
@client.post
|
|
15
|
+
@client.post PATH, body
|
|
13
16
|
end
|
|
14
17
|
end
|
|
15
18
|
end
|
data/test/helper.rb
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
require 'simplecov'
|
|
2
|
+
require 'minitest/autorun'
|
|
3
|
+
require 'shoulda'
|
|
4
|
+
# require 'shoulda_context'
|
|
2
5
|
|
|
3
6
|
module SimpleCov::Configuration
|
|
4
7
|
def clean_filters
|
|
@@ -31,4 +34,4 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
|
31
34
|
require 'blockscore'
|
|
32
35
|
|
|
33
36
|
class Test::Unit::TestCase
|
|
34
|
-
end
|
|
37
|
+
end
|
data/test/test_blockscore.rb
CHANGED
|
@@ -2,26 +2,25 @@ 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
|
|
6
|
-
@version = 3
|
|
5
|
+
# a person ID, a question set ID, a company ID, and a candidate ID below.
|
|
7
6
|
@api_key = ""
|
|
8
7
|
|
|
9
|
-
@@
|
|
8
|
+
@@person_id = ""
|
|
10
9
|
@@question_set_id = ""
|
|
11
10
|
@@company_id = ""
|
|
12
|
-
@@
|
|
11
|
+
@@candidate_id = ""
|
|
13
12
|
|
|
14
|
-
@@client = BlockScore::Client.new(@api_key
|
|
13
|
+
@@client = BlockScore::Client.new(@api_key)
|
|
15
14
|
|
|
16
15
|
context "a watchlist" do
|
|
17
16
|
should "return search watchlists" do
|
|
18
|
-
response = @@client.
|
|
17
|
+
response = @@client.watchlists.search(@@candidate_id)
|
|
19
18
|
assert_equal 200, response.code
|
|
20
19
|
end
|
|
21
20
|
end
|
|
22
21
|
|
|
23
|
-
context "a
|
|
24
|
-
should "return create a
|
|
22
|
+
context "a candidate" do
|
|
23
|
+
should "return create a candidate" do
|
|
25
24
|
watchlist_params = {
|
|
26
25
|
:note => "12341234",
|
|
27
26
|
:ssn => "0001",
|
|
@@ -33,41 +32,41 @@ class TestBlockScore < Test::Unit::TestCase
|
|
|
33
32
|
:address_city => "Cupertino",
|
|
34
33
|
:address_country_code => "US"
|
|
35
34
|
}
|
|
36
|
-
response = @@client.
|
|
35
|
+
response = @@client.candidates.create(watchlist_params)
|
|
37
36
|
assert_equal 201, response.code
|
|
38
37
|
end
|
|
39
38
|
|
|
40
|
-
should "return edit a
|
|
39
|
+
should "return edit a candidate" do
|
|
41
40
|
watchlist_params = {
|
|
42
41
|
:date_of_birth => "1945-05-08",
|
|
43
42
|
:name_middle => "Jones"
|
|
44
43
|
}
|
|
45
|
-
response = @@client.
|
|
44
|
+
response = @@client.candidates.edit(@@candidate_id, watchlist_params)
|
|
46
45
|
assert_equal 200, response.code
|
|
47
46
|
end
|
|
48
47
|
|
|
49
|
-
should "return retrieve a
|
|
50
|
-
response = @@client.
|
|
48
|
+
should "return retrieve a candidate" do
|
|
49
|
+
response = @@client.candidates.retrieve(@@candidate_id)
|
|
51
50
|
assert_equal 200, response.code
|
|
52
51
|
end
|
|
53
52
|
|
|
54
|
-
should "return a list of
|
|
55
|
-
response = @@client.
|
|
53
|
+
should "return a list of candidates" do
|
|
54
|
+
response = @@client.candidates.all
|
|
56
55
|
assert_equal 200, response.code
|
|
57
56
|
end
|
|
58
57
|
|
|
59
|
-
should "return a history of a
|
|
60
|
-
response = @@client.
|
|
58
|
+
should "return a history of a candidate" do
|
|
59
|
+
response = @@client.candidates.history(@@candidate_id)
|
|
61
60
|
assert_equal 200, response.code
|
|
62
61
|
end
|
|
63
62
|
|
|
64
|
-
should "return the hits of a
|
|
65
|
-
response = @@client.
|
|
63
|
+
should "return the hits of a candidate" do
|
|
64
|
+
response = @@client.candidates.hits(@@candidate_id)
|
|
66
65
|
assert_equal 200, response.code
|
|
67
66
|
end
|
|
68
67
|
|
|
69
|
-
should "return delete a
|
|
70
|
-
response = @@client.
|
|
68
|
+
should "return delete a candidate" do
|
|
69
|
+
response = @@client.candidates.delete(@@candidate_id)
|
|
71
70
|
assert_equal 200, response.code
|
|
72
71
|
end
|
|
73
72
|
|
|
@@ -75,22 +74,22 @@ class TestBlockScore < Test::Unit::TestCase
|
|
|
75
74
|
|
|
76
75
|
context "a company" do
|
|
77
76
|
should "return a list of companies" do
|
|
78
|
-
response = @@client.
|
|
77
|
+
response = @@client.companies.all
|
|
79
78
|
assert_equal 200, response.code
|
|
80
79
|
end
|
|
81
80
|
|
|
82
81
|
should "return count = 2 companies" do
|
|
83
|
-
response = @@client.
|
|
82
|
+
response = @@client.companies.all(count = 2)
|
|
84
83
|
assert_equal 200, response.code
|
|
85
84
|
end
|
|
86
85
|
|
|
87
86
|
should "return count=2 offset=2 companies" do
|
|
88
|
-
response = @@client.
|
|
87
|
+
response = @@client.companies.all(count = 2, offset = 2)
|
|
89
88
|
assert_equal 200, response.code
|
|
90
89
|
end
|
|
91
90
|
|
|
92
91
|
should "return a single company" do
|
|
93
|
-
response = @@client.
|
|
92
|
+
response = @@client.companies.retrieve(@@company_id)
|
|
94
93
|
assert_equal 200, response.code
|
|
95
94
|
end
|
|
96
95
|
|
|
@@ -98,75 +97,72 @@ class TestBlockScore < Test::Unit::TestCase
|
|
|
98
97
|
company_params = {
|
|
99
98
|
:entity_name => "BlockScore",
|
|
100
99
|
:tax_id => "123410000",
|
|
101
|
-
:
|
|
102
|
-
:
|
|
103
|
-
:
|
|
104
|
-
:
|
|
100
|
+
:incorporation_day => 25,
|
|
101
|
+
:incorporation_month => 8,
|
|
102
|
+
:incorporation_year => 1980,
|
|
103
|
+
:incorporation_state => "DE",
|
|
104
|
+
:incorporation_country_code => "US",
|
|
105
|
+
:incorporation_type => "corporation",
|
|
105
106
|
:dbas => "BitRemit",
|
|
106
107
|
:registration_number => "123123123",
|
|
107
108
|
:email => "test@example.com",
|
|
108
109
|
:url => "https://blockscore.com",
|
|
109
110
|
:phone_number => "6505555555",
|
|
110
111
|
:ip_address => "67.160.8.182",
|
|
111
|
-
:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
:country_code => "US"
|
|
118
|
-
}
|
|
112
|
+
:address_street1 => "1 Infinite Loop",
|
|
113
|
+
:address_street2 => nil,
|
|
114
|
+
:address_city => "Cupertino",
|
|
115
|
+
:address_subdivision => "CA",
|
|
116
|
+
:address_postal_code => "95014",
|
|
117
|
+
:address_country_code => "US"
|
|
119
118
|
}
|
|
120
119
|
|
|
121
|
-
response = @@client.
|
|
120
|
+
response = @@client.companies.create(company_params)
|
|
122
121
|
|
|
123
122
|
assert_equal 201, response.code
|
|
124
123
|
end
|
|
125
124
|
end
|
|
126
125
|
|
|
127
|
-
context "a
|
|
128
|
-
should "return a list of
|
|
129
|
-
response = @@client.
|
|
126
|
+
context "a person" do
|
|
127
|
+
should "return a list of people" do
|
|
128
|
+
response = @@client.people.all
|
|
130
129
|
assert_equal 200, response.code
|
|
131
130
|
end
|
|
132
131
|
|
|
133
|
-
should "return count = 2
|
|
134
|
-
response = @@client.
|
|
132
|
+
should "return count = 2 people" do
|
|
133
|
+
response = @@client.people.all(count = 2)
|
|
135
134
|
assert_equal 200, response.code
|
|
136
135
|
end
|
|
137
136
|
|
|
138
|
-
should "return count=2 offset=2
|
|
139
|
-
response = @@client.
|
|
137
|
+
should "return count=2 offset=2 people" do
|
|
138
|
+
response = @@client.people.all(count = 2, offset = 2)
|
|
140
139
|
assert_equal 200, response.code
|
|
141
140
|
end
|
|
142
141
|
|
|
143
|
-
should "return a single
|
|
144
|
-
response = @@client.
|
|
142
|
+
should "return a single person" do
|
|
143
|
+
response = @@client.people.retrieve(@@person_id)
|
|
145
144
|
assert_equal 200, response.code
|
|
146
145
|
end
|
|
147
146
|
|
|
148
|
-
should "return create a
|
|
149
|
-
|
|
150
|
-
:
|
|
151
|
-
:
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
:
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
:postal_code => "95014",
|
|
165
|
-
:country_code => "US"
|
|
166
|
-
}
|
|
147
|
+
should "return create a person" do
|
|
148
|
+
people_params = {
|
|
149
|
+
:birth_day => 1,
|
|
150
|
+
:birth_month => 1,
|
|
151
|
+
:birth_year => 1975,
|
|
152
|
+
:document_type => "ssn",
|
|
153
|
+
:document_value => "0000",
|
|
154
|
+
:name_first => "John",
|
|
155
|
+
:name_middle => "P",
|
|
156
|
+
:name_last => "Doe",
|
|
157
|
+
:address_street1 => "1 Infinite Loop",
|
|
158
|
+
:address_street2 => nil,
|
|
159
|
+
:address_city => "Cupertino",
|
|
160
|
+
:address_subdivision => "CA",
|
|
161
|
+
:address_postal_code => "95014",
|
|
162
|
+
:address_country_code => "US"
|
|
167
163
|
}
|
|
168
164
|
|
|
169
|
-
response = @@client.
|
|
165
|
+
response = @@client.people.create(people_params)
|
|
170
166
|
|
|
171
167
|
assert_equal 201, response.code
|
|
172
168
|
end
|
|
@@ -174,27 +170,27 @@ class TestBlockScore < Test::Unit::TestCase
|
|
|
174
170
|
|
|
175
171
|
context "a question set" do
|
|
176
172
|
should "return create a question set" do
|
|
177
|
-
response = @@client.
|
|
173
|
+
response = @@client.question_sets.create(@@person_id)
|
|
178
174
|
assert_equal 201, response.code
|
|
179
175
|
end
|
|
180
176
|
|
|
181
177
|
should "return a single question set" do
|
|
182
|
-
response = @@client.
|
|
178
|
+
response = @@client.question_sets.retrieve(@@question_set_id)
|
|
183
179
|
assert_equal 200, response.code
|
|
184
180
|
end
|
|
185
181
|
|
|
186
182
|
should "return a list of question sets" do
|
|
187
|
-
response = @@client.
|
|
183
|
+
response = @@client.question_sets.all
|
|
188
184
|
assert_equal 200, response.code
|
|
189
185
|
end
|
|
190
186
|
|
|
191
187
|
should "return count = 2" do
|
|
192
|
-
response = @@client.
|
|
188
|
+
response = @@client.question_sets.all(count = 2)
|
|
193
189
|
assert_equal 200, response.code
|
|
194
190
|
end
|
|
195
191
|
|
|
196
192
|
should "return count = 2 offset = 2" do
|
|
197
|
-
response = @@client.
|
|
193
|
+
response = @@client.question_sets.all(count = 2, offset = 2)
|
|
198
194
|
assert_equal 200, response.code
|
|
199
195
|
end
|
|
200
196
|
|
|
@@ -222,7 +218,7 @@ class TestBlockScore < Test::Unit::TestCase
|
|
|
222
218
|
}
|
|
223
219
|
]
|
|
224
220
|
|
|
225
|
-
response = @@client.
|
|
221
|
+
response = @@client.question_sets.score(@@question_set_id, @answers)
|
|
226
222
|
|
|
227
223
|
assert_equal 201, response.code
|
|
228
224
|
end
|
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: 4.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-11-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httparty
|
|
@@ -30,14 +30,14 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 3.
|
|
33
|
+
version: 3.5.0
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 3.
|
|
40
|
+
version: 3.5.0
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rdoc
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -94,6 +94,34 @@ dependencies:
|
|
|
94
94
|
- - ">="
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
96
|
version: '0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: minitest
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - "~>"
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '4.0'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - "~>"
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '4.0'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: shoulda-context
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - "~>"
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '1.2'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - "~>"
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '1.2'
|
|
97
125
|
description: A ruby client library for the BlockScore API.
|
|
98
126
|
email: alain@blockscore.com
|
|
99
127
|
executables: []
|
|
@@ -111,8 +139,9 @@ files:
|
|
|
111
139
|
- blockscore-ruby.sublime-project
|
|
112
140
|
- blockscore.gemspec
|
|
113
141
|
- lib/blockscore.rb
|
|
142
|
+
- lib/blockscore/candidates.rb
|
|
114
143
|
- lib/blockscore/client.rb
|
|
115
|
-
- lib/blockscore/
|
|
144
|
+
- lib/blockscore/companies.rb
|
|
116
145
|
- lib/blockscore/error/authorization_error.rb
|
|
117
146
|
- lib/blockscore/error/blockscore_error.rb
|
|
118
147
|
- lib/blockscore/error/error_handler.rb
|
|
@@ -121,10 +150,9 @@ files:
|
|
|
121
150
|
- lib/blockscore/error/parameter_error.rb
|
|
122
151
|
- lib/blockscore/error/validation_error.rb
|
|
123
152
|
- lib/blockscore/errors.rb
|
|
124
|
-
- lib/blockscore/
|
|
125
|
-
- lib/blockscore/
|
|
126
|
-
- lib/blockscore/
|
|
127
|
-
- lib/blockscore/watchlist_candidate.rb
|
|
153
|
+
- lib/blockscore/people.rb
|
|
154
|
+
- lib/blockscore/question_sets.rb
|
|
155
|
+
- lib/blockscore/watchlists.rb
|
|
128
156
|
- test/helper.rb
|
|
129
157
|
- test/test_blockscore.rb
|
|
130
158
|
homepage: http://github.com/blockscore/blockscore-ruby
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
module BlockScore
|
|
2
|
-
class QuestionSet
|
|
3
|
-
|
|
4
|
-
def initialize(client)
|
|
5
|
-
@client = client
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def create(verification_id, options = {})
|
|
9
|
-
body = (options.include? :body) ? options[:body] : {}
|
|
10
|
-
body[:verification_id] = verification_id
|
|
11
|
-
|
|
12
|
-
response = @client.post '/questions', body
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
#
|
|
16
|
-
# '/questions/:id/score' POST
|
|
17
|
-
#
|
|
18
|
-
# answers -
|
|
19
|
-
def score(id, answers)
|
|
20
|
-
body = {}
|
|
21
|
-
body[:answers] = answers
|
|
22
|
-
|
|
23
|
-
response = @client.post "/questions/#{id.to_s}/score", body
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
#
|
|
27
|
-
# /questions/:id GET
|
|
28
|
-
#
|
|
29
|
-
# question_set_id -
|
|
30
|
-
# verification_id -
|
|
31
|
-
def retrieve(id)
|
|
32
|
-
body = Hash.new
|
|
33
|
-
|
|
34
|
-
response = @client.get "/questions/#{id.to_s}", body
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
#
|
|
38
|
-
# '/questions' GET
|
|
39
|
-
#
|
|
40
|
-
def all(count = nil, offset = nil, options = {})
|
|
41
|
-
body = (options.include? :body) ? options[:body] : {}
|
|
42
|
-
|
|
43
|
-
body[:count] = count
|
|
44
|
-
body[:offset] = offset
|
|
45
|
-
|
|
46
|
-
@client.get '/questions', body
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
module BlockScore
|
|
2
|
-
class Verification
|
|
3
|
-
|
|
4
|
-
def initialize(client)
|
|
5
|
-
@client = client
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
#
|
|
9
|
-
# /verifications POST
|
|
10
|
-
#
|
|
11
|
-
def create(options = {})
|
|
12
|
-
response = @client.post '/verifications', options
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
#
|
|
16
|
-
# /verifications/:id GET
|
|
17
|
-
#
|
|
18
|
-
# id -
|
|
19
|
-
def retrieve(id, options = {})
|
|
20
|
-
body = (options.include? :query) ? options[:body] : {}
|
|
21
|
-
response = @client.get "/verifications/#{id.to_s}", body
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
#
|
|
25
|
-
# '/verifications' GET
|
|
26
|
-
#
|
|
27
|
-
def all(count = nil, offset = nil, options = {})
|
|
28
|
-
body = (options.include? :body) ? options[:body] : {}
|
|
29
|
-
|
|
30
|
-
body[:count] = count
|
|
31
|
-
body[:offset] = offset
|
|
32
|
-
|
|
33
|
-
@client.get '/verifications', body
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
@@ -1,47 +0,0 @@
|
|
|
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
|