Class: Pushbullet::Client
- Inherits:
-
Object
- Object
- Pushbullet::Client
- 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
- #delete(path, params = {}) ⇒ Object
- #generic_request(path) ⇒ Object
- #get(path) ⇒ Object
- #post(path, params = {}) ⇒ Object
- #put(path, params = {}) ⇒ Object
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, &handle_error) 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 &handle_error) 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, &handle_error) 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, &handle_error) end |