ringcentral_sdk 0.5.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/Gemfile +3 -1
  4. data/Gemfile.lock +96 -0
  5. data/README.md +66 -92
  6. data/Rakefile +3 -3
  7. data/lib/ringcentral_sdk/{cache → rest/cache}/extensions.rb +17 -19
  8. data/lib/ringcentral_sdk/rest/cache.rb +3 -0
  9. data/lib/ringcentral_sdk/{platform.rb → rest/client.rb} +61 -55
  10. data/lib/ringcentral_sdk/rest/config.rb +93 -0
  11. data/lib/ringcentral_sdk/rest/extension.rb +12 -0
  12. data/lib/ringcentral_sdk/rest/extension_presence.rb +104 -0
  13. data/lib/ringcentral_sdk/rest/messages.rb +46 -0
  14. data/lib/ringcentral_sdk/{helpers/request.rb → rest/request/base.rb} +2 -2
  15. data/lib/ringcentral_sdk/rest/request/fax.rb +121 -0
  16. data/lib/ringcentral_sdk/{helpers → rest/request}/inflator/contact_info.rb +1 -1
  17. data/lib/ringcentral_sdk/rest/request/inflator.rb +3 -0
  18. data/lib/ringcentral_sdk/rest/request.rb +5 -0
  19. data/lib/ringcentral_sdk/{simple.rb → rest/simple_client.rb} +10 -10
  20. data/lib/ringcentral_sdk/{subscription.rb → rest/subscription.rb} +8 -8
  21. data/lib/ringcentral_sdk/rest.rb +15 -0
  22. data/lib/ringcentral_sdk.rb +3 -7
  23. data/mkdocs.yml +30 -0
  24. data/ringcentral_sdk-0.5.2.gem +0 -0
  25. data/ringcentral_sdk.gemspec +31 -0
  26. data/test/{test_helper.rb → test_base.rb} +3 -3
  27. data/test/{test_platform.rb → test_client.rb} +58 -28
  28. data/test/test_config.rb +29 -0
  29. data/test/test_extension_presence.rb +154 -0
  30. data/test/test_helper_fax.rb +42 -39
  31. data/test/test_helper_inflator_contact_info.rb +3 -3
  32. data/test/test_helper_request.rb +3 -4
  33. data/test/test_setup.rb +4 -4
  34. data/test/test_subscription.rb +9 -9
  35. metadata +95 -48
  36. data/lib/ringcentral_sdk/cache.rb +0 -3
  37. data/lib/ringcentral_sdk/helpers/extension_presence.rb +0 -129
  38. data/lib/ringcentral_sdk/helpers/fax.rb +0 -160
  39. data/lib/ringcentral_sdk/helpers/inflator.rb +0 -3
  40. data/lib/ringcentral_sdk/helpers/messages.rb +0 -19
  41. data/lib/ringcentral_sdk/helpers.rb +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 96b95c556e178ef01ddbc722d0c3218957847cb0
4
- data.tar.gz: 265aa9e0b869a20fd04a137e96639eb33ef63366
3
+ metadata.gz: df5aca1bce66925c5e3e14d134fba3f5b53625e9
4
+ data.tar.gz: 811bac728f717e58b0ab0f7c5c1b420468103c3f
5
5
  SHA512:
6
- metadata.gz: f4beda03bae9a21852650aea069973125272e0f9872450868588be2656ea3fc63129e0eb881191682c58db92715ac901cb858e2b96e014dd34d66738731491a4
7
- data.tar.gz: 2841f8cd41b0db6df6fa5fd42a8faf7e83dafe3d35bf797c449fe456e5696b5fc0a02389f6f7eacbd87f9067187dccbf8fc593f82535a8df8012f025dd293ebf
6
+ metadata.gz: 99e6878c0e06d67cd959eabad0ae6291714f7d11e9ab00f8d22de5fcd72f873ccbca7001f0b4fd097c1899c2c6f04be1f2b7edcac6129e9d8d049fa751ec7763
7
+ data.tar.gz: 2878c4c401b37fbe11c2ca7b7a3066bedcc5f62542f8de8dfb1071070608d0deea9b131f580ec8b2dd19f43d644ffa8c788e98031afba5832fa43a0f86b012a6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  CHANGELOG
2
2
  ---------
3
+ - **2016-01-23**: 0.9.0
4
+ - Major refactor
5
+ - Add `RingCentral::REST::Config` and dotenv support
6
+ - **2016-01-22**: 0.5.2
7
+ - Add `RingCentralSdk::Cache::Extensions`
8
+ - Add `RingCentralSdk::Helpers::ExtensionPresence`
9
+ - Add Call Queue Member Status mydocs documentation
3
10
  - **2015-12-08**: 0.5.1
4
11
  - Add call recording transcription demo script via VoiceBase
5
12
  - Fix PubNub unsubscribe bug
data/Gemfile CHANGED
@@ -1,12 +1,14 @@
1
- source ENV['GEM_SOURCE'] || "https://rubygems.org"
1
+ source ENV['GEM_SOURCE'] || 'https://rubygems.org'
2
2
 
3
3
  gem 'coveralls'
4
+ gem 'dotenv'
4
5
  gem 'faraday', '~> 0.9.0'
5
6
  gem 'faraday_middleware'
6
7
  gem 'faraday_middleware-oauth2_refresh'
7
8
  gem 'logger'
8
9
  gem 'mime'
9
10
  gem 'mime-types'
11
+ gem 'mime_builder'
10
12
  gem 'mocha'
11
13
  gem 'multi_json'
12
14
  gem 'oauth2'
data/Gemfile.lock ADDED
@@ -0,0 +1,96 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ coveralls (0.8.10)
5
+ json (~> 1.8)
6
+ rest-client (>= 1.6.8, < 2)
7
+ simplecov (~> 0.11.0)
8
+ term-ansicolor (~> 1.3)
9
+ thor (~> 0.19.1)
10
+ tins (~> 1.6.0)
11
+ docile (1.1.5)
12
+ domain_name (0.5.25)
13
+ unf (>= 0.0.5, < 1.0.0)
14
+ dotenv (2.1.0)
15
+ eventmachine (1.0.9.1)
16
+ faraday (0.9.2)
17
+ multipart-post (>= 1.2, < 3)
18
+ faraday_middleware (0.10.0)
19
+ faraday (>= 0.7.4, < 0.10)
20
+ faraday_middleware-oauth2_refresh (0.0.2)
21
+ faraday (~> 0.9, >= 0.9)
22
+ faraday_middleware (~> 0, >= 0)
23
+ hitimes (1.2.3)
24
+ http-cookie (1.0.2)
25
+ domain_name (~> 0.5)
26
+ json (1.8.3)
27
+ jwt (1.5.2)
28
+ logger (1.2.8)
29
+ metaclass (0.0.4)
30
+ mime (0.4.3)
31
+ mime-types (2.99)
32
+ mime_builder (0.0.2)
33
+ mime
34
+ mime-types (>= 1.25)
35
+ mocha (1.1.0)
36
+ metaclass (~> 0.0.1)
37
+ multi_json (1.11.2)
38
+ multi_xml (0.5.5)
39
+ multipart-post (2.0.0)
40
+ net-http-persistent (2.9.4)
41
+ netrc (0.11.0)
42
+ oauth2 (1.0.0)
43
+ faraday (>= 0.8, < 0.10)
44
+ jwt (~> 1.0)
45
+ multi_json (~> 1.3)
46
+ multi_xml (~> 0.5)
47
+ rack (~> 1.2)
48
+ power_assert (0.2.7)
49
+ pubnub (3.7.10)
50
+ eventmachine (~> 1.0)
51
+ json (~> 1.8)
52
+ net-http-persistent (~> 2.9)
53
+ rack (1.6.4)
54
+ rake (10.5.0)
55
+ rest-client (1.8.0)
56
+ http-cookie (>= 1.0.2, < 2.0)
57
+ mime-types (>= 1.16, < 3.0)
58
+ netrc (~> 0.7)
59
+ simplecov (0.11.1)
60
+ docile (~> 1.1.0)
61
+ json (~> 1.8)
62
+ simplecov-html (~> 0.10.0)
63
+ simplecov-html (0.10.0)
64
+ term-ansicolor (1.3.2)
65
+ tins (~> 1.0)
66
+ test-unit (3.1.7)
67
+ power_assert
68
+ thor (0.19.1)
69
+ timers (4.1.1)
70
+ hitimes
71
+ tins (1.6.0)
72
+ unf (0.1.4)
73
+ unf_ext
74
+ unf_ext (0.0.7.1)
75
+
76
+ PLATFORMS
77
+ ruby
78
+
79
+ DEPENDENCIES
80
+ coveralls
81
+ dotenv
82
+ faraday (~> 0.9.0)
83
+ faraday_middleware
84
+ faraday_middleware-oauth2_refresh
85
+ logger
86
+ mime
87
+ mime-types
88
+ mime_builder
89
+ mocha
90
+ multi_json
91
+ oauth2
92
+ pubnub (~> 3.7.3)
93
+ rake
94
+ simplecov
95
+ test-unit
96
+ timers
data/README.md CHANGED
@@ -15,7 +15,6 @@ RingCentral SDK for Ruby
15
15
  ## Table of contents
16
16
 
17
17
  1. [Overview](#overview)
18
- 1. [Included](#included)
19
18
  2. [Documentation](#documentation)
20
19
  3. [Installation](#installation)
21
20
  4. [Usage](#usage)
@@ -37,16 +36,7 @@ RingCentral SDK for Ruby
37
36
 
38
37
  ## Overview
39
38
 
40
- A gem for using the [RingCentral REST API](https://developers.ringcentral.com). [Click here to read the full documentation](http://ringcentral-sdk-ruby.readthedocs.org/)
41
-
42
- ### Included
43
-
44
- * Authorization via `OAuth2` with authorization code and password grant flows including token refresh
45
- * Generic API requests via `Faraday` client
46
- * Subscriptions via `Pubnub` with auto-decryption
47
- * Fax request helper to create `multipart/mixed` messages
48
- * Unit test suite via `Test::Unit` and `mocha`
49
- * Docs via [Read the Docs](http://ringcentral-sdk-ruby.readthedocs.org/) and [RubyDoc](http://www.rubydoc.info/gems/ringcentral_sdk/)
39
+ A library for using the [RingCentral REST API](https://developers.ringcentral.com). [Click here to read the full documentation](http://ringcentral-sdk-ruby.readthedocs.org/).
50
40
 
51
41
  ## Documentation
52
42
 
@@ -89,106 +79,78 @@ This provides a very basic guide to using the SDK. Please use the following reso
89
79
  2. [SDK Reference](http://www.rubydoc.info/gems/ringcentral_sdk/).
90
80
  1. [API Developer and Reference Guide](https://developers.ringcentral.com/api-docs/latest/index.html)
91
81
 
92
- ### Instantiation
82
+ ### Instantiation and Authorization
83
+
84
+ How you instantiate the SDK can depend on whether you use OAuth 2.0 password grant or the authorization code grant which are both described here.
93
85
 
94
- The RingCentral server URLs can be populated manually or via the included constants:
86
+ It is also necessary to specify your RingCentral API end point URL which are included constants:
95
87
 
96
88
  * `RingCentralSdk::RC_SERVER_PRODUCTION`
97
89
  * `RingCentralSdk::RC_SERVER_SANDBOX`
98
90
 
91
+ #### Password Grant
92
+
93
+ The OAuth 2.0 resource owner password grant flow is designed for server applications where the app and resource owners are the same.
94
+
99
95
  ```ruby
100
96
  require 'ringcentral_sdk'
101
97
 
102
98
  # Returns RingCentralSdk::Platform instance
103
- rcsdk = RingCentralSdk.new(
99
+ client = RingCentralSdk::REST::Client.new(
104
100
  'myAppKey',
105
101
  'myAppSecret',
106
102
  RingCentralSdk::RC_SERVER_SANDBOX
107
103
  )
108
- ```
109
-
110
- ### Authorization
111
-
112
- #### Password Grant
113
104
 
114
- The 2-legged OAuth 2.0 flow using a password grant is designed for server applications where the app and resource owners are the same.
115
-
116
- ```ruby
117
- # Initialize using main phone number and extension number
118
- rcsdk.authorize('myUsername', 'myExtension', 'myPassword')
119
-
120
- # Initialize using user phone number without extension number
121
- # Extension defaults to company admin extension
122
- rcsdk.authorize('myUsername', nil, 'myPassword')
105
+ # extension will default to company admin extension if not provided
106
+ client.authorize_password('myUsername', 'myExtension', 'myPassword')
123
107
  ```
124
108
 
125
109
  #### Authorization Code Grant
126
110
 
127
- The 3-legged OAuth 2.0 flow using an authorization code grant is designed for web apps and public apps where authorization needs to be granted by a 3rd party resource owner.
111
+ The OAuth 2.0 authorization code grant is designed for where authorization needs to be granted by a 3rd party resource owner.
128
112
 
129
113
  Using the default authorization URL:
130
114
 
131
115
  ```ruby
132
116
  # Initialize SDK with OAuth redirect URI
133
- rcsdk = RingCentralSdk.new(
117
+ client = RingCentralSdk::REST::Client.new(
134
118
  'myAppKey',
135
119
  'myAppSecret',
136
120
  RingCentralSdk::RC_SERVER_SANDBOX,
137
121
  {:redirect_uri => 'http://example.com/oauth'}
138
122
  )
139
- # Retrieve OAuth authorize url using default redirect URL
140
- auth_url = rcsdk.authorize_url()
141
- ```
142
123
 
143
- Customizing authorize URL:
144
-
145
- ```ruby
146
- rcapi = RingCentralSdk.new(
147
- 'myAppKey',
148
- 'myAppSecret',
149
- RingCentralSdk::RC_SERVER_SANDBOX
150
- )
151
- # Retrieve OAuth authorize url using override redirect URL
152
- auth_url = rcapi.authorize_url({
153
- :redirect_uri => 'my_registered_oauth_url', # optional override of default URL
154
- :display => '', # optional: page|popup|touch|mobile, default 'page'
155
- :prompt => '', # optional: sso|login|consent, default is 'login sso consent'
156
- :state => '', # optional
157
- :brand_id => '' # optional: string|number
158
- })
159
- # Open browser window to authorization url and retrieve authorize code from redirect uri.
124
+ # Retrieve OAuth authorize url using default redirect URL
125
+ auth_url = client.authorize_url()
160
126
  ```
161
127
 
162
128
  On your redirect page, you can exchange your authorization code for an access token using the following:
163
129
 
164
130
  ```ruby
165
- code = params['code'] # retrieve GET 'code' parameter in Sinatra
166
- rcapi.authorize_code(code)
131
+ code = params['code'] # e.g. using Sinatra to retrieve code param in Redirect URI
132
+ client.authorize_code(code)
167
133
  ```
168
134
 
169
- For a complete working example, a demo Sinatra app is available in the scripts directory at [scripts/oauth2-sinatra](scripts/oauth2-sinatra).
135
+ More information on the authorization code flow:
136
+
137
+ 1. [Full documentation](http://ringcentral-sdk-ruby.readthedocs.org/en/latest/usage/authorization/Authorization/#authorization-code-grant)
138
+ 2. [Sinatra example](scripts/oauth2-sinatra)
170
139
 
171
- #### Authentication Lifecycle
140
+ #### Token Reuse
172
141
 
173
142
  The platform class performs token refresh procedure automatically if needed. To save the access and refresh tokens between instances of the SDK, you can save and reuse the token as follows:
174
143
 
175
144
  ```ruby
176
- # Retrieve and save access token when program is to be stopped
177
- # `token` is an `OAuth2::AccessToken` object
178
- token_hash = rcsdk.token.to_hash
145
+ # Access `OAuth2::AccessToken` object as hash
146
+ token_hash = client.token.to_hash
179
147
  ```
180
148
 
181
- After you have saved the token hash, e.g. as JSON, you can reload it in another instance of the SDK as follows:
149
+ You can reload the token hash in another instance of the SDK as follows:
182
150
 
183
151
  ```ruby
184
- # Reuse token_hash in another SDK instance
185
- rcapi2 = RingCentralSdk.new(
186
- 'myAppKey',
187
- 'myAppSecret',
188
- RingCentralSdk::RC_SERVER_SANDBOX
189
- )
190
152
  # set_token() accepts a hash or OAuth2::AccessToken object
191
- rcapi2.set_token(token_hash)
153
+ client.set_token(token_hash)
192
154
  ```
193
155
 
194
156
  Important! You have to manually maintain synchronization of SDK's between requests if you share authentication. When two simultaneous requests will perform refresh, only one will succeed. One of the solutions would be to have semaphor and pause other pending requests while one of them is performing refresh.
@@ -201,16 +163,18 @@ API requests can be made via the included `Faraday` client or `RingCentralSdk::H
201
163
 
202
164
  #### Generic HTTP Requests
203
165
 
204
- To make generic API requests, use included `Faraday` client which can be accessed via `rcapi.client`. The client automatically adds the correct access token to the HTTP request and handles OAuth token refresh using the `OAuth` gem.
166
+ 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 `OAuth` gem.
167
+
168
+ This is useful to access many API endpoints which do not have custom wrappers and for debugging purposes.
205
169
 
206
170
  ```ruby
207
- client = rcapi.client
171
+ http = client.http
208
172
  ```
209
173
 
210
174
  #### SMS Example
211
175
 
212
176
  ```ruby
213
- rcapi.messages.create(
177
+ client.messages.sms.create(
214
178
  :from => '+16505551212',
215
179
  :to => '+14155551212',
216
180
  :text => 'Hi there!'
@@ -219,38 +183,48 @@ rcapi.messages.create(
219
183
 
220
184
  #### Fax Example
221
185
 
222
- Request helpers are subclasses of `RingCentralSdk::Helpers::Request` and provide standard methods
223
- that can be called by the `.request()` method of the Platform object. This enables the
224
- requisite information for Faraday to be generated in a standard way.
186
+ Fax files:
225
187
 
226
- To create your own request helpers, please take a look at the fax one shown below:
188
+ ```ruby
189
+ client.messages.fax.create(
190
+ :to => '+14155551212',
191
+ :coverPageText => 'Hi there!',
192
+ :files => ['/path/to/myfile.pdf']
193
+ )
194
+ ```
227
195
 
228
- The fax helper is included to help create the `multipart/mixed` HTTP request. This consists of
229
- instantiating a fax helper object and then executing a Faraday POST request. The helper can then
230
- be used with the standard faraday client or helper `.request()` method that takes the request
231
- helper object in its entirety.
196
+ Fax text:
232
197
 
233
198
  ```ruby
234
- # Fax example using request helper
235
- fax = RingCentralSdk::Helpers::CreateFaxRequest.new(
236
- nil, # auto-inflates to [{:account_id => '~', :extension_id => '~'}]
237
- {
238
- # phone numbers are in E.164 format with or without leading '+'
239
- :to => [{ :phoneNumber => '+16505551212' }],
240
- :coverPageText => 'RingCentral fax PDF demo using Ruby!'
241
- },
242
- :file_name => '/path/to/my_file.pdf'
199
+ client.messages.fax.create(
200
+ :to => '+14155551212',
201
+ :coverPageText => 'Hi there!',
202
+ :text => 'Hi there!'
243
203
  )
204
+ ```
244
205
 
245
- # sending request via request helper methods
246
- response = rcapi.request(fax)
206
+ #### Subscription Example
247
207
 
248
- # sending request via standard Faraday client
249
- response = rcapi.client.post do |req|
250
- req.url fax.url
251
- req.headers['Content-Type'] = fax.content_type
252
- req.body = fax.body
208
+ To make subscriptions with RingCentral, use the SDK object to create subscription Observer object and then add observers to it.
209
+
210
+ ```ruby
211
+ # Create an observer object
212
+ class MyObserver
213
+ def update(message)
214
+ puts "Subscription Message Received"
215
+ puts JSON.dump(message)
216
+ end
253
217
  end
218
+
219
+ # Create an observable subscription and add your observer
220
+ sub = client.create_subscription()
221
+ sub.add_observer(MyObserver.new())
222
+
223
+ # Subscribe to an arbitrary number of event filters
224
+ sub.subscribe(['/restapi/v1.0/account/~/extension/~/presence'])
225
+
226
+ # End the subscription
227
+ sub.destroy()
254
228
  ```
255
229
 
256
230
  ## Supported Ruby Versions
data/Rakefile CHANGED
@@ -14,6 +14,6 @@ end
14
14
  desc 'Generate YARD documentation.'
15
15
  task :gendoc do
16
16
  # puts 'yard doc generation disabled until JRuby build native extensions for redcarpet or yard removes the dependency.'
17
- system "yardoc"
18
- system "yard stats --list-undoc"
19
- end
17
+ system 'yardoc'
18
+ system 'yard stats --list-undoc'
19
+ end
@@ -1,17 +1,17 @@
1
1
  require 'time'
2
2
  require 'uri'
3
3
 
4
- module RingCentralSdk::Cache
4
+ module RingCentralSdk::REST::Cache
5
5
  class Extensions
6
6
 
7
- attr_accessor :rc_api
7
+ attr_accessor :client
8
8
  attr_accessor :account_id
9
9
  attr_reader :extensions_hash
10
10
  attr_reader :extensions_num2id
11
11
  attr_reader :last_retrieved
12
12
 
13
- def initialize(rc_api)
14
- @rc_api = rc_api
13
+ def initialize(client)
14
+ @client = client
15
15
  @account_id = '~'
16
16
  @extensions_hash = {}
17
17
  @extensions_num2id = {}
@@ -24,7 +24,7 @@ module RingCentralSdk::Cache
24
24
  if params.length > 0
25
25
  uri.query = URI.encode_www_form params
26
26
  end
27
- res = @rc_api.client.get do |req|
27
+ res = @client.http.get do |req|
28
28
  req.url uri.to_s
29
29
  if retrieve_all
30
30
  req.params['page'] = 1
@@ -32,17 +32,17 @@ module RingCentralSdk::Cache
32
32
  end
33
33
  end
34
34
  res.body['records'].each do |extension|
35
- if extension.has_key?('id') && extension['id']>0
35
+ if extension.key?('id') && extension['id']>0
36
36
  @extensions_hash[extension['id'].to_s] = extension
37
37
  end
38
38
  end
39
39
  if retrieve_all
40
- while res.body.has_key?('navigation') && res.body['navigation'].has_key?('nextPage')
40
+ while res.body.key?('navigation') && res.body['navigation'].key?('nextPage')
41
41
  res = rcsdk.client.get do |req|
42
42
  req.url res.body['navigation']['nextPage']['uri']
43
43
  end
44
44
  res.body['records'].each do |record|
45
- if extension.has_key?('id') && extension['id'].length>0
45
+ if extension.key?('id') && extension['id'].length>0
46
46
  @extensions_hash[extension['id'].to_s] = extension
47
47
  end
48
48
  end
@@ -59,8 +59,8 @@ module RingCentralSdk::Cache
59
59
  def inflate_num2id()
60
60
  num2id = {}
61
61
  @extensions_hash.each do |k,v|
62
- if v.has_key?('id') && v['id']>0 &&
63
- v.has_key?('extensionNumber') && v['extensionNumber'].length>0
62
+ if v.key?('id') && v['id']>0 &&
63
+ v.key?('extensionNumber') && v['extensionNumber'].length>0
64
64
  num2id[v['extensionNumber']] = v['id'].to_s
65
65
  end
66
66
  end
@@ -72,7 +72,7 @@ module RingCentralSdk::Cache
72
72
  if !extension_id.is_a?(String)
73
73
  extension_id = extension_id.to_s
74
74
  end
75
- if @extensions_hash.has_key?(extension_id)
75
+ if @extensions_hash.key? extension_id
76
76
  return @extensions_hash[extension_id]
77
77
  end
78
78
  return nil
@@ -82,9 +82,9 @@ module RingCentralSdk::Cache
82
82
  if !extension_number.is_a?(String)
83
83
  extension_number = extension_number.to_s
84
84
  end
85
- if @extensions_num2id.has_key?(extension_number)
85
+ if @extensions_num2id.key?(extension_number)
86
86
  extension_id = @extensions_num2id[extension_number]
87
- if @extensions_hash.has_key?(extension_id)
87
+ if @extensions_hash.key?(extension_id)
88
88
  return @extensions_hash[extension_id]
89
89
  end
90
90
  end
@@ -101,17 +101,15 @@ module RingCentralSdk::Cache
101
101
 
102
102
  members = []
103
103
 
104
- res = @rc_api.client.get do |req|
104
+ res = @client.http.get do |req|
105
105
  req.url "account/#{account_id}/department/#{department_id}/members"
106
106
  end
107
107
 
108
- if res.body.has_key?('records')
108
+ if res.body.key? 'records'
109
109
  res.body['records'].each do |extension|
110
- if extension.has_key?('id')
110
+ if extension.key? 'id'
111
111
  member = get_extension_by_id extension['id']
112
- if !member.nil?
113
- members.push member
114
- end
112
+ members.push member unless member.nil?
115
113
  end
116
114
  end
117
115
  end
@@ -0,0 +1,3 @@
1
+ module RingCentralSdk::REST::Cache
2
+ autoload :Extensions, 'ringcentral_sdk/rest/cache/extensions'
3
+ end