0.0
No commit activity in last 3 years
No release in over 3 years
A ruby SDK for Civic SIP integration
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.16
~> 0.8.22
~> 10.0
~> 3.0
~> 3.4
~> 0.9.16

Runtime

~> 0.16
= 2.1.0
 Project Readme

Civic SIP SDK

Build Status Coverage Status

Civic Secure Identity Platform (SIP) API client implemented in Ruby.

Geting Started

Dependencies

  • HTTParty for making HTTP requests
  • ruby-jwt for handling all the JWT encoding/decoding

Installing

Using Rubygems

gem install civic_sip_sdk

Using bundler

Add the following line in your Gemfile:

gem 'civic_sip_sdk'

then run bundle install

Usage

Exchange the JWT token for user data:

require 'civic_sip_sdk'

# appId - your Civic application id
# env - your Civic app environment, :dev or :prod (default)
# private key - your Civic private signing key
# secret - your Civic secret
client = CivicSIPSdk.new_client('appId', :env, 'private key', 'secret')
user_data = client.exchange_code(jwt_token: 'your token from Civic frontend JS lib')

Access user data items:

# Civic userId value
user_id = user_data.user_id
# get a list of all the user data items
data_items = user_data.data_items
# you can access all the attributes in each data item
an_item = data_items.first
label = an_item.label
value = an_item.value
is_valid = an_item.is_valid
is_owner = an_item.is_owner

Access user data item by label with keyword args syntax:

an_item = user_data.by_label(label: 'contact.personal.email')
label = an_item.label
value = an_item.value
is_valid = an_item.is_valid
is_owner = an_item.is_owner

Running tests

bundle exec rspec

License

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