ringcentral_sdk 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -2
- data/lib/ringcentral_sdk.rb +1 -1
- data/lib/ringcentral_sdk/rest/cache/extensions.rb +10 -8
- data/lib/ringcentral_sdk/rest/client.rb +6 -4
- data/lib/ringcentral_sdk/rest/request/simple.rb +2 -2
- data/ringcentral_sdk.gemspec +1 -1
- data/test/test_client.rb +14 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2154bcc7c5ab9744b0e8022fce9182ef79b367f4
|
4
|
+
data.tar.gz: e905f7a5bf71557b364010abbab3d9ec3c9988b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebf2f8089617611f8bd71ed3e1abf0d36a17f608c0e1e49b47299b641d1a60db1d6e2d869a87c74694c8e09257247c507196f31c1c653b41e21644bdf99f28f1
|
7
|
+
data.tar.gz: f62ada05b0b567e60688090e3be51f41e1ce819b05c16f1bdacfa3f830c5ae7282dd55d6bad06128f34b20d019a2cf3fbb934f4dab0e9dd4201dadebd4ae3fdd
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
---------
|
3
|
+
- **2016-02-13**: 1.1.1
|
4
|
+
- Additions
|
5
|
+
- Add `client.send_request` hash support in addition to `Request::Base` object
|
6
|
+
- Add documentation / FAQ for fax `to.name` attribute
|
7
|
+
- Bugfixes
|
8
|
+
- Fix `RingCentralSdk::REST::Cache::Extensions` bug - old client
|
9
|
+
- Fix `RingCentralSdk::REST::Request::Simple` bug - initialize body
|
3
10
|
- **2016-02-07**: 1.1.0
|
4
11
|
- Add Subscription to Retrieve New Messages functionality
|
5
12
|
- `./lib`
|
@@ -45,11 +52,11 @@ CHANGELOG
|
|
45
52
|
- Delete `VERSION.txt` file
|
46
53
|
- **2015-10-15**: 0.4.0
|
47
54
|
- Add OAuth `authorization_code` support
|
48
|
-
-
|
55
|
+
- `./lib`
|
49
56
|
- Add 3-Legged OAuth support via platform `authorize_url` and `authorize_code` methods
|
50
57
|
- Update SDK initialization by converting optional params to options hash
|
51
58
|
- Update `RingCentralSdk::Platform::Platform` to `RingCentralSdk::Platform`
|
52
|
-
-
|
59
|
+
- `./scripts`
|
53
60
|
- Add `oauth2-sinatra` demo app in `scripts` directory
|
54
61
|
- Add `call_recording_download.rb` demo script
|
55
62
|
- Add `rc-credentials.json` separate demo credentials file
|
data/lib/ringcentral_sdk.rb
CHANGED
@@ -3,7 +3,6 @@ require 'uri'
|
|
3
3
|
|
4
4
|
module RingCentralSdk::REST::Cache
|
5
5
|
class Extensions
|
6
|
-
|
7
6
|
attr_accessor :client
|
8
7
|
attr_accessor :account_id
|
9
8
|
attr_reader :extensions_hash
|
@@ -13,6 +12,10 @@ module RingCentralSdk::REST::Cache
|
|
13
12
|
def initialize(client)
|
14
13
|
@client = client
|
15
14
|
@account_id = '~'
|
15
|
+
flush()
|
16
|
+
end
|
17
|
+
|
18
|
+
def flush
|
16
19
|
@extensions_hash = {}
|
17
20
|
@extensions_num2id = {}
|
18
21
|
@last_retrieved = -1
|
@@ -32,17 +35,17 @@ module RingCentralSdk::REST::Cache
|
|
32
35
|
end
|
33
36
|
end
|
34
37
|
res.body['records'].each do |extension|
|
35
|
-
if extension.key?('id') && extension['id']>0
|
38
|
+
if extension.key?('id') && extension['id'] > 0
|
36
39
|
@extensions_hash[extension['id'].to_s] = extension
|
37
40
|
end
|
38
41
|
end
|
39
42
|
if retrieve_all
|
40
43
|
while res.body.key?('navigation') && res.body['navigation'].key?('nextPage')
|
41
|
-
res =
|
44
|
+
res = @client.http.get do |req|
|
42
45
|
req.url res.body['navigation']['nextPage']['uri']
|
43
46
|
end
|
44
|
-
res.body['records'].each do |
|
45
|
-
if extension.key?('id') && extension['id']
|
47
|
+
res.body['records'].each do |extension|
|
48
|
+
if extension.key?('id') && extension['id'] > 0
|
46
49
|
@extensions_hash[extension['id'].to_s] = extension
|
47
50
|
end
|
48
51
|
end
|
@@ -59,7 +62,7 @@ module RingCentralSdk::REST::Cache
|
|
59
62
|
def inflate_num2id()
|
60
63
|
num2id = {}
|
61
64
|
@extensions_hash.each do |k,v|
|
62
|
-
if v.key?('id') && v['id']>0 &&
|
65
|
+
if v.key?('id') && v['id'] > 0 &&
|
63
66
|
v.key?('extensionNumber') && v['extensionNumber'].length>0
|
64
67
|
num2id[v['extensionNumber']] = v['id'].to_s
|
65
68
|
end
|
@@ -116,6 +119,5 @@ module RingCentralSdk::REST::Cache
|
|
116
119
|
|
117
120
|
return members
|
118
121
|
end
|
119
|
-
|
120
122
|
end
|
121
|
-
end
|
123
|
+
end
|
@@ -167,14 +167,16 @@ module RingCentralSdk::REST
|
|
167
167
|
return api_key
|
168
168
|
end
|
169
169
|
|
170
|
-
def send_request(request_sdk =
|
171
|
-
|
170
|
+
def send_request(request_sdk = {})
|
171
|
+
if request_sdk.is_a? Hash
|
172
|
+
request_sdk = RingCentralSdk::REST::Request::Simple.new(request_sdk)
|
173
|
+
elsif !request_sdk.is_a? RingCentralSdk::REST::Request::Base
|
172
174
|
fail 'Request is not a RingCentralSdk::REST::Request::Base'
|
173
175
|
end
|
174
176
|
|
175
177
|
res = nil
|
176
|
-
|
177
178
|
method = request_sdk.method.downcase
|
179
|
+
|
178
180
|
case method
|
179
181
|
when 'delete'
|
180
182
|
res = @http.delete { |req| req = inflate_request(req, request_sdk) }
|
@@ -185,7 +187,7 @@ module RingCentralSdk::REST
|
|
185
187
|
when 'put'
|
186
188
|
res = @http.put { |req| req = inflate_request(req, request_sdk) }
|
187
189
|
else
|
188
|
-
fail "#{method} not
|
190
|
+
fail "#{method} not supported"
|
189
191
|
end
|
190
192
|
return res
|
191
193
|
end
|
@@ -5,8 +5,8 @@ module RingCentralSdk::REST::Request
|
|
5
5
|
@url = opts[:url]
|
6
6
|
@params = opts[:params]
|
7
7
|
@headers = opts[:headers]
|
8
|
-
@body = body.nil? ?
|
9
|
-
if body.is_a? Hash
|
8
|
+
@body = opts[:body].nil? ? {} : opts[:body]
|
9
|
+
if @body.is_a? Hash
|
10
10
|
@headers = {} unless @headers.is_a? Hash
|
11
11
|
@headers['Content-Type'] = 'application/json'
|
12
12
|
end
|
data/ringcentral_sdk.gemspec
CHANGED
@@ -7,7 +7,7 @@ version = $1
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = 'ringcentral_sdk'
|
9
9
|
s.version = version
|
10
|
-
s.date = '2016-02-
|
10
|
+
s.date = '2016-02-13'
|
11
11
|
s.summary = 'RingCentral SDK - Ruby SDK for the RingCentral Connect Platform API'
|
12
12
|
s.description = 'A Ruby SDK for the RingCentral Connect Platform API'
|
13
13
|
s.authors = ['John Wang']
|
data/test/test_client.rb
CHANGED
@@ -266,9 +266,20 @@ class RingCentralSdkPlatformTest < Test::Unit::TestCase
|
|
266
266
|
token = client.authorize('my_test_username', 'my_test_extension', 'my_test_password')
|
267
267
|
|
268
268
|
res = client.messages.sms.create(
|
269
|
-
:
|
270
|
-
:
|
271
|
-
:
|
269
|
+
from: '+16505551212',
|
270
|
+
to: '+14155551212',
|
271
|
+
text: 'test'
|
272
|
+
)
|
273
|
+
assert_equal 'Faraday::Response', res.class.name
|
274
|
+
|
275
|
+
res = client.send_request(
|
276
|
+
method: 'post',
|
277
|
+
url: 'account/~/extension/~/sms',
|
278
|
+
body: {
|
279
|
+
from: {phoneNumber: '+16505551212'},
|
280
|
+
to: {phoneNumber: '+14155551212'},
|
281
|
+
text: 'Hi there!'
|
282
|
+
}
|
272
283
|
)
|
273
284
|
assert_equal 'Faraday::Response', res.class.name
|
274
285
|
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: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Wang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|