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
- #update(client: nil, params: {}) ⇒ Object
Constructor Details
#initialize(response) ⇒ Channel
Returns a new instance of Channel.
17 18 19 |
# File 'lib/pushbullet_ruby/channel.rb', line 17 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
6 7 8 9 10 11 |
# File 'lib/pushbullet_ruby/channel.rb', line 6 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
29 30 31 |
# File 'lib/pushbullet_ruby/channel.rb', line 29 def id body['iden'] end |
#name ⇒ Object
25 26 27 |
# File 'lib/pushbullet_ruby/channel.rb', line 25 def name body['name'] end |
#tag ⇒ Object
21 22 23 |
# File 'lib/pushbullet_ruby/channel.rb', line 21 def tag body['tag'] end |
#update(client: nil, params: {}) ⇒ Object
13 14 15 |
# File 'lib/pushbullet_ruby/channel.rb', line 13 def update(client: nil, params: {}) client.update_subscription(channel_id: self.id, params: params) end |