Class: UmengPusher::Client
- Inherits:
-
Object
- Object
- UmengPusher::Client
- Defined in:
- lib/umeng_pusher/client.rb
Constant Summary collapse
- CAST_TYPE =
%w|unicast listcast filecast broadcast groupcast customizedcast|
- SEND_URL =
"http://msg.umeng.com/api/send"
- STATUS_URL =
"http://msg.umeng.com/api/status"
- CANCEL_URL =
"http://msg.umeng.com/api/cancel"
- UPLOAD_URL =
"http://msg.umeng.com/upload"
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#file_id ⇒ Object
readonly
Returns the value of attribute file_id.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#platform ⇒ Object
readonly
Returns the value of attribute platform.
-
#ret ⇒ Object
readonly
Returns the value of attribute ret.
-
#task_id ⇒ Object
readonly
Returns the value of attribute task_id.
Instance Method Summary collapse
- #cancel ⇒ Object
-
#initialize(platform, options, debug_mode = true) ⇒ Client
constructor
A new instance of Client.
-
#send ⇒ Object
unicast-单播 listcast-列播,要求不超过500个device_token broadcast-广播 filecast-文件播,多个device_token可通过文件形式批量发送 groupcast-组播,按照filter筛选用户群,请参照filter参数 customizedcast,通过alias进行推送,包括以下两种case: -alias:对单个或者多个alias进行推送 -file_id:将alias存放到文件后,根据file_id来推送.
- #status ⇒ Object
- #upload ⇒ Object
Constructor Details
#initialize(platform, options, debug_mode = true) ⇒ Client
Returns a new instance of Client.
14 15 16 17 18 |
# File 'lib/umeng_pusher/client.rb', line 14 def initialize(platform, , debug_mode = true) @platform = platform @options = @debug_mode = debug_mode end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
7 8 9 |
# File 'lib/umeng_pusher/client.rb', line 7 def content @content end |
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
7 8 9 |
# File 'lib/umeng_pusher/client.rb', line 7 def error_code @error_code end |
#file_id ⇒ Object (readonly)
Returns the value of attribute file_id.
7 8 9 |
# File 'lib/umeng_pusher/client.rb', line 7 def file_id @file_id end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
7 8 9 |
# File 'lib/umeng_pusher/client.rb', line 7 def payload @payload end |
#platform ⇒ Object (readonly)
Returns the value of attribute platform.
7 8 9 |
# File 'lib/umeng_pusher/client.rb', line 7 def platform @platform end |
#ret ⇒ Object (readonly)
Returns the value of attribute ret.
7 8 9 |
# File 'lib/umeng_pusher/client.rb', line 7 def ret @ret end |
#task_id ⇒ Object (readonly)
Returns the value of attribute task_id.
7 8 9 |
# File 'lib/umeng_pusher/client.rb', line 7 def task_id @task_id end |
Instance Method Details
#cancel ⇒ Object
36 37 38 |
# File 'lib/umeng_pusher/client.rb', line 36 def cancel post(CANCEL_URL, Params.cancel_params(@platform, @options[:task_id])) end |
#send ⇒ Object
unicast-单播 listcast-列播,要求不超过500个device_token broadcast-广播 filecast-文件播,多个device_token可通过文件形式批量发送 groupcast-组播,按照filter筛选用户群,请参照filter参数 customizedcast,通过alias进行推送,包括以下两种case:
-alias:对单个或者多个alias进行推送
-file_id:将alias存放到文件后,根据file_id来推送
28 29 30 |
# File 'lib/umeng_pusher/client.rb', line 28 def send post(SEND_URL, Params.send_params(@platform, @options)) end |
#status ⇒ Object
32 33 34 |
# File 'lib/umeng_pusher/client.rb', line 32 def status post(STATUS_URL, Params.status_params(@platform, @options[:task_id])) end |
#upload ⇒ Object
40 41 42 |
# File 'lib/umeng_pusher/client.rb', line 40 def upload post(UPLOAD_URL, Params.upload_params(@platform, @options)) end |