Skip to content

Instantly share code, notes, and snippets.

@mimosa
Created May 7, 2014 10:08
Show Gist options
  • Select an option

  • Save mimosa/0f2760e97534c80f841a to your computer and use it in GitHub Desktop.

Select an option

Save mimosa/0f2760e97534c80f841a to your computer and use it in GitHub Desktop.
语音验证码
gem 'cloopen_rest', github: '9577/cloopen_rest', require: false
# -*- encoding: utf-8 -*-
require 'cloopen_rest'
def auth
{
uid: 'aaf98fda45d5903f0145d5e642590064',
tid: 'f3cb84d5e3a74f2e82ab3bca39d3160a',
aid: 'aaf98fda45d5903f0145d5ecaace0077'
}
end
def cloopen
@cloopen ||= Cloopen::REST::Client.new(auth[:uid], auth[:tid], auth[:aid]).account
end
def send_voice(mobile, code, replay=3)
voice = cloopen.calls.voice_verify.create(
'appId' => auth[:aid],
'to' => mobile,
'verifyCode' => code,
'playTimes' => replay
)
resp = voice.response
puts resp.body
puts '_'*88
resp.status_code == '000000'
end
send_voice(18158102598, 656565)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment