Module: PushbulletRuby::API::Subscriptions
- Included in:
- PushbulletRuby::API
- Defined in:
- lib/pushbullet_ruby/api/subscriptions.rb
Instance Method Summary collapse
- #channel_info(tag) ⇒ Object
- #create_subscription(params: {}) ⇒ Object
- #delete_subscription(channel_id: nil) ⇒ Object
- #recent_pushes(tag) ⇒ Object
- #subscriptions ⇒ Object
- #update_subscription(channel_id: nil, params: {}) ⇒ Object
Instance Method Details
#channel_info(tag) ⇒ Object
10 11 12 |
# File 'lib/pushbullet_ruby/api/subscriptions.rb', line 10 def channel_info(tag) PushbulletRuby::Channel.new(get('/v2/channel-info', tag: tag).body) end |
#create_subscription(params: {}) ⇒ Object
28 29 30 |
# File 'lib/pushbullet_ruby/api/subscriptions.rb', line 28 def create_subscription(params: {}) PushbulletRuby::Channel.new(post('/v2/subscriptions', params)) end |
#delete_subscription(channel_id: nil) ⇒ Object
24 25 26 |
# File 'lib/pushbullet_ruby/api/subscriptions.rb', line 24 def delete_subscription(channel_id: nil) delete("/v2/subscriptions/#{channel_id}").body end |
#recent_pushes(tag) ⇒ Object
14 15 16 17 18 |
# File 'lib/pushbullet_ruby/api/subscriptions.rb', line 14 def recent_pushes(tag) channel_info(tag).body['recent_pushes'].each_with_object([]) do |push, memo| memo << PushbulletRuby::Push.new(push) end end |
#subscriptions ⇒ Object
6 7 8 |
# File 'lib/pushbullet_ruby/api/subscriptions.rb', line 6 def subscriptions PushbulletRuby::Channel.from_response(get('/v2/subscriptions')) end |
#update_subscription(channel_id: nil, params: {}) ⇒ Object
20 21 22 |
# File 'lib/pushbullet_ruby/api/subscriptions.rb', line 20 def update_subscription(channel_id: nil, params: {}) PushbulletRuby::Channel.new(post("/v2/subscriptions/#{channel_id}", params).body) end |