class TestSubscriptions

Public Instance Methods

setup() click to toggle source
# File lib/v2/test/test_subscriptions.rb, line 21
def setup
  # do nothing
end
teardown() click to toggle source
# File lib/v2/test/test_subscriptions.rb, line 52
def teardown
  # do nothing
end
test_subscriptions() click to toggle source
# File lib/v2/test/test_subscriptions.rb, line 25
def test_subscriptions
  print '> input your Pushbullet access token: '
  input = STDIN.noecho(&:gets)

  assert_not_nil(input)
  access_token = input.chomp
  
  Pushbullet.set_access_token(access_token)

  # subscribe
  channel_tag = 'pushbullet'
  subscribed = Pushbullet::V2::Subscriptions.subscribe(channel_tag)
  assert_not_nil(subscribed)  # XXX - should check its result (it can be 'Already subscribed to this channel.' error)

  # get
  subscriptions = Pushbullet::V2::Subscriptions.get
  assert_not_nil(subscriptions)

  subscribed = subscriptions['subscriptions'].first

  # channel info
  assert_not_nil(Pushbullet::V2::Subscriptions.channel_info(subscribed['channel']['tag']))

  # unsubscribe
  assert_not_nil(Pushbullet::V2::Subscriptions.unsubscribe(subscribed['iden']))
end