Ruby SDKs for Dingtalk(钉钉) API https://open.dingtalk.com/
Add this line to your application's Gemfile:
gem 'dingtalk-sdk'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install dingtalk-sdk
require 'dingtalk/sdk'
# config/initializers/dingtalk.rb
Dingtalk.configure do |config|
config.redis = Redis.new
# ...
end
回调数据签名和解密:
# 实例化回调对象
callback = Dingtalk::Callback.new(
encoding_aes_key: encoding_aes_key,
token: token,
corpid: corpid # 第三方应用使用 SuiteKey
)
# 数据解密
callback.decrypt(encrypt_str)
# 返回数据签名
callback.encrypt(message)
suite = Dingtalk::Client::Suite.new(
suite_id: suite_id,
app_id: app_id,
suite_key: suite_key,
suite_secret: suite_secret
)
更新 suite_ticket
suite.suite_ticket = xxx
app = Dingtalk::Client::IsvApp.new(
agent_id: agent_id,
corpid: corpid,
suite: suite # 套件对象
)
# 或者通过套件实例化
app = suite.isv_app(corpid: corpid, agent_id: agent_id)
app = Dingtalk::Client::CorpApp.new(
app_key: app_key,
app_secret: app_secret,
agent_id: agent_id
)
app.jsapi_ticket
如果你有好的意见或建议,欢迎给我们提issue或pull request。
The MIT License(http://opensource.org/licenses/MIT)
请自由地享受和参与开源