Platform::Sdk

This gem is intended to provide clients and models for accessing the Platform APIs.

Ruby Gem

Installation

First configure your GitHub credentials

Install the gem and add to the application's Gemfile by executing:

gem "strongmind-platform-sdk", "~> 3.0.0"

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install strongmind-platform-sdk

Usage

TODO: Write usage instructions here

Configure GitHub credentials

  • Create a GitHub PAT (personal access token) with the following scopes: delete:packages, write:packages, repo

  • Edit (or create) a ~/.gem.credentials file to include the following, replacing TOKEN with your PAT from GitHub

    ---
    :github: Bearer TOKEN
    
  • Edit (or create) a ~/.gemrc file and add the following:

    —
    :backtrace: false
    :bulk_threshold: 1000
    :sources:
    - https://rubygems.org/
    - https://USERNAME:TOKEN@rubygems.pkg.github.com/StrongMind/
    :update_sources: true
    :verbose: true  
    
  • You will also need to configure your bundler to use your GitHub credentials: $ bundle config set —-global rubygems.pkg.github.com USERNAME:TOKEN

NOTE: If your username has an @ symbol, edit your ~/.bundle/config file and replace the @ with %40

---
BUNDLE_RUBYGEMS__PKG__GITHUB__COM: "USERNAME:TOKEN"

Build/Publish Gem

To publish the gem, update the version.rb file and push the update to the main branch. The github actions will publish the gem automatically.

If you would like to publish the gem from your local machine for development purposes, run the following commands:

gem build platform-sdk.gemspec
gem push --key github --host https://rubygems.pkg.github.com/StrongMind platform-sdk-0.0.0.gem

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 the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/StrongMind/platform-ruby-sdk. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Platform::Ruby::Sdk project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Setting up IRB for OneRoster Calls

Require needed dependencies: require 'platform_sdk'

Open IRB and initialize dependencies:

  • IDENTITY_CLIENT_ID
  • IDENTITY_CLIENT_SECRET
  • IDENTITY_BASE_URL
  • STRONGMIND_APP_BASE_URL
  • ONEROSTER_BASE_URL
  • ID_MAPPER_DOMAIN
  • ID_MAPPER_TOKEN

Create Identity Auth Client: auth_client = PlatformSdk::Identity::AuthClient.new(IDENTITY_BASE_URL, IDENTITY_CLIENT_ID, IDENTITY_CLIENT_SECRET)

Create OneRoster Client: one_roster_client = PlatformSdk::OneRoster::Client.new(ONEROSTER_BASE_URL, auth_client)

Create Aws Client: aws_client = PlatformSdk::Aws::SecretsManagerClient.new(access_key_id: 'ACCESS_KEY_ID', secret_access_key: 'SECRET_ACCESS_KEY', region: 'REGION')

Create PowerSchool Client: power_school_client = PlatformSdk::PowerSchool::Client.new(base_url: 'BASE_URL', bearer_token: 'BEARER_TOKEN')

Create IdMapper Client: id_mapper_client = PlatformSdk::IdMapper::Client.new(domain: 'ID_MAPPER_DOMAIN', token: 'SECRET_TOKEN')