获取SDK

gem install aliyunsdkcore

使用示例

require 'aliyunsdkcore'

client = RPCClient.new(
  endpoint:          'https://nlp-automl.cn-hangzhou.aliyuncs.com',
  api_version:       '2019-11-11',
  access_key_id:     ENV['ACCESS_KEY_ID'],
  access_key_secret: ENV['ACCESS_KEY_SECRET'],
)

request_option = { method: 'POST', timeout: 15000 }
response       = client.request(
  action: 'GetPredictResult',
  params: {
    "ModelId": "1818",
    "Content": "中华人民共和国解放军"
  },
  opts: request_option
)

print response