Skip to content

Commit

Permalink
Updating docs
Browse files Browse the repository at this point in the history
  • Loading branch information
byrnereese committed Sep 9, 2021
1 parent b2f3ec7 commit 7f2410b
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 5 deletions.
File renamed without changes.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ site
\.\#*
.env
__pycache__
code-samples/bin
code-samples/lib
code-samples/pyvenv.cfg
bin
lib
pyvenv.cfg
composer.*
vendor
52 changes: 51 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RingCentral's [Tutorials](https://ringcentral.github.io/tutorials/) index aggreg

If you would like to contribute to the RingCentral documentation effort, fork this repository, make your desired edits and contributions, and issue a pull request accordingly.

### Running the Developer Guide Locally
### Running the Developer Guide locally

The Developer Guide is built on top of Mkdocs, a self-contained documentation server. Writers are encourages to install Mkdocs locally so that you can edit files and preview your changes before they are pushed to production servers.

Expand All @@ -38,6 +38,56 @@ Then you should be able to load http://localhost:8000 to view the documentation.

Please be aware that the local version of the Developer Guide utilizes a Mkdocs theme that *mimics* our main documentation site, but it is not the same -- hence some of the visual differences you may observe. When the Developer Guide is published officially, mkdocs is used to generate HTML files, and those HTML files are then loaded into a different presentation framework.

## How to test and verify code samples

First, let's setup our python virtual environment within which the code checking framework will be run. We will do this from the root directory of `ringcentral-api-docs`. Then we will install the code checking framework within that virtual environment.

```
$ cd $GITHUB/ringcentral-api-docs
$ python3 -m venv .
$ source ./bin/activate
$ python3 -m pip install --upgrade pip
$ pip3 install mkdocs-codecheck
```

The code checking framework can be installed via pip ([mkdocs-codecheck](https://pypi.org/project/mkdocs-codecheck)), or the bleeding edge version can be downloaded and installed from [github](https://github.com/byrnereese/codechecker-mkdocs).

Next, you need to install all the various libraries and other prerequisites used within the code samples for all of the languages we support.

**For python code samples**
```
$ pip install ringcentral
$ pip install python-dotenv
```

**For PHP code samples**
```
$ php composer.phar require ringcentral/ringcentral-php
```

**For Java code samples**
```
$ // TODO
```

### Create a .env file

Create a `.env` file in the `code-samples` directory by copying and editing the provided template. This file will make reference to an app for which all permissions have been enabled. Embed that app's credentials in your `.env` in the appropriate fields.

```
$ cp code-samples/env-template code-samples/.env
```

### Run the testing framework

With all necessary software installed, you can now run the script. Run the script from the root directory of `ringcentral-api-docs` and be sure your python virtual environment is activated.

```
$ cd $GITHUB/ringcentral-api-docs
$ sh ./bin/activate
$ mkdocs-codecheck --verbose --recurse --dotenv ./code-samples/.env ./code-samples
```

## Tips for Styling Documentation

### View our styleguide
Expand Down
21 changes: 21 additions & 0 deletions code-samples/env-template
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# Create an app in the RingCentral Developer Console. Make sure the app has all permissions enabled.
# Enter in the credentials for this app into the fields below.
RC_SERVER_URL = 'https://platform.devtest.ringcentral.com'
RC_CLIENT_ID = ''
RC_CLIENT_SECRET = ''
RC_USERNAME = ''
RC_PASSWORD = ''
RC_EXTENSION = '101'

# Used in messaging/quick-start.py
# This following phone number will receive a test SMS message
RECIPIENT_PHONE = ""

# Used in pubnub quick start?
# The following URL cannot be blank, and its value will have no impact on test results.
RC_REDIRECT_URL = 'http://localhost:5000/oauth2callback'

# Used in voice/call-forwarding.py
# The following phone number will be set as a forwarding number.
RC_FORWARDING_NUMBER = ''
2 changes: 1 addition & 1 deletion code-samples/voice/call-routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
resp = platform.get('/account/~/extension/~/answering-rule', params)
for record in resp.json().records:
rule = platform.get('/account/~/extension/~/answering-rule/' + record.id)
print( f'Answering rule: {rule.name} is of type {rule.type}' )
print( f'Answering rule: {rule["name"]} is of type {rule.type}' )
except Exception as e:
sys.exit( e )
else:
Expand Down

0 comments on commit 7f2410b

Please sign in to comment.