ringcentral_sdk 3.0.1 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8809e2c366178508764cc7dc7da5ad97e8ef25a2fb98044d131470e70054cf8e
4
- data.tar.gz: f3b9a215b507b7cb6cdf12490b4485986e6e75666f04d2c1da4a6f8fd794aa9d
3
+ metadata.gz: 0d7d7bec3a2a5167683da179b619dabe76b73e9feeba8d1c4d141a3135f7f221
4
+ data.tar.gz: 1655a60eaba12760f98425e2a1bd6a5e9f7b88af83425b9043601f7c751d4fa7
5
5
  SHA512:
6
- metadata.gz: a01821bb51bfa02bb61d3189d499d5a760ac92674e7bf45cef9c13253ae144b7f699f2418dc30de0a9164148a6a18c5892e9cff19c404f898d2cf889a33daea0
7
- data.tar.gz: 66fe138e476feaa02e86811565af85648ead5c856497bf5d0d6f3e4e87712968115d288807a5be35120a762fae7cad43de0f7be1808e1a7da56d867646db6731
6
+ metadata.gz: cde3465645b5c8d2d0f6e2e803263b8e2af39706fc839c357c17cc296cb15bdfb2b049350b754ac8707c152906019f9cb82a7d51ac6338a7505ed634d1c629d3
7
+ data.tar.gz: 759da592165de535c34a117540826b0baddbd849b45f06f04066604264c0021d079e849601d56a050e9b1ead5bfa9be941c75f4f55897ca0003881fdfe847460
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
1
  source ENV['GEM_SOURCE'] || 'https://rubygems.org'
2
2
 
3
- gemspec
3
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ringcentral_sdk (2.2.2)
4
+ ringcentral_sdk (3.1.0)
5
5
  dotenv (~> 2.1, >= 2.8.1)
6
6
  faraday (~> 1.10, >= 1.10.3)
7
7
  faraday_middleware (~> 1.2, >= 1.2.0)
@@ -14,7 +14,7 @@ PATH
14
14
  mime_builder (~> 0.1, >= 0.1.1)
15
15
  multi_json (~> 1.3)
16
16
  oauth2 (~> 2.0, >= 2.0.9)
17
- pubnub (~> 5.0, >= 5.2.1)
17
+ pubnub (~> 4.0, >= 4.8.0)
18
18
 
19
19
  GEM
20
20
  remote: https://rubygems.org/
@@ -123,7 +123,7 @@ GEM
123
123
  version_gem (~> 1.1)
124
124
  power_assert (2.0.3)
125
125
  public_suffix (5.0.1)
126
- pubnub (5.2.1)
126
+ pubnub (4.8.0)
127
127
  addressable (>= 2.0.0)
128
128
  concurrent-ruby (~> 1.1.5)
129
129
  concurrent-ruby-edge (~> 0.5.0)
@@ -136,6 +136,7 @@ GEM
136
136
  rest-client (1.6.7)
137
137
  mime-types (>= 1.16)
138
138
  ruby2_keywords (0.0.5)
139
+ rubycop (1.0.1)
139
140
  simplecov (0.22.0)
140
141
  docile (~> 1.1)
141
142
  simplecov-html (~> 0.11)
@@ -164,6 +165,7 @@ DEPENDENCIES
164
165
  mocha (~> 2)
165
166
  rake (~> 13)
166
167
  ringcentral_sdk!
168
+ rubycop (~> 1.0, >= 1.0.1)
167
169
  simplecov (~> 0)
168
170
  test-unit (~> 3)
169
171
 
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2023 John Wang
3
+ Copyright (c) 2015-2024 John Wang
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -37,14 +37,6 @@ RingCentral SDK for Ruby
37
37
 
38
38
  A Ruby SDK for the [RingCentral REST API](https://developers.ringcentral.com).
39
39
 
40
- ## Important Notes
41
-
42
- Version 2.0.0 introduces the following backward breaking changes:
43
-
44
- * SDK instantiation by moving to a block-based configuration
45
- * Removal of `RingCentralSdk::REST::Config` class
46
- * Removal of `RingCentralSdk::REST::Client.authorize_user` method
47
-
48
40
  ## Documentation
49
41
 
50
42
  Full documentation and resources are available at:
@@ -88,10 +80,8 @@ client = RingCentralSdk::REST::Client.new do |config|
88
80
  config.client_secret = 'myAppClientSecret'
89
81
  config.server_url = RingCentralSdk::RC_SERVER_SANDBOX
90
82
 
91
- # User info for password grant (optional)
92
- config.username = 'myUsername'
93
- config.extension = 'myExtension'
94
- config.password = 'myPassword'
83
+ # JWT Bearer Grant (optional)
84
+ config.jwt = 'myJwt'
95
85
 
96
86
  # Set a custom logger (optional)
97
87
  config.logger = Logger.new(STDOUT)
@@ -197,6 +187,12 @@ sub.subscribe ['/restapi/v1.0/account/~/extension/~/presence']
197
187
  sub.destroy
198
188
  ```
199
189
 
190
+ ### Examples
191
+
192
+ See examples in the [`scripts`](scripts) folder.
193
+
194
+ A simple read only script is `account-extensions.rb` which can be used to validate your app configuration.
195
+
200
196
  ### Advanced Use Cases
201
197
 
202
198
  1. [Subscribing to All Extensions](http://ringcentral-sdk-ruby.readthedocs.org/en/latest/usage/notifications/Subscriptions-All-Extensions/)
@@ -245,18 +241,32 @@ RingCentral Official SDKs
245
241
  4. Push to the branch (`git push origin my-new-feature`)
246
242
  5. Create new Pull Request
247
243
 
244
+ ### Development
245
+
246
+ To build local development copy of the gem use:
247
+
248
+ ```
249
+ % gem build ringcentral_sdk.gemspec
250
+ ```
251
+
252
+ This will produce a file like: `ringcentral_sdk-3.1.0.gem` which you can install with:
253
+
254
+ ```
255
+ % gem install ringcentral_sdk-3.1.0.gem
256
+ ```
257
+
248
258
  ## License
249
259
 
250
- RingCentral SDK is available under an MIT-style license. See [LICENSE.md](LICENSE.md) for details.
260
+ RingCentral SDK is available under the MIT license. See [LICENSE](LICENSE) for details.
251
261
 
252
- RingCentral SDK © 2015-2023 by John Wang
262
+ RingCentral SDK © 2015-2024 by John Wang
253
263
 
254
264
  [gem-version-svg]: https://badge.fury.io/rb/ringcentral_sdk.svg
255
265
  [gem-version-url]: http://badge.fury.io/rb/ringcentral_sdk
256
266
  [downloads-svg]: http://ruby-gem-downloads-badge.herokuapp.com/ringcentral_sdk
257
267
  [downloads-url]: https://rubygems.org/gems/ringcentral_sdk
258
- [build-status-svg]: https://api.travis-ci.org/grokify/ringcentral-sdk-ruby.svg?branch=master
259
- [build-status-url]: https://travis-ci.org/grokify/ringcentral-sdk-ruby
268
+ [build-status-svg]: https://github.com/grokify/ringcentral-sdk-ruby/workflows/test/badge.svg
269
+ [build-status-url]: https://github.com/grokify/ringcentral-sdk-ruby/actions/workflows/test.yaml
260
270
  [coverage-status-svg]: https://coveralls.io/repos/grokify/ringcentral-sdk-ruby/badge.svg?branch=master
261
271
  [coverage-status-url]: https://coveralls.io/r/grokify/ringcentral-sdk-ruby?branch=master
262
272
  [dependency-status-svg]: https://gemnasium.com/grokify/ringcentral-sdk-ruby.svg
@@ -274,7 +284,7 @@ RingCentral SDK © 2015-2023 by John Wang
274
284
  [docs-rubydoc-svg]: https://img.shields.io/badge/docs-rubydoc-blue.svg
275
285
  [docs-rubydoc-url]: http://www.rubydoc.info/gems/ringcentral_sdk/
276
286
  [license-svg]: https://img.shields.io/badge/license-MIT-blue.svg
277
- [license-url]: https://github.com/grokify/ringcentral-sdk-ruby/blob/master/LICENSE.md
287
+ [license-url]: https://github.com/grokify/ringcentral-sdk-ruby/blob/master/LICENSE
278
288
  [chat-svg]: https://img.shields.io/badge/chat-on%20glip-orange.svg
279
289
  [chat-url]: https://glipped.herokuapp.com/
280
290
  [stackoverflow-svg]: https://img.shields.io/badge/Stack%20Overflow-ringcentral-orange.svg
@@ -7,11 +7,8 @@ module RingCentralSdk
7
7
  # Extensions cache is a local store that can retrieve all
8
8
  # extensions for use locally
9
9
  class Extensions
10
- attr_accessor :client
11
- attr_accessor :account_id
12
- attr_reader :extensions_hash
13
- attr_reader :extensions_num2id
14
- attr_reader :last_retrieved
10
+ attr_accessor :client, :account_id
11
+ attr_reader :extensions_hash, :extensions_num2id, :last_retrieved
15
12
 
16
13
  def initialize(client)
17
14
  @client = client
@@ -23,12 +23,7 @@ module RingCentralSdk
23
23
  URL_PREFIX = '/restapi'.freeze
24
24
  DEFAULT_LANGUAGE = 'en-us'.freeze
25
25
 
26
- attr_reader :config
27
- attr_reader :http
28
- attr_reader :logger
29
- attr_reader :oauth2client
30
- attr_reader :user_agent
31
- attr_reader :messages
26
+ attr_reader :config, :http, :logger, :messages, :oauth2client, :user_agent
32
27
 
33
28
  def initialize
34
29
  init_attributes
@@ -40,9 +35,12 @@ module RingCentralSdk
40
35
 
41
36
  @oauth2client = new_oauth2_client
42
37
 
43
- unless @config.username.to_s.empty?
44
- authorize_password @config.username, @config.extension, @config.password
45
- end
38
+ # Remove Password Grant
39
+ # unless @config.username.to_s.empty?
40
+ # authorize_password @config.username, @config.extension, @config.password
41
+ # end
42
+
43
+ authorize_jwt(@config.jwt) unless @config.jwt.to_s.empty?
46
44
 
47
45
  @messages = RingCentralSdk::REST::Messages.new self
48
46
  end
@@ -109,11 +107,20 @@ module RingCentralSdk
109
107
  opts
110
108
  end
111
109
 
112
- def authorize_password(username, extension = '', password = '', params = {})
113
- token = @oauth2client.password.get_token(username, password, {
114
- extension: extension,
115
- headers: { 'Authorization' => 'Basic ' + api_key }
116
- }.merge(params))
110
+ # def authorize_password(username, extension = '', password = '', params = {})
111
+ # token = @oauth2client.password.get_token(username, password, {
112
+ # extension: extension,
113
+ # headers: { 'Authorization' => 'Basic ' + api_key }
114
+ # }.merge(params))
115
+ # set_token token
116
+ # token
117
+ # end
118
+
119
+ def authorize_jwt(jwt)
120
+ token = @oauth2client.get_token({
121
+ grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
122
+ assertion: jwt
123
+ })
117
124
  set_token token
118
125
  token
119
126
  end
@@ -238,8 +245,10 @@ module RingCentralSdk
238
245
  RingCentralSdk::REST::Subscription.new self
239
246
  end
240
247
 
241
- alias authorize authorize_password
242
- alias login authorize_password
248
+ # alias authorize authorize_password
249
+ # alias login authorize_password
250
+ alias authorize authorize_jwt
251
+ alias login authorize_jwt
243
252
  private :api_version_url
244
253
  end
245
254
  end
@@ -9,22 +9,13 @@ module RingCentralSdk
9
9
  module REST
10
10
  # Configuration class populated by Client constructor block
11
11
  class Configuration
12
- attr_accessor :server_url
13
- attr_accessor :client_id
14
- attr_accessor :client_secret
15
- attr_accessor :redirect_url
16
-
17
- attr_accessor :username
18
- attr_accessor :extension
19
- attr_accessor :password
20
- attr_accessor :token
21
- attr_accessor :token_file
22
-
23
- attr_accessor :load_env
24
- attr_accessor :headers
25
- attr_accessor :retry
26
- attr_accessor :retry_options
27
- attr_accessor :logger
12
+ attr_accessor :server_url,
13
+ :client_id, :client_secret,
14
+ :redirect_url,
15
+ :jwt, :token, :token_file,
16
+ :load_env,
17
+ :headers, :retry, :retry_options,
18
+ :logger
28
19
 
29
20
  def inflate
30
21
  @logger = default_logger if !defined?(@logger) || @logger.nil?
@@ -47,9 +38,10 @@ module RingCentralSdk
47
38
  @client_id = ENV['RINGCENTRAL_CLIENT_ID'] if ENV.key? 'RINGCENTRAL_CLIENT_ID'
48
39
  @client_secret = ENV['RINGCENTRAL_CLIENT_SECRET'] if ENV.key? 'RINGCENTRAL_CLIENT_SECRET'
49
40
  @redirect_url = ENV['RINGCENTRAL_REDIRECT_URL'] if ENV.key? 'RINGCENTRAL_REDIRECT_URL'
50
- @username = ENV['RINGCENTRAL_USERNAME'] if ENV.key? 'RINGCENTRAL_USERNAME'
51
- @extension = ENV['RINGCENTRAL_EXTENSION'] if ENV.key? 'RINGCENTRAL_EXTENSION'
52
- @password = ENV['RINGCENTRAL_PASSWORD'] if ENV.key? 'RINGCENTRAL_PASSWORD'
41
+ # @username = ENV['RINGCENTRAL_USERNAME'] if ENV.key? 'RINGCENTRAL_USERNAME'
42
+ # @extension = ENV['RINGCENTRAL_EXTENSION'] if ENV.key? 'RINGCENTRAL_EXTENSION'
43
+ # @password = ENV['RINGCENTRAL_PASSWORD'] if ENV.key? 'RINGCENTRAL_PASSWORD'
44
+ @jwt = ENV['RINGCENTRAL_JWT'] if ENV.key? 'RINGCENTRAL_JWT'
53
45
  @token = ENV['RINGCENTRAL_TOKEN'] if ENV.key? 'RINGCENTRAL_TOKEN'
54
46
  @token_file = ENV['RINGCENTRAL_TOKEN_FILE'] if ENV.key? 'RINGCENTRAL_TOKEN_FILE'
55
47
  @retry = ENV['RINGCENTRAL_RETRY'] if ENV.key? 'RINGCENTRAL_RETRY'
@@ -15,12 +15,9 @@ module RingCentralSdk
15
15
  DEFAULT_BASE64_ENCODE = true
16
16
  DEFAULT_CONTENT_ID_DISABLE = true
17
17
 
18
- attr_accessor :method
19
- attr_accessor :mime_part_params
18
+ attr_accessor :method, :mime_part_params
20
19
 
21
- attr_reader :mime
22
- attr_reader :account_id
23
- attr_reader :extension_id
20
+ attr_reader :mime, :account_id, :extension_id
24
21
 
25
22
  def initialize(opts = {})
26
23
  @mime = MIME::Multipart::Mixed.new
@@ -1,6 +1,6 @@
1
1
  # RingCentralSdk is a SDK for the RingCentral REST API
2
2
  module RingCentralSdk
3
- VERSION = '3.0.1'.freeze
3
+ VERSION = '3.1.0'.freeze
4
4
 
5
5
  RC_SERVER_PRODUCTION = 'https://platform.ringcentral.com'.freeze
6
6
  RC_SERVER_SANDBOX = 'https://platform.devtest.ringcentral.com'.freeze
data/pubnub.log CHANGED
@@ -31,3 +31,27 @@ D, [2023-02-20T07:51:48.766805 #17761] DEBUG -- Pubnub::Telementry: Initialized
31
31
  D, [2023-02-20T07:51:48.766950 #17761] DEBUG -- Pubnub::Client: Created new Pubnub::Client instance. Version: 4.8.0
32
32
  D, [2023-02-20T07:51:48.768788 #17761] DEBUG -- Pubnub::Telementry: Initialized Telemetry
33
33
  D, [2023-02-20T07:51:48.768823 #17761] DEBUG -- Pubnub::Client: Created new Pubnub::Client instance. Version: 4.8.0
34
+ D, [2023-02-20T08:24:30.269889 #18664] DEBUG -- Pubnub::Telementry: Initialized Telemetry
35
+ D, [2023-02-20T08:24:30.270993 #18664] DEBUG -- Pubnub::Client: Created new Pubnub::Client instance. Version: 4.8.0
36
+ D, [2023-02-20T08:24:30.272699 #18664] DEBUG -- Pubnub::Telementry: Initialized Telemetry
37
+ D, [2023-02-20T08:24:30.272733 #18664] DEBUG -- Pubnub::Client: Created new Pubnub::Client instance. Version: 4.8.0
38
+ D, [2024-11-09T07:37:13.047148 #2246] DEBUG -- Pubnub::Telementry: Initialized Telemetry
39
+ D, [2024-11-09T07:37:13.047594 #2246] DEBUG -- Pubnub::Client: Created new Pubnub::Client instance. Version: 4.8.0
40
+ D, [2024-11-09T07:37:13.049664 #2246] DEBUG -- Pubnub::Telementry: Initialized Telemetry
41
+ D, [2024-11-09T07:37:13.049736 #2246] DEBUG -- Pubnub::Client: Created new Pubnub::Client instance. Version: 4.8.0
42
+ D, [2024-11-09T07:38:23.902584 #2281] DEBUG -- Pubnub::Telementry: Initialized Telemetry
43
+ D, [2024-11-09T07:38:23.902745 #2281] DEBUG -- Pubnub::Client: Created new Pubnub::Client instance. Version: 4.8.0
44
+ D, [2024-11-09T07:38:23.904805 #2281] DEBUG -- Pubnub::Telementry: Initialized Telemetry
45
+ D, [2024-11-09T07:38:23.904851 #2281] DEBUG -- Pubnub::Client: Created new Pubnub::Client instance. Version: 4.8.0
46
+ D, [2024-11-09T07:41:04.801211 #2358] DEBUG -- Pubnub::Telementry: Initialized Telemetry
47
+ D, [2024-11-09T07:41:04.801540 #2358] DEBUG -- Pubnub::Client: Created new Pubnub::Client instance. Version: 4.8.0
48
+ D, [2024-11-09T07:42:41.613689 #2402] DEBUG -- Pubnub::Telementry: Initialized Telemetry
49
+ D, [2024-11-09T07:42:41.613863 #2402] DEBUG -- Pubnub::Client: Created new Pubnub::Client instance. Version: 4.8.0
50
+ D, [2024-11-09T07:43:21.311789 #2422] DEBUG -- Pubnub::Telementry: Initialized Telemetry
51
+ D, [2024-11-09T07:43:21.311944 #2422] DEBUG -- Pubnub::Client: Created new Pubnub::Client instance. Version: 4.8.0
52
+ D, [2024-11-09T07:44:29.345106 #2454] DEBUG -- Pubnub::Telementry: Initialized Telemetry
53
+ D, [2024-11-09T07:44:29.345427 #2454] DEBUG -- Pubnub::Client: Created new Pubnub::Client instance. Version: 4.8.0
54
+ D, [2024-11-09T07:44:45.085141 #2465] DEBUG -- Pubnub::Telementry: Initialized Telemetry
55
+ D, [2024-11-09T07:44:45.085321 #2465] DEBUG -- Pubnub::Client: Created new Pubnub::Client instance. Version: 4.8.0
56
+ D, [2024-11-09T07:45:59.682038 #2502] DEBUG -- Pubnub::Telementry: Initialized Telemetry
57
+ D, [2024-11-09T07:45:59.682423 #2502] DEBUG -- Pubnub::Client: Created new Pubnub::Client instance. Version: 4.8.0
@@ -7,7 +7,7 @@ version = $1
7
7
  Gem::Specification.new do |s|
8
8
  s.name = lib
9
9
  s.version = version
10
- s.date = '2023-02-20'
10
+ s.date = '2024-11-08'
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']
@@ -38,6 +38,7 @@ Gem::Specification.new do |s|
38
38
  s.add_development_dependency 'coveralls', '~> 0'
39
39
  s.add_development_dependency 'mocha', '~> 2'
40
40
  s.add_development_dependency 'rake', '~> 13'
41
+ s.add_dependency 'rubocop', '~> 1.68'
41
42
  s.add_development_dependency 'simplecov', '~> 0'
42
43
  s.add_development_dependency 'test-unit', '~> 3'
43
44
  end
data/test/test_setup.rb CHANGED
@@ -34,8 +34,7 @@ class RingCentralSdkTest < Test::Unit::TestCase
34
34
  config.client_id = 'my_app_client_id'
35
35
  config.client_secret = 'my_app_client_secret'
36
36
  config.server_url = RingCentralSdk::RC_SERVER_SANDBOX
37
- config.username = 'my_username'
38
- config.password = 'my_password'
37
+ config.jwt = 'my_jwt'
39
38
  end
40
39
 
41
40
  assert_equal 'my_test_access_token', rcsdk.token.to_hash[:access_token]
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: 3.0.1
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Wang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-20 00:00:00.000000000 Z
11
+ date: 2024-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -308,6 +308,20 @@ dependencies:
308
308
  - - "~>"
309
309
  - !ruby/object:Gem::Version
310
310
  version: '13'
311
+ - !ruby/object:Gem::Dependency
312
+ name: rubocop
313
+ requirement: !ruby/object:Gem::Requirement
314
+ requirements:
315
+ - - "~>"
316
+ - !ruby/object:Gem::Version
317
+ version: '1.68'
318
+ type: :runtime
319
+ prerelease: false
320
+ version_requirements: !ruby/object:Gem::Requirement
321
+ requirements:
322
+ - - "~>"
323
+ - !ruby/object:Gem::Version
324
+ version: '1.68'
311
325
  - !ruby/object:Gem::Dependency
312
326
  name: simplecov
313
327
  requirement: !ruby/object:Gem::Requirement
@@ -345,7 +359,7 @@ files:
345
359
  - CHANGELOG.md
346
360
  - Gemfile
347
361
  - Gemfile.lock
348
- - LICENSE.md
362
+ - LICENSE
349
363
  - README.md
350
364
  - Rakefile
351
365
  - lib/ringcentral_sdk.rb