UmengMessage
对友盟消息推送的接口封装,支持接口:
- 消息发送
- 任务类消息状态查询
- 任务类消息取消
- 文件上传
安装
Gemfile添加
gem 'umeng_message'
然后执行
$ bundle
使用
生成配置文件
rails generate umeng_message:install
推送、上传、查询、取消
UmengMessage::Subject.new('ios', options).push UmengMessage::Subject.new('ios', options).upload UmengMessage::Subject.new('ios', options).check UmengMessage::Subject.new('ios', options).cancel
options 参数
- check 与 cancel 只需要 task_id参数, upload 只需要content参数
- 示例: {'task_id': 'xxxxx'}
- 详细 options参数请查看官方文档
返回结果
- 返回结果以 error_code为nil表示发送成功,error_code为999时为网络等错误与友盟无关
- 拓展或自定义功能请自行拓展
- 默认请求超时是3秒
Contributing
- Fork it ( https://github.com/hzlu/umeng_message/fork )
- 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