Class: PushbulletRuby::Channel

Inherits:
Object
  • Object
show all
Defined in:
lib/pushbullet_ruby/channel.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Channel

Returns a new instance of Channel.



14
15
16
# File 'lib/pushbullet_ruby/channel.rb', line 14

def initialize(response)
  @body = response
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



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

def body
  @body
end

Class Method Details

.from_response(response) ⇒ Object



7
8
9
10
11
12
# File 'lib/pushbullet_ruby/channel.rb', line 7

def self.from_response(response)
  response.body['subscriptions'].each_with_object([]) do |attributes, memo|
    next unless attributes['active']
    memo << new(attributes['channel'])
  end
end

Instance Method Details

#idObject



26
27
28
# File 'lib/pushbullet_ruby/channel.rb', line 26

def id
  body['iden']
end

#nameObject



22
23
24
# File 'lib/pushbullet_ruby/channel.rb', line 22

def name
  body['name']
end

#tagObject



18
19
20
# File 'lib/pushbullet_ruby/channel.rb', line 18

def tag
  body['tag']
end