Sha256: 1874462994aaf4ed9f07dfe406f2e7c18253ea67ad079cbd01824a89185cbcda

Contents?: true

Size: 529 Bytes

Versions: 4

Compression:

Stored size: 529 Bytes

Contents

require 'pushbullet_ruby/api'

module PushbulletRuby
  class Channel
    attr_reader :body

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

    def initialize(response)
      @body = response
    end

    def tag
      body['tag']
    end

    def name
      body['name']
    end

    def id
      body['iden']
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pushbullet_ruby-1.1.0 lib/pushbullet_ruby/channel.rb
pushbullet_ruby-1.0.4.1 lib/pushbullet_ruby/channel.rb
pushbullet_ruby-1.0.4 lib/pushbullet_ruby/channel.rb
pushbullet_ruby-1.0.2 lib/pushbullet_ruby/channel.rb