Class: Xiaomi::Push::Services::User
- Inherits:
-
Object
- Object
- Xiaomi::Push::Services::User
- Defined in:
- lib/xiaomi/push/services/user.rb
Overview
用户查询类 API
比如查找用户设置的 Alias 和 Topic 等
Instance Attribute Summary collapse
-
#context ⇒ Client
The current value of context.
Instance Method Summary collapse
-
#aliases(reg_id, package_name = nil) ⇒ Hash
根据 reg id 查找绑定的别名(aliases).
-
#initialize(context) ⇒ User
constructor
初始化.
-
#topices(reg_id, package_name = nil) ⇒ Hash
根据 reg id 查找设置的标签(Topics).
Constructor Details
#initialize(context) ⇒ User
初始化
14 15 16 |
# File 'lib/xiaomi/push/services/user.rb', line 14 def initialize(context) @context = context end |
Instance Attribute Details
#context ⇒ Client
Returns the current value of context.
8 9 10 |
# File 'lib/xiaomi/push/services/user.rb', line 8 def context @context end |
Instance Method Details
#aliases(reg_id, package_name = nil) ⇒ Hash
根据 reg id 查找绑定的别名(aliases)
一个 reg id 可以绑定多个 alias
31 32 33 34 |
# File 'lib/xiaomi/push/services/user.rb', line 31 def aliases(reg_id, package_name = nil) url = @context.build_uri('alias/all') @context.get(url, reg_params(reg_id, package_name)) end |
#topices(reg_id, package_name = nil) ⇒ Hash
根据 reg id 查找设置的标签(Topics)
一个 reg id 可以绑定多个 topic
43 44 45 46 |
# File 'lib/xiaomi/push/services/user.rb', line 43 def topices(reg_id, package_name = nil) url = @context.build_uri('topic/all') @context.get(url, reg_params(reg_id, package_name)) end |