ruby-pushbullet 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -1
- data/lib/pushbullet.rb +1 -0
- data/lib/pushbullet/channel.rb +19 -0
- data/lib/pushbullet/client.rb +16 -4
- data/lib/pushbullet/error.rb +5 -0
- data/spec/fixtures/vcr_cassettes/channel_info.yml +89 -0
- data/spec/fixtures/vcr_cassettes/channel_subscribe.yml +47 -0
- data/spec/fixtures/vcr_cassettes/channel_unsubscribe.yml +42 -0
- data/spec/fixtures/vcr_cassettes/get_error.yml +42 -0
- data/spec/pushbullet/channel_spec.rb +47 -0
- data/spec/pushbullet/client_spec.rb +27 -0
- data/spec/shared/error_handling.rb +13 -0
- data/spec/spec_helper.rb +2 -0
- metadata +97 -82
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2e05f7318c86a09bb511d28c63811242e2dc180
|
4
|
+
data.tar.gz: 38ee3dd285e45f43a1bb1bd495ace4925fce26e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6af85d29376b9873b168233aa4753ed13a2b625883066f2c11a01316f83d1f40bdac5b7c47d53bd2b28ead685ad7ffb3d190a4c9c13c85e2e3890d85156bf0b9
|
7
|
+
data.tar.gz: 90198955dcaf00b4a8a44eea8a1968a3be04a36f0215b305bbce07f0ea07cef40294f01bcab6637d3c8c6d14ed30fae68b2464dc22172080fe0c03f438f07438
|
data/README.md
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
# Ruby Pushbullet API
|
2
2
|
|
3
|
-
|
3
|
+
Stable:
|
4
|
+
[![Build Status](https://travis-ci.org/letz/ruby-pushbullet.svg?branch=master)](https://travis-ci.org/letz/ruby-pushbullet)
|
5
|
+
Dev:
|
6
|
+
[![Build Status](https://travis-ci.org/letz/ruby-pushbullet.svg?branch=development)](https://travis-ci.org/letz/ruby-pushbullet)
|
7
|
+
|
4
8
|
[![Code Climate](https://codeclimate.com/github/letz/ruby-pushbullet/badges/gpa.svg)](https://codeclimate.com/github/letz/ruby-pushbullet)
|
9
|
+
[![Gem Version](https://badge.fury.io/rb/ruby-pushbullet.svg)](http://badge.fury.io/rb/ruby-pushbullet)
|
5
10
|
|
6
11
|
|
7
12
|
This library is an implementation of [Pushbullet API](https://docs.pushbullet.com/http)
|
data/lib/pushbullet.rb
CHANGED
data/lib/pushbullet/channel.rb
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
module Pushbullet
|
2
2
|
class Channel < Resource
|
3
3
|
include Pushable
|
4
|
+
|
5
|
+
def self.subscribe(name)
|
6
|
+
create(channel_tag: name)
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.unsubscribe(idn)
|
10
|
+
Pushbullet.client.delete "#{path}/#{idn}"
|
11
|
+
true
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.get_info(tag)
|
15
|
+
channel = new Pushbullet.client.get("channel-info?tag=#{tag}")
|
16
|
+
channel.recent_pushes.map! { |push| Pushbullet::Push.new push }
|
17
|
+
channel
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.path
|
21
|
+
'subscriptions'
|
22
|
+
end
|
4
23
|
end
|
5
24
|
end
|
data/lib/pushbullet/client.rb
CHANGED
@@ -6,23 +6,35 @@ module Pushbullet
|
|
6
6
|
END_POINT = "https://api.pushbullet.com/v#{API_VERSION}/"
|
7
7
|
|
8
8
|
def get(path)
|
9
|
-
JSON.parse(generic_request(path).get)
|
9
|
+
JSON.parse(generic_request(path).get &handle_error)
|
10
10
|
end
|
11
11
|
|
12
12
|
def post(path, params = {})
|
13
|
-
JSON.parse(generic_request(path).post params)
|
13
|
+
JSON.parse(generic_request(path).post params, &handle_error)
|
14
14
|
end
|
15
15
|
|
16
16
|
def put(path, params = {})
|
17
|
-
JSON.parse(generic_request(path).put params)
|
17
|
+
JSON.parse(generic_request(path).put params, &handle_error)
|
18
18
|
end
|
19
19
|
|
20
20
|
def delete(path, params = {})
|
21
|
-
JSON.parse(generic_request(path).delete params)
|
21
|
+
JSON.parse(generic_request(path).delete params, &handle_error)
|
22
22
|
end
|
23
23
|
|
24
24
|
def generic_request(path)
|
25
25
|
RestClient::Resource.new("#{END_POINT}#{path}", Pushbullet.api_token, '')
|
26
26
|
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def handle_error
|
31
|
+
proc do |response, request, result, &block|
|
32
|
+
if response.code >= 400 && response.code <= 500
|
33
|
+
fail Pushbullet::Error, JSON.parse(response)['error']['message']
|
34
|
+
else
|
35
|
+
response.return!(request, result, &block)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
27
39
|
end
|
28
40
|
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://DhOX5Q8Fps9mq4g90yfrfioRPyo1qQRd:@api.pushbullet.com/v2/channel-info?tag=jblow
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*; q=0.5, application/xml"
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
X-Ratelimit-Limit:
|
22
|
+
- '16384'
|
23
|
+
X-Ratelimit-Remaining:
|
24
|
+
- '16376'
|
25
|
+
X-Ratelimit-Reset:
|
26
|
+
- '1422839172'
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Date:
|
30
|
+
- Mon, 02 Feb 2015 01:02:44 GMT
|
31
|
+
Server:
|
32
|
+
- Google Frontend
|
33
|
+
Cache-Control:
|
34
|
+
- private
|
35
|
+
Transfer-Encoding:
|
36
|
+
- chunked
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"iden":"ujxPklLhvyKsjAvkMyTVh6","name":"Jonathan Blow","tag":"jblow","description":"New
|
40
|
+
comments on the web by Jonathan Blow.","image_url":"https://pushbullet.imgix.net/ujxPklLhvyK-6fXf4O2JQ1dBKQedhypIKwPX0lyFfwXW/jonathan-blow.png","subscriber_count":2,"recent_pushes":[{"active":true,"created":1.4228082603693361e+09,"modified":1.4228082603693361e+09,"type":"link","dismissed":false,"sender_name":"Jonathan
|
41
|
+
Blow","channel_iden":"ujxPklLhvyKsjAvkMyTVh6","title":"New comment on HN by
|
42
|
+
Jonathan Blow","body":"My point is that you can solve this one symptom but
|
43
|
+
your program will have many other problems due to GC (provided it does a lot
|
44
|
+
of work). It is like whack-a-mole in that there are always more moles.","url":"https://news.ycombinator.com/item?id=8980421"},{"active":true,"created":1.422798660727149e+09,"modified":1.422798660727149e+09,"type":"link","dismissed":false,"sender_name":"Jonathan
|
45
|
+
Blow","channel_iden":"ujxPklLhvyKsjAvkMyTVh6","title":"New comment on HN by
|
46
|
+
Jonathan Blow","body":"It is only an implementation issue if it is possible
|
47
|
+
to solve the issue.\u003cp\u003eNobody has ever built a garbage collector
|
48
|
+
that does not slow your program down or cause it to use vastly more resources
|
49
|
+
than it would otherwise. (Claims to the contrary are always implicitly caveated).\u003cp\u003eGiven
|
50
|
+
that this is the case, it really does start looking like a language issue.
|
51
|
+
Yes you can rearchitect the GC to care more about locality, but you are just
|
52
|
+
pushing the dust around on the floor: you will find a different problem.","url":"https://news.ycombinator.com/item?id=8979853"},{"active":true,"created":1.4227266561493518e+09,"modified":1.4227266561493518e+09,"type":"link","dismissed":false,"sender_name":"Jonathan
|
53
|
+
Blow","channel_iden":"ujxPklLhvyKsjAvkMyTVh6","title":"New comment on HN by
|
54
|
+
Jonathan Blow","body":"Show me your commits where you''ve fixed lots of driver
|
55
|
+
bugs. You sound like you have no idea what you''re talking about.","url":"https://news.ycombinator.com/item?id=8977344"},{"active":true,"created":1.4223061366878679e+09,"modified":1.4223061366878679e+09,"type":"link","dismissed":false,"sender_name":"Jonathan
|
56
|
+
Blow","channel_iden":"ujxPklLhvyKsjAvkMyTVh6","title":"New comment on HN by
|
57
|
+
Jonathan Blow","body":"Which is why people who are serious about memory write
|
58
|
+
their own allocators (or link preferred allocators with known behavior). It
|
59
|
+
is an extremely common thing.","url":"https://news.ycombinator.com/item?id=8949509"},{"active":true,"created":1.422302518161314e+09,"modified":1.422302518161314e+09,"type":"link","dismissed":false,"sender_name":"Jonathan
|
60
|
+
Blow","channel_iden":"ujxPklLhvyKsjAvkMyTVh6","title":"New comment on HN by
|
61
|
+
Jonathan Blow","body":"It''s bad.\u003cp\u003eThe reason is because you don''t
|
62
|
+
control the GC and don''t even necessarily know what exactly drives the decisions
|
63
|
+
it makes. So once you want to go beyond a certain level of performance, there
|
64
|
+
is no right answer. You are just randomly trying stuff and kind of flailing.\u003cp\u003eIn
|
65
|
+
C++ (or another direct-memory language), there \u003ci\u003eis\u003c/i\u003e
|
66
|
+
a right answer. You can always make the memory do exactly what you want it
|
67
|
+
to, and there''s always a clear path to get there from wherever you are.","url":"https://news.ycombinator.com/item?id=8949194"},{"active":true,"created":1.422225070409618e+09,"modified":1.422225070409618e+09,"type":"link","dismissed":false,"sender_name":"Jonathan
|
68
|
+
Blow","channel_iden":"ujxPklLhvyKsjAvkMyTVh6","title":"New comment on HN by
|
69
|
+
Jonathan Blow","body":"No, no it isn''t.\u003cp\u003eThere is always some
|
70
|
+
garbage velocity beyond which any given system is not able to cope.\u003cp\u003eUsually
|
71
|
+
that limit is kinda small compared to what you''d actually like your program
|
72
|
+
to be able to do.","url":"https://news.ycombinator.com/item?id=8944488"},{"active":true,"created":1.42222203965698e+09,"modified":1.42222203965698e+09,"type":"link","dismissed":false,"sender_name":"Jonathan
|
73
|
+
Blow","channel_iden":"ujxPklLhvyKsjAvkMyTVh6","title":"New comment on HN by
|
74
|
+
Jonathan Blow","body":"When I think of what I want in an operating system,
|
75
|
+
\"I wish it would lock up occasionally while everything garbage collects\"
|
76
|
+
is not high on the list.","url":"https://news.ycombinator.com/item?id=8944355"},{"active":true,"created":1.4218015277376e+09,"modified":1.4218015277376e+09,"type":"link","dismissed":false,"sender_name":"Jonathan
|
77
|
+
Blow","channel_iden":"ujxPklLhvyKsjAvkMyTVh6","title":"New comment on HN by
|
78
|
+
Jonathan Blow","body":"You can''t schedule something unknown.","url":"https://news.ycombinator.com/item?id=8920782"},{"active":true,"created":1.421376056481366e+09,"modified":1.421376056481366e+09,"type":"link","dismissed":false,"sender_name":"Jonathan
|
79
|
+
Blow","channel_iden":"ujxPklLhvyKsjAvkMyTVh6","title":"New comment on HN by
|
80
|
+
Jonathan Blow","body":"Steam doesn''t deal with its own files. It deals mainly
|
81
|
+
with random games that are creating tons of random files.","url":"https://news.ycombinator.com/item?id=8896969"},{"active":true,"created":1.420861842632239e+09,"modified":1.420861842632239e+09,"type":"link","dismissed":false,"sender_name":"Jonathan
|
82
|
+
Blow","channel_iden":"ujxPklLhvyKsjAvkMyTVh6","title":"New comment on HN by
|
83
|
+
Jonathan Blow","body":"See this graph:\u003cp\u003e\u003ca href=\"http://www.extremetech.com/wp-content/uploads/2013/08/CPU-Scaling.jpg\"
|
84
|
+
rel=\"nofollow\"\u003ehttp://www.extremetech.com/wp-content/uploads/2013/08/CPU-Sc...\u003c/a\u003e\u003cp\u003eThe
|
85
|
+
green line was the only one still going, and it plateaued about a year ago
|
86
|
+
(you''d see that in a newer graph).","url":"https://news.ycombinator.com/item?id=8865836"}]}'
|
87
|
+
http_version:
|
88
|
+
recorded_at: Mon, 02 Feb 2015 01:02:44 GMT
|
89
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,47 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://DhOX5Q8Fps9mq4g90yfrfioRPyo1qQRd:@api.pushbullet.com/v2/subscriptions
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: channel_tag=jblow
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*; q=0.5, application/xml"
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
Content-Length:
|
15
|
+
- '17'
|
16
|
+
Content-Type:
|
17
|
+
- application/x-www-form-urlencoded
|
18
|
+
User-Agent:
|
19
|
+
- Ruby
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
X-Ratelimit-Limit:
|
26
|
+
- '16384'
|
27
|
+
X-Ratelimit-Remaining:
|
28
|
+
- '16375'
|
29
|
+
X-Ratelimit-Reset:
|
30
|
+
- '1422844422'
|
31
|
+
Content-Type:
|
32
|
+
- application/json; charset=utf-8
|
33
|
+
Date:
|
34
|
+
- Mon, 02 Feb 2015 01:45:39 GMT
|
35
|
+
Server:
|
36
|
+
- Google Frontend
|
37
|
+
Cache-Control:
|
38
|
+
- private
|
39
|
+
Transfer-Encoding:
|
40
|
+
- chunked
|
41
|
+
body:
|
42
|
+
encoding: UTF-8
|
43
|
+
string: '{"active":true,"iden":"ujx7XdJ9W8qsjAlOnVVSqy","created":1.4228415395417912e+09,"modified":1.422841539541797e+09,"channel":{"iden":"ujxPklLhvyKsjAvkMyTVh6","tag":"jblow","name":"Jonathan
|
44
|
+
Blow","description":"New comments on the web by Jonathan Blow.","image_url":"https://pushbullet.imgix.net/ujxPklLhvyK-6fXf4O2JQ1dBKQedhypIKwPX0lyFfwXW/jonathan-blow.png"}}'
|
45
|
+
http_version:
|
46
|
+
recorded_at: Mon, 02 Feb 2015 01:45:40 GMT
|
47
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: delete
|
5
|
+
uri: https://DhOX5Q8Fps9mq4g90yfrfioRPyo1qQRd:@api.pushbullet.com/v2/subscriptions/ujx7XdJ9W8qsjAlOnVVSqy
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*; q=0.5, application/xml"
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
X-Ratelimit-Limit:
|
22
|
+
- '16384'
|
23
|
+
X-Ratelimit-Remaining:
|
24
|
+
- '16368'
|
25
|
+
X-Ratelimit-Reset:
|
26
|
+
- '1422844422'
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Date:
|
30
|
+
- Mon, 02 Feb 2015 01:52:59 GMT
|
31
|
+
Server:
|
32
|
+
- Google Frontend
|
33
|
+
Cache-Control:
|
34
|
+
- private
|
35
|
+
Transfer-Encoding:
|
36
|
+
- chunked
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: "{}"
|
40
|
+
http_version:
|
41
|
+
recorded_at: Mon, 02 Feb 2015 01:52:59 GMT
|
42
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://DhOX5Q8Fps9mq4g90yfrfioRPyo1qQRd:@api.pushbullet.com/v2/contacts
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*; q=0.5, application/xml"
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 400
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
X-Ratelimit-Limit:
|
22
|
+
- '16384'
|
23
|
+
X-Ratelimit-Remaining:
|
24
|
+
- '16310'
|
25
|
+
X-Ratelimit-Reset:
|
26
|
+
- '1422816448'
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Date:
|
30
|
+
- Tue, 28 Apr 2015 00:01:47 GMT
|
31
|
+
Server:
|
32
|
+
- Google Frontend
|
33
|
+
Cache-Control:
|
34
|
+
- private
|
35
|
+
Transfer-Encoding:
|
36
|
+
- chunked
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"error":{"message": "The resource could not be found.", "type": "invalid_request", "cat": "~(=^‥^)"}}'
|
40
|
+
http_version:
|
41
|
+
recorded_at: Tue, 28 Apr 2015 00:01:47 GMT
|
42
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Pushbullet::Channel do
|
4
|
+
describe '::get_info' do
|
5
|
+
context 'given a channel tag' do
|
6
|
+
let(:tag) { 'jblow'}
|
7
|
+
|
8
|
+
it 'returns channel info' do
|
9
|
+
VCR.use_cassette('channel_info') do
|
10
|
+
expect(described_class.get_info tag).to be_a described_class
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'returns channel with recent pushes' do
|
15
|
+
VCR.use_cassette('channel_info') do
|
16
|
+
described_class.get_info(tag).recent_pushes.each do |push|
|
17
|
+
expect(push).to be_a Pushbullet::Push
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '::subscribe' do
|
25
|
+
context 'given a channel tag' do
|
26
|
+
let(:tag) { 'jblow' }
|
27
|
+
|
28
|
+
it 'returns a channel' do
|
29
|
+
VCR.use_cassette('channel_subscribe') do
|
30
|
+
expect(described_class.subscribe tag).to be_a described_class
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '::unsubscribe' do
|
37
|
+
context 'given a channel idn' do
|
38
|
+
let(:idn) { 'ujx7XdJ9W8qsjAlOnVVSqy' }
|
39
|
+
|
40
|
+
it 'unsubscribes a channel' do
|
41
|
+
VCR.use_cassette('channel_unsubscribe') do
|
42
|
+
expect(described_class.unsubscribe idn).to be_truthy
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Pushbullet::Client do
|
4
|
+
describe '#get' do
|
5
|
+
it_behaves_like('a better HTTP response handling') do
|
6
|
+
let(:request) { described_class.new.get '' }
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#post' do
|
11
|
+
it_behaves_like('a better HTTP response handling') do
|
12
|
+
let(:request) { described_class.new.post '' }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#put' do
|
17
|
+
it_behaves_like('a better HTTP response handling') do
|
18
|
+
let(:request) { described_class.new.put '' }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#delete' do
|
23
|
+
it_behaves_like('a better HTTP response handling') do
|
24
|
+
let(:request) { described_class.new.delete '' }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
shared_examples 'a better HTTP response handling' do
|
2
|
+
it 'raises an Pushbullet::Error with the message' do
|
3
|
+
VCR.use_cassette('get_error', match_requests_on: [:host]) do
|
4
|
+
expect { request }.to raise_error(Pushbullet::Error)
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'does not raise an Pushbullet::Error with the message' do
|
9
|
+
VCR.use_cassette('contacts_all', match_requests_on: [:host]) do
|
10
|
+
expect { request }.not_to raise_error
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -27,6 +27,8 @@ RSpec.configure do |config|
|
|
27
27
|
config.filter_run focus: true
|
28
28
|
config.order = 'random'
|
29
29
|
config.include FactoryGirl::Syntax::Methods
|
30
|
+
|
31
|
+
Dir['./spec/shared/**/*.rb'].each { |f| require f }
|
30
32
|
end
|
31
33
|
|
32
34
|
Pushbullet.api_token = 'DhOX5Q8Fps9mq4g90yfrfioRPyo1qQRd'
|
metadata
CHANGED
@@ -1,197 +1,197 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-pushbullet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricardo Leitao
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
15
20
|
requirement: !ruby/object:Gem::Requirement
|
16
21
|
requirements:
|
17
|
-
- -
|
22
|
+
- - '>='
|
18
23
|
- !ruby/object:Gem::Version
|
19
24
|
version: '0'
|
20
|
-
type: :development
|
21
25
|
prerelease: false
|
26
|
+
type: :development
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pry
|
22
29
|
version_requirements: !ruby/object:Gem::Requirement
|
23
30
|
requirements:
|
24
|
-
- -
|
31
|
+
- - '>='
|
25
32
|
- !ruby/object:Gem::Version
|
26
33
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: pry
|
29
34
|
requirement: !ruby/object:Gem::Requirement
|
30
35
|
requirements:
|
31
|
-
- -
|
36
|
+
- - '>='
|
32
37
|
- !ruby/object:Gem::Version
|
33
38
|
version: '0'
|
34
|
-
type: :development
|
35
39
|
prerelease: false
|
40
|
+
type: :development
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
36
43
|
version_requirements: !ruby/object:Gem::Requirement
|
37
44
|
requirements:
|
38
|
-
- -
|
45
|
+
- - '>='
|
39
46
|
- !ruby/object:Gem::Version
|
40
47
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
44
49
|
requirements:
|
45
|
-
- -
|
50
|
+
- - '>='
|
46
51
|
- !ruby/object:Gem::Version
|
47
52
|
version: '0'
|
48
|
-
type: :development
|
49
53
|
prerelease: false
|
54
|
+
type: :development
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
50
57
|
version_requirements: !ruby/object:Gem::Requirement
|
51
58
|
requirements:
|
52
|
-
- -
|
59
|
+
- - ~>
|
53
60
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
61
|
+
version: 3.0.0
|
57
62
|
requirement: !ruby/object:Gem::Requirement
|
58
63
|
requirements:
|
59
|
-
- -
|
64
|
+
- - ~>
|
60
65
|
- !ruby/object:Gem::Version
|
61
66
|
version: 3.0.0
|
62
|
-
type: :development
|
63
67
|
prerelease: false
|
68
|
+
type: :development
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: factory_girl
|
64
71
|
version_requirements: !ruby/object:Gem::Requirement
|
65
72
|
requirements:
|
66
|
-
- -
|
73
|
+
- - '>='
|
67
74
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: factory_girl
|
75
|
+
version: '0'
|
71
76
|
requirement: !ruby/object:Gem::Requirement
|
72
77
|
requirements:
|
73
|
-
- -
|
78
|
+
- - '>='
|
74
79
|
- !ruby/object:Gem::Version
|
75
80
|
version: '0'
|
76
|
-
type: :development
|
77
81
|
prerelease: false
|
82
|
+
type: :development
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
78
85
|
version_requirements: !ruby/object:Gem::Requirement
|
79
86
|
requirements:
|
80
|
-
- -
|
87
|
+
- - '>='
|
81
88
|
- !ruby/object:Gem::Version
|
82
89
|
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: webmock
|
85
90
|
requirement: !ruby/object:Gem::Requirement
|
86
91
|
requirements:
|
87
|
-
- -
|
92
|
+
- - '>='
|
88
93
|
- !ruby/object:Gem::Version
|
89
94
|
version: '0'
|
90
|
-
type: :development
|
91
95
|
prerelease: false
|
96
|
+
type: :development
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
92
99
|
version_requirements: !ruby/object:Gem::Requirement
|
93
100
|
requirements:
|
94
|
-
- -
|
101
|
+
- - '>='
|
95
102
|
- !ruby/object:Gem::Version
|
96
103
|
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop
|
99
104
|
requirement: !ruby/object:Gem::Requirement
|
100
105
|
requirements:
|
101
|
-
- -
|
106
|
+
- - '>='
|
102
107
|
- !ruby/object:Gem::Version
|
103
108
|
version: '0'
|
104
|
-
type: :development
|
105
109
|
prerelease: false
|
110
|
+
type: :development
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-rspec
|
106
113
|
version_requirements: !ruby/object:Gem::Requirement
|
107
114
|
requirements:
|
108
|
-
- -
|
115
|
+
- - '>='
|
109
116
|
- !ruby/object:Gem::Version
|
110
117
|
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rubocop-rspec
|
113
118
|
requirement: !ruby/object:Gem::Requirement
|
114
119
|
requirements:
|
115
|
-
- -
|
120
|
+
- - '>='
|
116
121
|
- !ruby/object:Gem::Version
|
117
122
|
version: '0'
|
118
|
-
type: :development
|
119
123
|
prerelease: false
|
124
|
+
type: :development
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: awesome_print
|
120
127
|
version_requirements: !ruby/object:Gem::Requirement
|
121
128
|
requirements:
|
122
|
-
- -
|
129
|
+
- - '>='
|
123
130
|
- !ruby/object:Gem::Version
|
124
131
|
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: awesome_print
|
127
132
|
requirement: !ruby/object:Gem::Requirement
|
128
133
|
requirements:
|
129
|
-
- -
|
134
|
+
- - '>='
|
130
135
|
- !ruby/object:Gem::Version
|
131
136
|
version: '0'
|
132
|
-
type: :development
|
133
137
|
prerelease: false
|
138
|
+
type: :development
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: vcr
|
134
141
|
version_requirements: !ruby/object:Gem::Requirement
|
135
142
|
requirements:
|
136
|
-
- -
|
143
|
+
- - '>='
|
137
144
|
- !ruby/object:Gem::Version
|
138
145
|
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: vcr
|
141
146
|
requirement: !ruby/object:Gem::Requirement
|
142
147
|
requirements:
|
143
|
-
- -
|
148
|
+
- - '>='
|
144
149
|
- !ruby/object:Gem::Version
|
145
150
|
version: '0'
|
146
|
-
type: :development
|
147
151
|
prerelease: false
|
152
|
+
type: :development
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: simplecov
|
148
155
|
version_requirements: !ruby/object:Gem::Requirement
|
149
156
|
requirements:
|
150
|
-
- -
|
157
|
+
- - '>='
|
151
158
|
- !ruby/object:Gem::Version
|
152
159
|
version: '0'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: simplecov
|
155
160
|
requirement: !ruby/object:Gem::Requirement
|
156
161
|
requirements:
|
157
|
-
- -
|
162
|
+
- - '>='
|
158
163
|
- !ruby/object:Gem::Version
|
159
164
|
version: '0'
|
160
|
-
type: :development
|
161
165
|
prerelease: false
|
162
|
-
|
163
|
-
requirements:
|
164
|
-
- - ">="
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
166
|
+
type: :development
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: rest-client
|
169
|
-
|
169
|
+
version_requirements: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - ~>
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: 1.7.2
|
174
|
-
|
175
|
-
prerelease: false
|
176
|
-
version_requirements: !ruby/object:Gem::Requirement
|
174
|
+
requirement: !ruby/object:Gem::Requirement
|
177
175
|
requirements:
|
178
|
-
- -
|
176
|
+
- - ~>
|
179
177
|
- !ruby/object:Gem::Version
|
180
178
|
version: 1.7.2
|
179
|
+
prerelease: false
|
180
|
+
type: :runtime
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: json
|
183
|
-
|
183
|
+
version_requirements: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- -
|
185
|
+
- - '>='
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '0'
|
188
|
-
|
189
|
-
prerelease: false
|
190
|
-
version_requirements: !ruby/object:Gem::Requirement
|
188
|
+
requirement: !ruby/object:Gem::Requirement
|
191
189
|
requirements:
|
192
|
-
- -
|
190
|
+
- - '>='
|
193
191
|
- !ruby/object:Gem::Version
|
194
192
|
version: '0'
|
193
|
+
prerelease: false
|
194
|
+
type: :runtime
|
195
195
|
description: Ruby client of Pushbullet API.
|
196
196
|
email:
|
197
197
|
- letzdevelopment@gmail.com
|
@@ -206,9 +206,13 @@ files:
|
|
206
206
|
- lib/pushbullet/client.rb
|
207
207
|
- lib/pushbullet/contact.rb
|
208
208
|
- lib/pushbullet/device.rb
|
209
|
+
- lib/pushbullet/error.rb
|
209
210
|
- lib/pushbullet/push.rb
|
210
211
|
- lib/pushbullet/pushable.rb
|
211
212
|
- lib/pushbullet/resource.rb
|
213
|
+
- spec/fixtures/vcr_cassettes/channel_info.yml
|
214
|
+
- spec/fixtures/vcr_cassettes/channel_subscribe.yml
|
215
|
+
- spec/fixtures/vcr_cassettes/channel_unsubscribe.yml
|
212
216
|
- spec/fixtures/vcr_cassettes/contacts_all.yml
|
213
217
|
- spec/fixtures/vcr_cassettes/contacts_create.yml
|
214
218
|
- spec/fixtures/vcr_cassettes/contacts_remove.yml
|
@@ -217,38 +221,47 @@ files:
|
|
217
221
|
- spec/fixtures/vcr_cassettes/devices_create.yml
|
218
222
|
- spec/fixtures/vcr_cassettes/devices_remove.yml
|
219
223
|
- spec/fixtures/vcr_cassettes/devices_update.yml
|
224
|
+
- spec/fixtures/vcr_cassettes/get_error.yml
|
220
225
|
- spec/fixtures/vcr_cassettes/push_create_note.yml
|
226
|
+
- spec/pushbullet/channel_spec.rb
|
227
|
+
- spec/pushbullet/client_spec.rb
|
221
228
|
- spec/pushbullet/contact_spec.rb
|
222
229
|
- spec/pushbullet/devices_spec.rb
|
223
230
|
- spec/pushbullet/push_spec.rb
|
224
231
|
- spec/pushbullet_spec.rb
|
232
|
+
- spec/shared/error_handling.rb
|
225
233
|
- spec/spec_helper.rb
|
226
234
|
- spec/support/factories.rb
|
227
235
|
homepage: https://github.com/letz/ruby-pushbullet
|
228
236
|
licenses:
|
229
237
|
- MIT
|
230
238
|
metadata: {}
|
231
|
-
post_install_message:
|
239
|
+
post_install_message:
|
232
240
|
rdoc_options: []
|
233
241
|
require_paths:
|
234
242
|
- lib
|
235
243
|
required_ruby_version: !ruby/object:Gem::Requirement
|
236
244
|
requirements:
|
237
|
-
- -
|
245
|
+
- - '>='
|
238
246
|
- !ruby/object:Gem::Version
|
239
247
|
version: '0'
|
240
248
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
241
249
|
requirements:
|
242
|
-
- -
|
250
|
+
- - '>='
|
243
251
|
- !ruby/object:Gem::Version
|
244
252
|
version: '0'
|
245
253
|
requirements: []
|
246
|
-
rubyforge_project:
|
247
|
-
rubygems_version: 2.
|
248
|
-
signing_key:
|
254
|
+
rubyforge_project:
|
255
|
+
rubygems_version: 2.4.5
|
256
|
+
signing_key:
|
249
257
|
specification_version: 4
|
250
258
|
summary: Ruby client of Pushbullet API.
|
251
259
|
test_files:
|
260
|
+
- spec/pushbullet_spec.rb
|
261
|
+
- spec/spec_helper.rb
|
262
|
+
- spec/fixtures/vcr_cassettes/channel_info.yml
|
263
|
+
- spec/fixtures/vcr_cassettes/channel_subscribe.yml
|
264
|
+
- spec/fixtures/vcr_cassettes/channel_unsubscribe.yml
|
252
265
|
- spec/fixtures/vcr_cassettes/contacts_all.yml
|
253
266
|
- spec/fixtures/vcr_cassettes/contacts_create.yml
|
254
267
|
- spec/fixtures/vcr_cassettes/contacts_remove.yml
|
@@ -257,10 +270,12 @@ test_files:
|
|
257
270
|
- spec/fixtures/vcr_cassettes/devices_create.yml
|
258
271
|
- spec/fixtures/vcr_cassettes/devices_remove.yml
|
259
272
|
- spec/fixtures/vcr_cassettes/devices_update.yml
|
273
|
+
- spec/fixtures/vcr_cassettes/get_error.yml
|
260
274
|
- spec/fixtures/vcr_cassettes/push_create_note.yml
|
275
|
+
- spec/pushbullet/channel_spec.rb
|
276
|
+
- spec/pushbullet/client_spec.rb
|
261
277
|
- spec/pushbullet/contact_spec.rb
|
262
278
|
- spec/pushbullet/devices_spec.rb
|
263
279
|
- spec/pushbullet/push_spec.rb
|
264
|
-
- spec/
|
265
|
-
- spec/spec_helper.rb
|
280
|
+
- spec/shared/error_handling.rb
|
266
281
|
- spec/support/factories.rb
|