Sha256: b5c730169ccd304e3d297c3ebccd89f6312e545f709260eb3f217a07ab8bea24

Contents?: true

Size: 498 Bytes

Versions: 2

Compression:

Stored size: 498 Bytes

Contents

require 'pushbullet_ruby/api'

module PushbulletRuby
  class Channel
    attr_reader :body

    def self.from_response(response)
      response.body['subscriptions'].map do |attributes|
        next unless attributes['active']
        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

2 entries across 2 versions & 1 rubygems

Version Path
pushbullet_ruby-1.0.3 lib/pushbullet_ruby/channel.rb
pushbullet_ruby-1.0.2.1 lib/pushbullet_ruby/channel.rb