Skip to content

Commit

Permalink
update scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
grokify committed Oct 18, 2015
1 parent 865a8b9 commit 8e3d838
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
8 changes: 4 additions & 4 deletions scripts/call_recording_download.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@

credentials = MultiJson.decode(IO.read(credentials_file))

rcsdk = RingCentralSdk::Sdk.new(
rcsdk = RingCentralSdk.new(
credentials['app_key'],
credentials['app_secret'],
credentials['server']
)

rcsdk.platform.authorize(
rcsdk.authorize(
credentials['username'],
credentials['extension'],
credentials['password']
)

# Retrieve voice call log records with recordings
response = rcsdk.platform.client.get do |req|
response = rcsdk.client.get do |req|
params = {:type => 'Voice', :withRecording => 'True',:dateFrom=>'2015-01-01'}
req.url 'account/~/extension/~/call-log', params
end
Expand All @@ -44,7 +44,7 @@
next
end

response_file = rcsdk.platform.client.get do |req|
response_file = rcsdk.client.get do |req|
req.url record['recording']['contentUri']
end

Expand Down
4 changes: 2 additions & 2 deletions scripts/fax_send.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
abort("Error: file to fax does not exist for: #{file_name}")
end

rcsdk = RingCentralSdk::Sdk.new(
rcsdk = RingCentralSdk.new(
credentials['app_key'],
credentials['app_secret'],
credentials['server']
Expand All @@ -56,7 +56,7 @@

puts fax.body

client = rcsdk.platform.client
client = rcsdk.client

if 1==1
response = client.post do |req|
Expand Down
10 changes: 6 additions & 4 deletions scripts/oauth2-sinatra/oauth2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@
# ENTER YOUR INFORMATION HERE
app_key = 'my_app_key'
app_secret = 'my_app_secret'
app_key = 'uDiWXZzyQh2JuhkaH5NgGA'
app_secret = 'NT1x4XJNTIiPUtIp4gjZIw4Kh0j2JHR8m4h2gGQuq76A'
redirect_uri = 'http://localhost:4567/oauth'
# END CONFIG

rcsdk = RingCentralSdk::Sdk.new(
rcsdk = RingCentralSdk.new(
app_key,
app_secret,
RingCentralSdk::Sdk::RC_SERVER_SANDBOX,
RingCentralSdk::RC_SERVER_SANDBOX,
{:redirect_uri => redirect_uri}
)

get '/' do
erb :index, :locals => {
:authorize_url => rcsdk.platform.authorize_url(),
:authorize_url => rcsdk.authorize_url(),
:redirect_uri => redirect_uri
}
end
Expand All @@ -29,7 +31,7 @@
code = params.has_key?('code') ? params['code'] : ''
token_json = ''
if code
token = rcsdk.platform.authorize_code(code)
token = rcsdk.authorize_code(code)
token_json = MultiJson.encode(token.to_hash, :pretty=>true)
end
erb :oauth, :locals => {
Expand Down

0 comments on commit 8e3d838

Please sign in to comment.