Skip to content

Commit 98d3d69

Browse files
committed
sync: RingCentralSdk::REST::Configuration: update to use client_id and client_secret from app_key and app_secret
1 parent 15c9b26 commit 98d3d69

File tree

15 files changed

+76
-76
lines changed

15 files changed

+76
-76
lines changed

lib/ringcentral_sdk/rest/client.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ def set_token(token)
158158

159159
def new_oauth2_client
160160
OAuth2::Client.new(
161-
@config.app_key,
162-
@config.app_secret,
161+
@config.client_id,
162+
@config.client_secret,
163163
site: @config.server_url,
164164
authorize_url: @config.authorize_url,
165165
token_url: TOKEN_ENDPOINT
@@ -177,7 +177,7 @@ def set_oauth2_client(client = nil)
177177
end
178178

179179
def api_key
180-
Base64.encode64("#{@config.app_key}:#{@config.app_secret}").gsub(/\s/, '')
180+
Base64.encode64("#{@config.client_id}:#{@config.client_secret}").gsub(/\s/, '')
181181
end
182182

183183
def send_request(request_sdk = {})

lib/ringcentral_sdk/rest/configuration.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ module REST
1010
# Configuration class populated by Client constructor block
1111
class Configuration
1212
attr_accessor :server_url
13-
attr_accessor :app_key
14-
attr_accessor :app_secret
13+
attr_accessor :client_id
14+
attr_accessor :client_secret
1515
attr_accessor :redirect_url
1616

1717
attr_accessor :username
@@ -44,8 +44,8 @@ def default_logger
4444
def load_environment
4545
Dotenv.load
4646
@server_url = ENV['RINGCENTRAL_SERVER_URL'] if ENV.key? 'RINGCENTRAL_SERVER_URL'
47-
@app_key = ENV['RINGCENTRAL_CLIENT_ID'] if ENV.key? 'RINGCENTRAL_CLIENT_ID'
48-
@app_secret = ENV['RINGCENTRAL_CLIENT_SECRET'] if ENV.key? 'RINGCENTRAL_CLIENT_SECRET'
47+
@client_id = ENV['RINGCENTRAL_CLIENT_ID'] if ENV.key? 'RINGCENTRAL_CLIENT_ID'
48+
@client_secret = ENV['RINGCENTRAL_CLIENT_SECRET'] if ENV.key? 'RINGCENTRAL_CLIENT_SECRET'
4949
@redirect_url = ENV['RINGCENTRAL_REDIRECT_URL'] if ENV.key? 'RINGCENTRAL_REDIRECT_URL'
5050
@username = ENV['RINGCENTRAL_USERNAME'] if ENV.key? 'RINGCENTRAL_USERNAME'
5151
@extension = ENV['RINGCENTRAL_EXTENSION'] if ENV.key? 'RINGCENTRAL_EXTENSION'

scripts/answering-rules.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ def EnvVal(envVar)
2626
end
2727

2828
client = RingCentralSdk::REST::Client.new do |config|
29-
config.server_url = EnvVal('RINGCENTRAL_SERVER_URL')
30-
config.app_key = EnvVal('RINGCENTRAL_CLIENT_ID')
31-
config.app_secret = EnvVal('RINGCENTRAL_CLIENT_SECRET')
32-
config.username = EnvVal('RINGCENTRAL_USERNAME')
33-
config.extension = EnvVal('RINGCENTRAL_EXTENSION')
34-
config.password = EnvVal('RINGCENTRAL_PASSWORD')
29+
config.server_url = EnvVal('RINGCENTRAL_SERVER_URL')
30+
config.client_id = EnvVal('RINGCENTRAL_CLIENT_ID')
31+
config.client_secret = EnvVal('RINGCENTRAL_CLIENT_SECRET')
32+
config.username = EnvVal('RINGCENTRAL_USERNAME')
33+
config.extension = EnvVal('RINGCENTRAL_EXTENSION')
34+
config.password = EnvVal('RINGCENTRAL_PASSWORD')
3535
end
3636

3737
def getForwardingNumbers(client, accountId, extensionId)

scripts/fax_download.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ def EnvVal(envVar)
1717
end
1818

1919
client = RingCentralSdk::REST::Client.new do |config|
20-
config.server_url = EnvVal('RINGCENTRAL_SERVER_URL')
21-
config.app_key = EnvVal('RINGCENTRAL_CLIENT_ID')
22-
config.app_secret = EnvVal('RINGCENTRAL_CLIENT_SECRET')
23-
config.username = EnvVal('RINGCENTRAL_USERNAME')
24-
config.extension = EnvVal('RINGCENTRAL_EXTENSION')
25-
config.password = EnvVal('RINGCENTRAL_PASSWORD')
20+
config.server_url = EnvVal('RINGCENTRAL_SERVER_URL')
21+
config.client_id = EnvVal('RINGCENTRAL_CLIENT_ID')
22+
config.client_secret = EnvVal('RINGCENTRAL_CLIENT_SECRET')
23+
config.username = EnvVal('RINGCENTRAL_USERNAME')
24+
config.extension = EnvVal('RINGCENTRAL_EXTENSION')
25+
config.password = EnvVal('RINGCENTRAL_PASSWORD')
2626
end
2727
puts RingCentralSdk::VERSION
2828

scripts/fax_send.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
Dotenv.load ENV['ENV_PATH'] || '.env'
1111

1212
client = RingCentralSdk::REST::Client.new do |config|
13-
config.server_url = ENV['RINGCENTRAL_SERVER_URL']
14-
config.app_key = ENV['RINGCENTRAL_CLIENT_ID']
15-
config.app_secret = ENV['RINGCENTRAL_CLIENT_SECRET']
16-
config.username = ENV['RINGCENTRAL_USERNAME']
17-
config.extension = ENV['RINGCENTRAL_EXTENSION']
18-
config.password = ENV['RINGCENTRAL_PASSWORD']
13+
config.server_url = ENV['RINGCENTRAL_SERVER_URL']
14+
config.client_id = ENV['RINGCENTRAL_CLIENT_ID']
15+
config.client_secret = ENV['RINGCENTRAL_CLIENT_SECRET']
16+
config.username = ENV['RINGCENTRAL_USERNAME']
17+
config.extension = ENV['RINGCENTRAL_EXTENSION']
18+
config.password = ENV['RINGCENTRAL_PASSWORD']
1919
end
2020

2121
res = client.messages.fax.create(

scripts/oauth2-sinatra/app.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
Dotenv.load ENV['ENV_PATH'] || '.env'
1212

1313
client = RingCentralSdk::REST::Client.new do |config|
14-
config.server_url = ENV['RINGCENTRAL_SERVER_URL']
15-
config.app_key = ENV['RINGCENTRAL_CLIENT_ID']
16-
config.app_secret = ENV['RINGCENTRAL_CLIENT_SECRET']
17-
config.redirect_url = ENV['RINGCENTRAL_REDIRECT_URL']
14+
config.server_url = ENV['RINGCENTRAL_SERVER_URL']
15+
config.client_id = ENV['RINGCENTRAL_CLIENT_ID']
16+
config.client_secret = ENV['RINGCENTRAL_CLIENT_SECRET']
17+
config.redirect_url = ENV['RINGCENTRAL_REDIRECT_URL']
1818
end
1919

2020
set :logger, Logger.new(STDOUT)

scripts/ringout.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
# Use the credentials_sample.env.txt file as a scaffold
1212

1313
client = RingCentralSdk::REST::Client.new do |config|
14-
config.server_url = ENV['RINGCENTRAL_SERVER_URL']
15-
config.app_key = ENV['RINGCENTRAL_CLIENT_ID']
16-
config.app_secret = ENV['RINGCENTRAL_CLIENT_SECRET']
17-
config.username = ENV['RINGCENTRAL_USERNAME']
18-
config.extension = ENV['RINGCENTRAL_EXTENSION']
19-
config.password = ENV['RINGCENTRAL_PASSWORD']
14+
config.server_url = ENV['RINGCENTRAL_SERVER_URL']
15+
config.client_id = ENV['RINGCENTRAL_CLIENT_ID']
16+
config.client_secret = ENV['RINGCENTRAL_CLIENT_SECRET']
17+
config.username = ENV['RINGCENTRAL_USERNAME']
18+
config.extension = ENV['RINGCENTRAL_EXTENSION']
19+
config.password = ENV['RINGCENTRAL_PASSWORD']
2020
end
2121

2222
def ringout(client, accountId, extensionId, to, from, callerId,playPrompt)

scripts/sms_send.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
Dotenv.load envPath
1212

1313
client = RingCentralSdk::REST::Client.new do |config|
14-
config.server_url = ENV['RINGCENTRAL_SERVER_URL']
15-
config.app_key = ENV['RINGCENTRAL_CLIENT_ID']
16-
config.app_secret = ENV['RINGCENTRAL_CLIENT_SECRET']
17-
config.username = ENV['RINGCENTRAL_USERNAME']
18-
config.extension = ENV['RINGCENTRAL_EXTENSION']
19-
config.password = ENV['RINGCENTRAL_PASSWORD']
14+
config.server_url = ENV['RINGCENTRAL_SERVER_URL']
15+
config.client_id = ENV['RINGCENTRAL_CLIENT_ID']
16+
config.client_secret = ENV['RINGCENTRAL_CLIENT_SECRET']
17+
config.username = ENV['RINGCENTRAL_USERNAME']
18+
config.extension = ENV['RINGCENTRAL_EXTENSION']
19+
config.password = ENV['RINGCENTRAL_PASSWORD']
2020
end
2121

2222

scripts/sms_send_mms.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
Dotenv.load envPath
1212

1313
client = RingCentralSdk::REST::Client.new do |config|
14-
config.server_url = ENV['RINGCENTRAL_SERVER_URL']
15-
config.app_key = ENV['RINGCENTRAL_CLIENT_ID']
16-
config.app_secret = ENV['RINGCENTRAL_CLIENT_SECRET']
17-
config.username = ENV['RINGCENTRAL_USERNAME']
18-
config.extension = ENV['RINGCENTRAL_EXTENSION']
19-
config.password = ENV['RINGCENTRAL_PASSWORD']
14+
config.server_url = ENV['RINGCENTRAL_SERVER_URL']
15+
config.client_id = ENV['RINGCENTRAL_CLIENT_ID']
16+
config.client_secret = ENV['RINGCENTRAL_CLIENT_SECRET']
17+
config.username = ENV['RINGCENTRAL_USERNAME']
18+
config.extension = ENV['RINGCENTRAL_EXTENSION']
19+
config.password = ENV['RINGCENTRAL_PASSWORD']
2020
end
2121

2222
def send_mms_object(client)

scripts/subscription.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
# Use the credentials_sample.env.txt file as a scaffold
1212

1313
client = RingCentralSdk::REST::Client.new do |config|
14-
config.app_key = ENV['RINGCENTRAL_CLIENT_ID']
15-
config.app_secret = ENV['RINGCENTRAL_CLIENT_SECRET']
14+
config.client_id = ENV['RINGCENTRAL_CLIENT_ID']
15+
config.client_secret = ENV['RINGCENTRAL_CLIENT_SECRET']
1616
config.server_url = ENV['RINGCENTRAL_SERVER_URL']
1717
config.username = ENV['RINGCENTRAL_USERNAME']
1818
config.extension = ENV['RINGCENTRAL_EXTENSION']

0 commit comments

Comments
 (0)