Sha256: 0f96b2a69c0a0bbb324f7b335d14d6b340d1fd50186be2ce4f2fe7c4b4b175ba

Contents?: true

Size: 945 Bytes

Versions: 11

Compression:

Stored size: 945 Bytes

Contents

require 'pushbullet_ruby/push'

module PushbulletRuby
  module API
    module Subscriptions
      def subscriptions
        PushbulletRuby::Channel.from_response(get('/v2/subscriptions'))
      end

      def channel_info(tag)
        PushbulletRuby::Channel.new(get('/v2/channel-info', tag: tag).body)
      end

      def recent_pushes(tag)
        channel_info(tag).body['recent_pushes'].each_with_object([]) do |push, memo|
          memo << PushbulletRuby::Push.new(push)
        end
      end

      def update_subscription(channel_id: nil, params: {})
        PushbulletRuby::Channel.new(post("/v2/subscriptions/#{channel_id}", params).body)
      end

      def delete_subscription(channel_id: nil)
        delete("/v2/subscriptions/#{channel_id}").body
      end

      def create_subscription(params: {})
        PushbulletRuby::Channel.new(post('/v2/subscriptions', params))
      end
    end
  end
end

Version data entries

11 entries across 10 versions & 2 rubygems

Version Path
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/pushbullet_ruby-1.1.4/lib/pushbullet_ruby/api/subscriptions.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/pushbullet_ruby-1.1.4/lib/pushbullet_ruby/api/subscriptions.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/pushbullet_ruby-1.1.4/lib/pushbullet_ruby/api/subscriptions.rb
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/pushbullet_ruby-1.1.4/lib/pushbullet_ruby/api/subscriptions.rb
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/pushbullet_ruby-1.1.4/lib/pushbullet_ruby/api/subscriptions.rb
pushbullet_ruby-1.1.4 lib/pushbullet_ruby/api/subscriptions.rb
tdiary-5.0.8 vendor/bundle/gems/pushbullet_ruby-1.1.3/lib/pushbullet_ruby/api/subscriptions.rb
pushbullet_ruby-1.1.3 lib/pushbullet_ruby/api/subscriptions.rb
pushbullet_ruby-1.1.2 lib/pushbullet_ruby/api/subscriptions.rb
pushbullet_ruby-1.1.1 lib/pushbullet_ruby/api/subscriptions.rb
pushbullet_ruby-1.1.0 lib/pushbullet_ruby/api/subscriptions.rb