Unofficial Ruby client for the BlockScore Cognito API. This library was designed using a command-query separation principle.
Add this line to your application's Gemfile:
gem 'cognito-client'
And then execute:
$ bundle
In your code or in IRB you can include the library with:
require 'cognito/client'
client = Cognito::Client.create(
api_key: 'your-api-key',
api_secret: 'your-api-secret',
uri: 'https://sandbox.cognitohq.com',
api_version: '2016-09-01'
)
profile = client.create_profile
search = client.create_identity_search(
profile_id: profile.data.id,
phone_number: '+14151231234',
name: { # optional
first: 'Leslie',
last: 'Knope'
}
)
assessment = search.create_assessment(
phone_number: '+14151231234',
name: {
first: 'Leslie',
last: 'Doe'
}
)
The client automatically links the resource relationships allowing you to make calls like:
search.data.identity_records.first.names.map(&:attributes)
# [
# { :first=>"LESLIE", :middle=>"BARBARA", :last=>"KNOPE" },
# {:first=>"LESLIE", :middle=>nil, :last=>"KNOPE-WYATT" }
# ]
bundle exec rspec
bundle exec rake ci
The gem is available as open source under the terms of the MIT License.