RingCentral SDK for Ruby
Table of contents
- API Requests 1. Generic HTTP Requests 2. SMS and MMS Examples 3. Fax Examples
- Advanced Use Cases
- Supported Ruby Versions
- Change Log
A Ruby SDK for the RingCentral REST API.
Version 2.0.0 introduces the following backward breaking changes:
- SDK instantiation by moving to a block-based configuration
- Removal of
- Removal of
Full documentation and resources are available at:
For API information, see the official RingCentral resources:
Add 'ringcentral_sdk' to Gemfile and then run
$ echo "gem 'ringcentral_sdk'" >> Gemfile $ bundle
$ gem install ringcentral_sdk
require 'ringcentral_sdk' client = RingCentralSdk::REST::Client.new do |config| # App info (mandatory) config.app_key = 'myAppKey' config.app_secret = 'myAppSecret' config.server_url = RingCentralSdk::RC_SERVER_SANDBOX # User info for password grant (optional) config.username = 'myUsername' config.extension = 'myExtension' config.password = 'myPassword' # Set a custom logger (optional) config.logger = Logger.new(STDOUT) # Enable HTTP retries for 429, 503, and 504 errors # Set custom codes and retry after using retry_options config.retry = true end # Send SMS res = client.messages.sms.create( from: '+16505551212', to: '+14155551212', text: 'Hi there!' )
More information on the authorization code flow:
API requests can be made via the included
Faraday client or
RingCentralSdk::Helpers::Request subclasses. These are described below.
Generic HTTP Requests
To make generic API requests, use included
Faraday client which can be accessed via
client.http. The client automatically adds the correct access token to the HTTP request and handles OAuth token refresh using the
This is useful to access many API endpoints which do not have custom wrappers and for debugging purposes.
http = client.http
SMS and MMS Examples
client.messages.sms.create( from: '+16505551212', to: '+14155551212', text: 'Hi there!' )
MMS with media file:
client.messages.sms.create( from: '+16505551212', to: '+14155551212', text: 'Hi there!', media: '/filepath/to/file.ext' )
client.messages.fax.create( to: '+14155551212', coverPageText: 'Hi there!', files: ['/path/to/myfile.pdf'] )
client.messages.fax.create( to: '+14155551212', coverPageText: 'Hi there!', text: 'Hi there!' )
To make subscriptions with RingCentral, use the SDK object to create subscription Observer object and then add observers to it.
# Create an observer object class MyObserver def update(message) puts 'Subscription Message Received' puts JSON.dump(message) end end # Create an observable subscription and add your observer sub = client.create_subscription sub.add_observer MyObserver.new # Subscribe to an arbitrary number of event filters sub.subscribe ['/restapi/v1.0/account/~/extension/~/presence'] # End the subscription sub.destroy
Advanced Use Cases
Supported Ruby Versions
This library is tested against this list of Ruby implementations.
Releases with release notes are availabe on GitHub releases. Release notes include a high level description of the release as well as lists of non-breaking and breaking changes.
- Versions 1.0.0 and above follow semantic versioning. Breaking changes will be indicated by a change in major version.
- Versions below 1.0.0 are in active development. During initial development (Version 0.x.x), minor version changes will indicate either substantial feature inclusion or breaking changes.
RingCentral API Docs
RingCentral API Explorer
RingCentral Official SDKs
- Fork it ( http://github.com/grokify/ringcentral-sdk-ruby/fork )
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request
RingCentral SDK is available under an MIT-style license. See LICENSE.md for details.
RingCentral SDK © 2015-2017 by John Wang