ringcentral-sdk 0.9.4 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +20 -8
- data/lib/ringcentral.rb +14 -2
- data/lib/subscription.rb +2 -1
- data/ringcentral-sdk.gemspec +6 -6
- metadata +28 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1540372aa98b7028d885a28cc968a3348cf39c19611e2d86dbbcd67e115152bd
|
4
|
+
data.tar.gz: d6e4c9cbacec4d74422b2c692ac0f99e4213191e7ec47e43d5205776b1c60808
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: accae1e8fa5df89849746124c4f5f51587b7c9d67c4bf8498d5c726bbc541719a2b2117aa278535271cba3ddc0602b76827140a6a2bc25fec3a4fae1613eecef
|
7
|
+
data.tar.gz: ba5d969dabb7b891f2b22597097388e2c7a08dff9262dcd209be7bdbaa9da49c35ce18b48502fb982889c4a7a138128e79c9e2c6ecdcebbcccb41c9cc5ca8676
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# RingCentral SDK for Ruby
|
2
2
|
|
3
|
-
[![
|
4
|
-
[![Coverage Status](https://coveralls.io/repos/github/ringcentral/ringcentral-ruby/badge.svg?branch=master)](https://coveralls.io/github/ringcentral/ringcentral-ruby?branch=master)
|
5
|
-
[![Community](https://img.shields.io/badge/dynamic/json.svg?label=community&colorB=&suffix=%20users&query=$.approximate_people_count&uri=http%3A%2F%2Fapi.getsatisfaction.com%2Fcompanies%2F102909.json)](https://devcommunity.ringcentral.com/ringcentraldev)
|
3
|
+
[![Ruby](https://github.com/ringcentral/ringcentral-ruby/actions/workflows/ruby.yml/badge.svg)](https://github.com/ringcentral/ringcentral-ruby/actions/workflows/ruby.yml)
|
6
4
|
[![Twitter](https://img.shields.io/twitter/follow/ringcentraldevs.svg?style=social&label=follow)](https://twitter.com/RingCentralDevs)
|
7
5
|
|
8
6
|
__[RingCentral Developers](https://developer.ringcentral.com/api-products)__ is a cloud communications platform which can be accessed via more than 70 APIs. The platform's main capabilities include technologies that enable:
|
@@ -10,6 +8,12 @@ __[Voice](https://developer.ringcentral.com/api-products/voice), [SMS/MMS](https
|
|
10
8
|
|
11
9
|
[API Reference](https://developer.ringcentral.com/api-docs/latest/index.html) and [APIs Explorer](https://developer.ringcentral.com/api-explorer/latest/index.html).
|
12
10
|
|
11
|
+
|
12
|
+
## Getting help and support
|
13
|
+
|
14
|
+
If you are having difficulty using this SDK, or working with the RingCentral API, please visit our [developer community forums](https://community.ringcentral.com/spaces/144/) for help and to get quick answers to your questions. If you wish to contact the RingCentral Developer Support team directly, please [submit a help ticket](https://developers.ringcentral.com/support/create-case) from our developer website.
|
15
|
+
|
16
|
+
|
13
17
|
## Installation
|
14
18
|
|
15
19
|
```
|
@@ -19,11 +23,11 @@ gem install ringcentral-sdk
|
|
19
23
|
|
20
24
|
### Name collision with `ringcentral` gem
|
21
25
|
|
22
|
-
The ringcentral gem is using RingCentral's legacy API
|
26
|
+
The `ringcentral` gem is using RingCentral's legacy API which was End-of-Lifed in 2018. Everyone is recommended to move to the REST API.
|
23
27
|
|
24
|
-
If you have both the ringcentral and ringcentral-sdk gems installed, you will run into a collision error when attempting to initialize the ringcentral-sdk RingCentral SDK.
|
28
|
+
If you have both the `ringcentral` and `ringcentral-sdk` gems installed, you will run into a collision error when attempting to initialize the `ringcentral-sdk` RingCentral SDK.
|
25
29
|
|
26
|
-
|
30
|
+
The solution is `gem uninstall ringcentral`
|
27
31
|
|
28
32
|
|
29
33
|
## Documentation
|
@@ -57,12 +61,14 @@ rc.get('/restapi/v1.0/account/~/extension', { hello: 'world' })
|
|
57
61
|
### for post, put & patch
|
58
62
|
|
59
63
|
```ruby
|
60
|
-
rc.post('/restapi/v1.0/account/~/extension/~/sms', body, { hello: 'world' })
|
64
|
+
rc.post('/restapi/v1.0/account/~/extension/~/sms', payload: body, params: { hello: 'world' })
|
61
65
|
```
|
62
66
|
|
63
67
|
### multi-value query parameter
|
64
68
|
|
69
|
+
```ruby
|
65
70
|
rc.get('/restapi/v1.0/account/~/extension', { hello: ['world1', 'world2'] })
|
71
|
+
```
|
66
72
|
|
67
73
|
Above will be translated to `/restapi/v1.0/account/~/extension?hello=world1&hello=world2`.
|
68
74
|
|
@@ -79,7 +85,13 @@ Let's say you already have a token. Then you can load it like this: `rc.token =
|
|
79
85
|
|
80
86
|
The benifits of loading a preexisting token is you don't need to go through any authorization flow.
|
81
87
|
|
82
|
-
If what you have is a string instead of a Ruby object, you need to convert it first: `JSON.parse(your_token_string)`.
|
88
|
+
If what you have is a JSON string instead of a Ruby object, you need to convert it first: `JSON.parse(your_token_string)`.
|
89
|
+
|
90
|
+
If you only have a string for the access token instead of for the whole object, you can set it like this:
|
91
|
+
|
92
|
+
```ruby
|
93
|
+
rc.token = { access_token: 'the token string' }
|
94
|
+
```
|
83
95
|
|
84
96
|
|
85
97
|
### Send SMS
|
data/lib/ringcentral.rb
CHANGED
@@ -45,13 +45,21 @@ class RingCentral
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
def authorize(username: nil, extension: nil, password: nil, auth_code: nil, redirect_uri: nil)
|
48
|
+
def authorize(username: nil, extension: nil, password: nil, auth_code: nil, redirect_uri: nil, jwt: nil, verifier: nil)
|
49
49
|
if auth_code != nil
|
50
50
|
payload = {
|
51
51
|
grant_type: 'authorization_code',
|
52
52
|
code: auth_code,
|
53
53
|
redirect_uri: redirect_uri,
|
54
54
|
}
|
55
|
+
if verifier != nil
|
56
|
+
payload["code_verifier"] = verifier
|
57
|
+
end
|
58
|
+
elsif jwt != nil
|
59
|
+
payload = {
|
60
|
+
grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
|
61
|
+
assertion: jwt
|
62
|
+
}
|
55
63
|
else
|
56
64
|
payload = {
|
57
65
|
grant_type: 'password',
|
@@ -83,7 +91,7 @@ class RingCentral
|
|
83
91
|
self.post('/restapi/oauth/revoke', payload: payload)
|
84
92
|
end
|
85
93
|
|
86
|
-
def authorize_uri(redirect_uri, state = '')
|
94
|
+
def authorize_uri(redirect_uri, state = '', challenge = nil, challenge_method = 'S256')
|
87
95
|
uri = Addressable::URI.parse(@server) + '/restapi/oauth/authorize'
|
88
96
|
uri.query_values = {
|
89
97
|
response_type: 'code',
|
@@ -91,6 +99,10 @@ class RingCentral
|
|
91
99
|
redirect_uri: redirect_uri,
|
92
100
|
client_id: @client_id
|
93
101
|
}
|
102
|
+
if challenge != nil
|
103
|
+
uri.query_values["code_challenge"] = challenge
|
104
|
+
uri.query_values["code_challenge_method"] = challenge_method
|
105
|
+
end
|
94
106
|
uri.to_s
|
95
107
|
end
|
96
108
|
|
data/lib/subscription.rb
CHANGED
@@ -2,6 +2,7 @@ require 'pubnub'
|
|
2
2
|
require 'concurrent'
|
3
3
|
require 'openssl'
|
4
4
|
require 'base64'
|
5
|
+
require 'securerandom'
|
5
6
|
|
6
7
|
class PubNub
|
7
8
|
attr_accessor :events
|
@@ -48,7 +49,7 @@ class PubNub
|
|
48
49
|
def subscribe
|
49
50
|
r = @rc.post('/restapi/v1.0/subscription', payload: request_body)
|
50
51
|
self.subscription = r.body
|
51
|
-
@pubnub = Pubnub.new(subscribe_key: @subscription['deliveryMode']['subscriberKey'])
|
52
|
+
@pubnub = Pubnub.new(subscribe_key: @subscription['deliveryMode']['subscriberKey'], uuid: SecureRandom.uuid)
|
52
53
|
@pubnub.add_listener(name: 'default', callback: @callback)
|
53
54
|
@pubnub.subscribe(channels: @subscription['deliveryMode']['address'])
|
54
55
|
end
|
data/ringcentral-sdk.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = 'ringcentral-sdk'
|
3
|
-
gem.version = '0.9.
|
3
|
+
gem.version = '0.9.6'
|
4
4
|
gem.authors = ['Tyler Liu']
|
5
5
|
gem.email = ['tyler.liu@ringcentral.com']
|
6
6
|
gem.description = 'Ruby SDK for you to access RingCentral platform API.'
|
@@ -13,9 +13,9 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.files += Dir['lib/**/*.rb']
|
14
14
|
gem.test_files = Dir['spec/**/*.rb']
|
15
15
|
|
16
|
-
gem.add_dependency('addressable', '~> 2.
|
17
|
-
gem.add_dependency('concurrent-ruby', '~> 1.1', '>= 1.1.
|
18
|
-
gem.add_dependency('pubnub', '~>
|
19
|
-
gem.add_dependency('faraday', '~>
|
20
|
-
gem.add_dependency('faraday_middleware', '~> 0
|
16
|
+
gem.add_dependency('addressable', '~> 2.8', '>= 2.8.0')
|
17
|
+
gem.add_dependency('concurrent-ruby', '~> 1.1', '>= 1.1.9')
|
18
|
+
gem.add_dependency('pubnub', '~> 5.0', '>= 5.0.0')
|
19
|
+
gem.add_dependency('faraday', '~> 2.1', '>= 2.1.0')
|
20
|
+
gem.add_dependency('faraday_middleware', '~> 1.2.0', '>= 1.2.0')
|
21
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ringcentral-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Liu
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.8'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 2.
|
22
|
+
version: 2.8.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '2.
|
29
|
+
version: '2.8'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 2.
|
32
|
+
version: 2.8.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: concurrent-ruby
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
version: '1.1'
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 1.1.
|
42
|
+
version: 1.1.9
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -49,67 +49,67 @@ dependencies:
|
|
49
49
|
version: '1.1'
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: 1.1.
|
52
|
+
version: 1.1.9
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: pubnub
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
57
|
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '
|
59
|
+
version: '5.0'
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
62
|
+
version: 5.0.0
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
69
|
+
version: '5.0'
|
70
70
|
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version:
|
72
|
+
version: 5.0.0
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: faraday
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
77
77
|
- - "~>"
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: '
|
79
|
+
version: '2.1'
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 2.1.0
|
83
83
|
type: :runtime
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '2.1'
|
90
90
|
- - ">="
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version:
|
92
|
+
version: 2.1.0
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
94
|
name: faraday_middleware
|
95
95
|
requirement: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
97
|
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version:
|
99
|
+
version: 1.2.0
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: 1.2.0
|
103
103
|
type: :runtime
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
109
|
+
version: 1.2.0
|
110
110
|
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
112
|
+
version: 1.2.0
|
113
113
|
description: Ruby SDK for you to access RingCentral platform API.
|
114
114
|
email:
|
115
115
|
- tyler.liu@ringcentral.com
|
@@ -131,7 +131,7 @@ homepage: https://github.com/ringcentral/ringcentral-ruby
|
|
131
131
|
licenses:
|
132
132
|
- MIT
|
133
133
|
metadata: {}
|
134
|
-
post_install_message:
|
134
|
+
post_install_message:
|
135
135
|
rdoc_options: []
|
136
136
|
require_paths:
|
137
137
|
- lib
|
@@ -146,15 +146,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
|
-
|
150
|
-
|
151
|
-
signing_key:
|
149
|
+
rubygems_version: 3.2.3
|
150
|
+
signing_key:
|
152
151
|
specification_version: 4
|
153
152
|
summary: RingCentral Ruby SDK.
|
154
153
|
test_files:
|
155
|
-
- spec/spec_helper.rb
|
156
|
-
- spec/ringcentral_spec.rb
|
157
|
-
- spec/mms_spec.rb
|
158
154
|
- spec/fax_spec.rb
|
159
|
-
- spec/
|
155
|
+
- spec/mms_spec.rb
|
160
156
|
- spec/query_params_spec.rb
|
157
|
+
- spec/ringcentral_spec.rb
|
158
|
+
- spec/spec_helper.rb
|
159
|
+
- spec/subscription_spec.rb
|