Class: PushbulletRuby::Channel
- Inherits:
-
Object
- Object
- PushbulletRuby::Channel
- Defined in:
- lib/pushbullet_ruby/channel.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
Class Method Summary collapse
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(response) ⇒ Channel
constructor
A new instance of Channel.
- #name ⇒ Object
- #tag ⇒ Object
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
#body ⇒ Object (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
#id ⇒ Object
26 27 28 |
# File 'lib/pushbullet_ruby/channel.rb', line 26 def id body['iden'] end |
#name ⇒ Object
22 23 24 |
# File 'lib/pushbullet_ruby/channel.rb', line 22 def name body['name'] end |
#tag ⇒ Object
18 19 20 |
# File 'lib/pushbullet_ruby/channel.rb', line 18 def tag body['tag'] end |