Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 35 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,49 +19,66 @@ import blockscore
client = blockscore.Client({'api_key':'Your API Key'})
```

## Verifications
### List all verifications
## People

### List all people

```python
verification_list = client.verification.all()
verification_list = verification_list.body
people_list = client.people.all()
people_list = people_list.body
```

### List `5` verifications
### List `5` people

```python
verification_list = client.verification.all(count=5)
verification_list = verification_list.body
people_list = client.people.all(count=5)
people_list = people_list.body
```
### View a verification by ID

### View a person by ID

```python
verification = client.verification.retrieve(verification_id)
verification = verification.body
person = client.people.retrieve(person_id)
person = person.body
```

### Create a new verification
### Create a new person

```python
verification = client.verification.create('1980-01-01',{'ssn': '0000'},{'first': 'john', 'last': 'doe'},{'street1': '1 Infinite Loop', 'city': 'Palo Alto', 'state': 'ca', 'postal_code': '94309', 'country_code': 'us'})
verification = verification.body
test_identity = {
"name_first": "John",
"name_middle": "Pearce",
"name_last": "Doe",
"birth_day": "23",
"birth_month": "8",
"birth_year": "1980",
"document_type": "ssn",
"document_value": "0000",
"address_street1": "1 Infinite Loop",
"address_street2": "Apt 6",
"address_city": "Cupertino",
"address_subdivision": "CA",
"address_postal_code": "95014",
"address_country_code": "US",
}

person = client.people.create(test_identity)
person = person.body
```

## Question Sets

### Create a new question set

```python
question_set = client.question_set.create(verification_id)
question_set = client.question_sets.create(person_id)
question_set = question_set.body
```

### Score a question set

```python
score = self.client.question_set.score(verif_id, qset_id, [
score = self.client.question_sets.score(qset_id, [
{'question_id':1, 'answer_id':1},
{'question_id':2, 'answer_id':1},
{'question_id':3, 'answer_id':1},
Expand Down Expand Up @@ -90,7 +107,7 @@ score = score.body


## Contributing to BlockScore

* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
* Fork the project.
Expand Down
5 changes: 3 additions & 2 deletions blockscore/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from .client import Client
api_key = None # use blockscore.api_key = 'your_api_key' after importing blockscore
from blockscore.client import Client
api_key = None # use blockscore.api_key = 'your_api_key' after importing blockscore

5 changes: 3 additions & 2 deletions blockscore/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Import all the classes into api module
from . import verification
from . import question_set
from blockscore.api import people
from blockscore.api import question_sets
from blockscore.api import companies
56 changes: 28 additions & 28 deletions blockscore/api/companies.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@

class Companies():

def __init__(self, client):
self.client = client

#
# '/companies' POST
#
def create(self, options = {}):
return self.client.post(COMPANIES_PATH, options)

#
# '/companies/:id' GET
#
def retrieve(self, id, options = {}):
body = options['query'] if 'query' in options else {}
return self.client.get('%s/%s' % (COMPANIES_PATH, str(id)), body)

#
# '/companies' GET
#
def all(self, count = None, offset = None, options = {}):
body = options['body'] if 'body' in options else {}

if count:
body['count'] = count
if offset:
body['offset'] = offset

return self.client.get(COMPANIES_PATH, body)
def __init__(self, client):
self.client = client

#
# '/companies' POST
#
def create(self, options = {}):
return self.client.post(COMPANIES_PATH, options)

#
# '/companies/:id' GET
#
def retrieve(self, id, options = {}):
body = options['query'] if 'query' in options else {}
return self.client.get('%s/%s' % (COMPANIES_PATH, str(id)), body)

#
# '/companies' GET
#
def all(self, count = None, offset = None, options = {}):
body = options['body'] if 'body' in options else {}

if count:
body['count'] = count
if offset:
body['offset'] = offset

return self.client.get(COMPANIES_PATH, body)

43 changes: 43 additions & 0 deletions blockscore/api/people.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Returns user api instance

PEOPLE_PATH = '/people'

class People():

def __init__(self, client):
self.client = client

#
# '/people' POST
#
# date_of_birth -
# identification -
# name -
# address -
def create(self, options = {}):
response = self.client.post(PEOPLE_PATH, options)
return response

#
# '/people/:id' GET
#
# id -
def retrieve(self, id, options = {}):
body = options['query'] if 'query' in options else {}
response = self.client.get('%s/%s' % (PEOPLE_PATH, str(id)), body)
return response

#
# '/people' GET
#
def all(self, count=None, offset=None, options = {}):
body = options['body'] if 'body' in options else {}

if count != None:
body['count'] = count
if offset != None:
body['offset'] = offset

response = self.client.get(PEOPLE_PATH, body)
return response

43 changes: 0 additions & 43 deletions blockscore/api/question_set.py

This file was deleted.

56 changes: 56 additions & 0 deletions blockscore/api/question_sets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

QUESTION_SET_PATH = '/question_sets'

class QuestionSets():

def __init__(self, client):
self.client = client

#
# '/question_sets' POST
#
# verification_id -
def create(self, person_id, options = {}):
body = options['body'] if 'body' in options else {}
body['person_id'] = person_id

response = self.client.post(QUESTION_SET_PATH, body)
return response

#
# '/question_sets/:id/:score' POST
#
# answers -
def score(self, id, answers):
body = {}
body['answers'] = answers

options = {}
options['request_type'] = 'json'

response = self.client.post('%s/%s/score' % (QUESTION_SET_PATH, str(id)), body, options)
return response

#
# '/question_sets/:id' GET
#
# id -
def retrieve(self, id):
body = {}
response = self.client.get('%s/%s' % (QUESTION_SET_PATH, str(id)), body)
return response

#
# '/question_sets' GET
#
def all(self, count=None, offset=None, options = {}):
body = options['body'] if 'body' in options else {}

if count:
body['count'] = count
if offset:
body['offset'] = offset

response = self.client.get(QUESTION_SET_PATH, body)
return response

50 changes: 0 additions & 50 deletions blockscore/api/verification.py

This file was deleted.

18 changes: 9 additions & 9 deletions blockscore/client.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from .http_client import HttpClient
from blockscore.http_client import HttpClient

# Assign all the api classes
from .api.verification import Verification
from .api.question_set import QuestionSet
from .api.companies import Companies
from blockscore.api.people import People
from blockscore.api.question_sets import QuestionSets
from blockscore.api.companies import Companies

class Client():

def __init__(self, auth = {}, options = {}):
self.http_client = HttpClient(auth, options)
self.verification = Verification(self.http_client)
self.question_set = QuestionSet(self.http_client)
self.companies = Companies(self.http_client)
def __init__(self, auth = {}, options = {}):
self.http_client = HttpClient(auth, options)
self.people = People(self.http_client)
self.question_sets = QuestionSets(self.http_client)
self.companies = Companies(self.http_client)

Loading