Class: Pushbullet::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/pushbullet/client.rb

Constant Summary collapse

API_VERSION =
2
END_POINT =
"https://api.pushbullet.com/v#{API_VERSION}/"

Instance Method Summary collapse

Instance Method Details

#delete(path, params = {}) ⇒ Object


20
21
22
# File 'lib/pushbullet/client.rb', line 20

def delete(path, params = {})
  JSON.parse(generic_request(path).delete params)
end

#generic_request(path) ⇒ Object


24
25
26
# File 'lib/pushbullet/client.rb', line 24

def generic_request(path)
  RestClient::Resource.new("#{END_POINT}#{path}", Pushbullet.api_token, '')
end

#get(path) ⇒ Object


8
9
10
# File 'lib/pushbullet/client.rb', line 8

def get(path)
  JSON.parse(generic_request(path).get)
end

#post(path, params = {}) ⇒ Object


12
13
14
# File 'lib/pushbullet/client.rb', line 12

def post(path, params = {})
  JSON.parse(generic_request(path).post params)
end

#put(path, params = {}) ⇒ Object


16
17
18
# File 'lib/pushbullet/client.rb', line 16

def put(path, params = {})
  JSON.parse(generic_request(path).put params)
end