Module: Umengo::Service
Instance Method Summary collapse
-
#cancel(task_id) ⇒ Object
取消任务 POST msg.umeng.com/api/cancel?sign=mysign.
-
#push(type, opts = {}) ⇒ Object
消息发送 POST msg.umeng.com/api/send?sign=mysign.
-
#status(task_id) ⇒ Object
查看状态 POST msg.umeng.com/api/status?sign=mysign.
Methods included from Util
Instance Method Details
#cancel(task_id) ⇒ Object
取消任务POST msg.umeng.com/api/cancel?sign=mysign
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/umengo/service.rb', line 45 def cancel(task_id) uri = 'api/cancel' params = { appkey: @appkey, timestamp: Time.now.to_i, task_id: task_id } perform(uri, params) end |
#push(type, opts = {}) ⇒ Object
消息发送POST msg.umeng.com/api/send?sign=mysign
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/umengo/service.rb', line 10 def push(type, opts={}) uri = 'api/send' data = opts.fetch(:data, {}).merge({ appkey: @appkey, timestamp: Time.now.to_i }) payload = opts.fetch(:payload, { display_type: "notifcation"} ) params = Params.new( data, payload, opts[:body], opts[:extra], opts[:policy] ).send "build_#{type}" perform(uri, params) end |
#status(task_id) ⇒ Object
查看状态POST msg.umeng.com/api/status?sign=mysign
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/umengo/service.rb', line 32 def status(task_id) uri = 'api/status' params = { appkey: @appkey, timestamp: Time.now.to_i, task_id: task_id } perform(uri, params) end |