@@ -3,6 +3,8 @@ module Agents |
||
3 | 3 |
cannot_be_scheduled! |
4 | 4 |
cannot_create_events! |
5 | 5 |
|
6 |
+ API_URL = 'https://api.pushbullet.com/v2/pushes' |
|
7 |
+ |
|
6 | 8 |
description <<-MD |
7 | 9 |
The Pushbullet agent sends pushes to a pushbullet device |
8 | 10 |
|
@@ -12,7 +14,7 @@ module Agents |
||
12 | 14 |
|
13 | 15 |
Currently you need to get a the device identification manually: |
14 | 16 |
|
15 |
- `curl -u <your api key here>: https://api.pushbullet.com/api/devices` |
|
17 |
+ `curl -u <your api key here>: https://api.pushbullet.com/v2/devices` |
|
16 | 18 |
|
17 | 19 |
To register a new device run the following command: |
18 | 20 |
|
@@ -53,7 +55,7 @@ module Agents |
||
53 | 55 |
|
54 | 56 |
def receive(incoming_events) |
55 | 57 |
incoming_events.each do |event| |
56 |
- response = HTTParty.post "https://api.pushbullet.com/api/pushes", query_options(event) |
|
58 |
+ response = HTTParty.post API_URL, query_options(event) |
|
57 | 59 |
error(response.body) if response.body.include? 'error' |
58 | 60 |
end |
59 | 61 |
end |
@@ -46,7 +46,7 @@ describe Agents::PushbulletAgent do |
||
46 | 46 |
|
47 | 47 |
describe "#receive" do |
48 | 48 |
it "send a message to the hipchat" do |
49 |
- stub_request(:post, "https://token:@api.pushbullet.com/api/pushes"). |
|
49 |
+ stub_request(:post, "https://token:@api.pushbullet.com/v2/pushes"). |
|
50 | 50 |
with(:body => "device_iden=124&title=hello%20from%20huginn&body=One%20two%20test&type=note"). |
51 | 51 |
to_return(:status => 200, :body => "ok", :headers => {}) |
52 | 52 |
dont_allow(@checker).error |
@@ -54,7 +54,7 @@ describe Agents::PushbulletAgent do |
||
54 | 54 |
end |
55 | 55 |
|
56 | 56 |
it "should log resquests which return an error" do |
57 |
- stub_request(:post, "https://token:@api.pushbullet.com/api/pushes"). |
|
57 |
+ stub_request(:post, "https://token:@api.pushbullet.com/v2/pushes"). |
|
58 | 58 |
with(:body => "device_iden=124&title=hello%20from%20huginn&body=One%20two%20test&type=note"). |
59 | 59 |
to_return(:status => 200, :body => "error", :headers => {}) |
60 | 60 |
mock(@checker).error("error") |