Class: Pushbullet::V2::Contacts

Inherits:
Object
  • Object
show all
Defined in:
lib/v2/contacts.rb

Constant Summary collapse

API_URL =
'https://api.pushbullet.com/v2/contacts'

Class Method Summary collapse

Class Method Details

.create(name, email) ⇒ JSON

create a new contact



36
37
38
39
40
41
42
43
# File 'lib/v2/contacts.rb', line 36

def self.create(name, email)
  result = Pushbullet::V2::request(API_URL, {
    name: name,
    email: email,
  })

  JSON.parse(result.body)
end

.delete(contact_iden) ⇒ JSON

delete a contact



62
63
64
65
66
# File 'lib/v2/contacts.rb', line 62

def self.delete(contact_iden)
  result = Pushbullet::V2::request_delete(API_URL + '/' + contact_iden, {})

  JSON.parse(result.body)
end

.getJSON

get contacts list



25
26
27
28
29
# File 'lib/v2/contacts.rb', line 25

def self.get
  result = Pushbullet::V2::request_get(API_URL, {})

  JSON.parse(result.body)
end

.update(contact_iden, name) ⇒ JSON

update a contact



50
51
52
53
54
55
56
# File 'lib/v2/contacts.rb', line 50

def self.update(contact_iden, name)
  result = Pushbullet::V2::request(API_URL + '/' + contact_iden, {
    name: name,
  })

  JSON.parse(result.body)
end