这个gem是对 LeanCloud 的rest-api的一个ruby封装。 目前没有完成,只部分实现了push。
在api没完善前,暂无发布到rubygems上的计划,使用上请直接用github源。
Add this line to your application's Gemfile:
gem 'avos_service', :git => "https://github.com/baozoumanhua/avos_service"
And then execute:
$ bundle
在config/initializers下面,新建lean_cloud.rb
LeanCloud.configure do |config|
config.application_id = 'Your application id'
config.application_key = 'Your application key'
end
获取接口对象:
push = LeanCloud.push_service
推送数据:
data = {alert: '内容'}
push.push data
推送给指定设备:
push.push_to_installation data, YOUR_INSTALLATION_ID
自定义推送:
other_conditions = {where: {valid: true}}
push.push data, other_conditions
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request