Class: Xiaomi::Push::Services::Topic
- Inherits:
-
Object
- Object
- Xiaomi::Push::Services::Topic
- Defined in:
- lib/xiaomi/push/services/topic.rb
Overview
标签类 API
Instance Attribute Summary collapse
-
#context ⇒ Client
The current value of context.
Instance Method Summary collapse
-
#initialize(context) ⇒ Topic
constructor
初始化.
-
#subscribe(**options) ⇒ Hash
订阅标签.
-
#unsubscribe(**options) ⇒ Hash
取消订阅标签.
Constructor Details
#initialize(context) ⇒ Topic
初始化
13 14 15 |
# File 'lib/xiaomi/push/services/topic.rb', line 13 def initialize(context) @context = context end |
Instance Attribute Details
#context ⇒ Client
Returns the current value of context.
7 8 9 |
# File 'lib/xiaomi/push/services/topic.rb', line 7 def context @context end |
Instance Method Details
#subscribe(**options) ⇒ Hash
订阅标签
可使用 reg id 或 alias 的方式订阅标签
32 33 34 35 |
# File 'lib/xiaomi/push/services/topic.rb', line 32 def subscribe(**) url, params = prepare_params(__method__.to_s, ) @context.post(url, params) end |
#unsubscribe(**options) ⇒ Hash
取消订阅标签
可使用 reg id 或 alias 的方式取消订阅标签
52 53 54 55 |
# File 'lib/xiaomi/push/services/topic.rb', line 52 def unsubscribe(**) url, params = prepare_params(__method__.to_s, ) @context.post(url, params) end |