Sha256: f9b944b8e49322548dd44f6d3933ca1303afd8d5bb577f02123b777fe792079c

Contents?: true

Size: 1.58 KB

Versions: 2

Compression:

Stored size: 1.58 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 'purecloud'

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
purecloud-0.27.0 README.md
purecloud-0.26.0 README.md