class TestContacts

Public Instance Methods

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

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

  # get
  assert_not_nil(Pushbullet::V2::Contacts.get)

  # create
  created = Pushbullet::V2::Contacts.create('test contact', 'email-that-does-not-exist@earth.com')
  assert_not_nil(created)

  # update
  new_name = 'test contact 2'
  updated = Pushbullet::V2::Contacts.update(created['iden'], new_name)
  assert_not_nil(updated)
  assert_equal(updated['name'], new_name)

  # delete
  assert_not_nil(Pushbullet::V2::Contacts.delete(created['iden']))
end