Sha256: 21416da496400a1d8ce6ece9f48d1a8a43330e9478d1ceb9cebe54aa1815ac3c
Contents?: true
Size: 1.67 KB
Versions: 3
Compression:
Stored size: 1.67 KB
Contents
# PureCloud Ruby Gem [![Gem Version](https://badge.fury.io/rb/purecloud.svg)](https://badge.fury.io/rb/purecloud) ## Installing ~~~ gem install PureCloud ~~~ ## Usage Start by setting the access token in the configuration ~~~ PureCloud.configure do |config| config.access_token = '7oSpBrJ1w2mIf2kDVNJxR3BLzdxsD3hC7hTdG4A8cR50tpcSuxh74SuL4rk_WNqtwkRt2f004eVgXMCVFo84VQ' config.host = 'api.mypurecloud.com' end ~~~ Specifying the host is optional, it will default to api.mypurecloud.com. This gem contains a number of Api classes e.g. UsersApi, ConfigurationApi. Create an instance of the API you want to use and then you can make calls into the API ~~~ user_api = PureCloud::UsersApi.new me = user_api.users_me_get ~~~ ### Full Example Using Client Credentials Auth ~~~ require_relative 'lib/purecloud' require 'rest_client' require 'json' require "base64" secret = ENV['purecloud_secret'] id = ENV['purecloud_client_id'] PureCloud.authenticate_with_client_credentials id, secret, "mypurecloud.com" auth_api = PureCloud::AuthorizationApi.new roles = auth_api.get_roles puts roles.to_body ~~~ ### Creating an OAuth client ~~~ oauth_api = PureCloud::OAuthApi.new opts = { #pass a hash into the constructor, these are the same properties that you can find in the rest documentation, not the properties on the OAuthClient object. :body=>PureCloud::OAuthClient.new({ :name => 'Demo Client', :description => "", :authorizedGrantTypes => ["CLIENT-CREDENTIALS"], :roleIds =>["02983623-600c-4779-a0ce-17f79e50e285"] }) } client = oauth_api.create_clients opts ~~~ For more examples, see the tests in the /tests directory ### Contributing
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
purecloud-0.0.0 | README.md |
purecloud-0.18.0 | README.md |
purecloud-0.17.0 | README.md |