Project

lean_cloud

0.0
No commit activity in last 3 years
No release in over 3 years
LeanCloud SDK.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.9.2
~> 2.5

Runtime

 Project Readme

LeanCloud

This project rocks and uses MIT-LICENSE.

Usage

gem "lean_cloud"

LeanCloud::Feedback.create({}) # 用户反馈
LeanCloud::Function.run(function)
....

更多请查看 lib/lean_cloud/modules

配置

LeanCloud.configure do
  config.app_id     = "11f6ad8ec52a2984abaafd7c3b516503785c2072"
  config.app_key    = "11f6ad8ec52a2984abaafd7c3b516503785c2072"
  config.master_key = "11f6ad8ec52a2984abaafd7c3b516503785c2072"
  config.host       = "https://leancloud.cn"
  config.version    = "1.1"
end

在数据管理中添加一个class(GameScore)后:

# the namespace option will generate https://leancloud.cn/1.1/classes/GameScore
LeanCloud.register "GameScore", namespace: "classes/GameScore" do
  only :create, :update, :show, :destroy, :search

  # GET https://leancloud.cn/1.1/classes/GameScore/sms/:code
  match "sms/:code", via: :get, as: get_code  # LeanCloud::GameScore.get_code(code) 
  # GET https://leancloud.cn/1.1/sms/:code
  match "sms/:code", via: :get, as: get_code, unscope: true  # LeanCloud::GameScore.get_code(code)
  # GET https://leancloud.cn/1.1/classes/GameScore/:id/sms/:code
  match "sms/:code", via: :get, as: get_code, on: :member  # LeanCloud::GameScore.get_code(id, code)
  
  # GET https://leancloud.cn/1.1/classes/GameScore/result
  route :result
end
然后使用如下方式进行调用接口
LeanCloud::GameScore.create({score: 'xxx'})
LeanCloud::GameScore.show("11f6ad8ec52a2984abaafd7c3b516503785c2072")
LeanCloud::GameScore.update("11f6ad8ec52a2984abaafd7c3b516503785c2072", {score: 'e'})
LeanCloud::GameScore.destroy("11f6ad8ec52a2984abaafd7c3b516503785c2072")
LeanCloud::GameScore.search(where: {post: {_type: 'xxx'}}.to_json)