CognitiveFaculty
A Ruby gem for accessing the Cognitive Faculty API.
Installation
Add this line to your application's Gemfile:
gem 'cognitive_faculty'
And then execute:
$ bundle
Or install it yourself as:
$ gem install cognitive_faculty
Usage
Your application must be configured in AppID (NOTE: Single-Page App's do not work because they don't provide you a secret).
To use this service, you will need to supply a client ID, secret, and oauth server URL. See below for implementation, or click here for more information on how to obtain AppID config info.
# example implementation
require 'cognitive_faculty'
CognitiveFaculty.configure do |c|
c.url = "https://platform.skills.network/api"
c.auth.client_id = "<AppID Client ID>"
c.auth.client_secret = "<AppID Secret>"
c.auth.oauth_server_url = "<AppID oauth Server URL>"
end
CognitiveFaculty::Offer.all.each do |o|
puts o.name
end
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Testing
Fill out the values in testy/main.rb
and then run ruby testy/main.rb
for an easy way to test the Platform API.