CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.
TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Dec 2015 |
SPMSupports SPM | ✗ |
Maintained by Anil Kumar.
The RingCentral SDK is initiated in the following ways.
Sandbox:
var rcsdk = SDK(appKey: app_key, appSecret: app_secret, server: SDK.RC_SERVER_SANDBOX)
Production:
var rcsdk = SDK(appKey: app_key, appSecret: app_secret, server: SDK.RC_SERVER_PRODUCTION)
The 'app_key' and 'app_secret' should be read from a configuration file.
Depending on the stage of production, either
SDK.RC_SERVER_SANDBOX or SDK.RC_SERVER_PRODUCTION
will be used as the 'server' parameter.
To authorize the platform, extract the 'Platform' object:
var platform = rcsdk.platform()
Once the platform is extracted, call:
platform.login(username, password: password)
or (to authorize with extension):
platform.login(username, ext: ext, password: password)
The SDK will automatically refresh the token so long the refresh token lives.
Caution: If no extension is specified, platform automitically refers extension 101 (default).
Currently all requests can be made through the following:
platform.get('/account/~/extension/~')
platform.post('/account/~/extension/~', body: [])
platform.put('/account/~/extension/~', body: [])
platform.delete('/account/~/extension/~', query: [])
Attach the following code as a completion handler (always) :
{
(transaction) in
if (error) {
// do something for error
} else {
// continue with code
}
}
Returning 'data' into a Dictionary (JSON): This is handled by the ApiResponse class within the SDK. we can retrieve the dictionary as shown below
NSJSON Serialization handled by ApiResponse class :
NSJSONSerialization.JSONObjectWithData(data!, options: nil, error: &errors) as! NSDictionary
Retrieve the dictionary in your application as shown below :
transaction.getDict()
For readability of the data
println(transaction.getDict())
RingOut follows a two-legged style telecommunication protocol. The following method call is used to send a Ring Out.
platform.post("/account/~/extension/~/ringout", body :
[ "to": ["phoneNumber": "ToNumber"],
"from": ["phoneNumber": "FromNumber"],
"callerId": ["phoneNumber": "CallerId"],
"playPrompt": "true"
])
{
(completition handler)
}
The follow method call is used to send a SMS.
platform.post("/account/~/extension/~/sms", body :
[ "to": [["phoneNumber": "18315941779"]],
"from": ["phoneNumber": "15856234190"],
"text": "Test"
])
{
(completition handler)
}
Create a subscription using the createSubscription method
var subscription = rcsdk.createSubscription()
To add Events to the Subscription Object:
subscription.addEvents(
[
"/restapi/v1.0/account/~/extension/~/presence",
"/restapi/v1.0/account/~/extension/~/message-store"
])
Register a Subscription:
subscription.register()
{
(completition handler)
}
Please keep in mind that due to limitations of PUBNUB library, which is synchronous, subscriptions may expire and must be re-created manually.
Login page: Insert app_key, app_secret, username, password in order to log in. This is generally done through a configuration file.
Phone page: Use the number pad to type the numbers you need. The Status Bar (initially shown as a red rectangle 'No Call') changes color accordingly. Allows the sending of SMS and Fax, along with the ability to make calls.
Log page: Shows implementation of the 'Call Log' along with the 'Message Log'.