Class: Pushbullet::Channel

Inherits:
Resource
  • Object
show all
Includes:
Pushable
Defined in:
lib/pushbullet/channel.rb

Class Method Summary collapse

Methods included from Pushable

#push_address, #push_link, #push_list, #push_note

Methods inherited from Resource

all, create, #destroy, #save

Class Method Details

.get_info(tag) ⇒ Object



14
15
16
17
18
# File 'lib/pushbullet/channel.rb', line 14

def self.get_info(tag)
  channel = new Pushbullet.client.get("channel-info?tag=#{tag}")
  channel.recent_pushes.map! { |push| Pushbullet::Push.new push }
  channel
end

.pathObject



20
21
22
# File 'lib/pushbullet/channel.rb', line 20

def self.path
  'subscriptions'
end

.subscribe(name) ⇒ Object



5
6
7
# File 'lib/pushbullet/channel.rb', line 5

def self.subscribe(name)
  create(channel_tag: name)
end

.unsubscribe(idn) ⇒ Object



9
10
11
12
# File 'lib/pushbullet/channel.rb', line 9

def self.unsubscribe(idn)
  Pushbullet.client.delete "#{path}/#{idn}"
  true
end