pushbullet_ruby 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/README.md +55 -21
- data/lib/pushbullet_ruby/api/pushes.rb +4 -0
- data/lib/pushbullet_ruby/api/subscriptions.rb +2 -4
- data/lib/pushbullet_ruby/channel.rb +8 -0
- data/lib/pushbullet_ruby/contact.rb +8 -0
- data/lib/pushbullet_ruby/push.rb +7 -0
- data/lib/pushbullet_ruby/version.rb +1 -1
- metadata +1 -2
- data/token.json +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 872ee001c5e1440a6b53af23b8eb4ff79feae331
|
4
|
+
data.tar.gz: 3ab5d04e0c2f0982d17d93a736b64ecdaf19be64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14e84e7b703df31c4d736d162c7aac65bcead77dccd613c68ba16abb9cc41adaa51659c580b19d9d69668037cba386bba54ecfe4c9afd7feaceb18df77b65aca
|
7
|
+
data.tar.gz: 08dbeecedf08494a0d3c29306fdbc15cc3690a25cbff131041ad8dddbe0c0393b12b3c6b6dfaa5d6335b66901e3f4aef21ba8b5a40da15f2986d8b804ded5650
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
# PushbulletRuby
|
2
2
|
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pushbullet_ruby`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
3
|
## Installation
|
8
4
|
|
9
5
|
Add this line to your application's Gemfile:
|
@@ -11,31 +7,69 @@ Add this line to your application's Gemfile:
|
|
11
7
|
```ruby
|
12
8
|
gem 'pushbullet_ruby'
|
13
9
|
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install pushbullet_ruby
|
22
|
-
|
23
10
|
## Usage
|
24
11
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
12
|
+
### Setup
|
13
|
+
Puts your api-key into a token.json file formatted like this:
|
14
|
+
```ruby
|
15
|
+
{token: 'your api-key here'}
|
16
|
+
```
|
17
|
+
And setup your client:
|
18
|
+
```ruby
|
19
|
+
client = PushbulletRuby::Client.new(PushbulletRuby::Token.load)
|
20
|
+
```
|
30
21
|
|
31
|
-
|
22
|
+
### List devices
|
23
|
+
```ruby
|
24
|
+
client.devices
|
25
|
+
```
|
26
|
+
### Update device informations
|
27
|
+
```ruby
|
28
|
+
client.update_device(
|
29
|
+
id: 'device id',
|
30
|
+
params: {
|
31
|
+
nickname: 'device name'
|
32
|
+
}
|
33
|
+
)
|
34
|
+
```
|
35
|
+
### List contacts
|
36
|
+
```ruby
|
37
|
+
client.contacts
|
38
|
+
```
|
39
|
+
### List subscriptions(channels)
|
40
|
+
```ruby
|
41
|
+
client.subscriptions
|
42
|
+
```
|
43
|
+
### Get recent channel pushes
|
44
|
+
```ruby
|
45
|
+
client.recent_pushes('channel tag')
|
46
|
+
```
|
47
|
+
### List pushes
|
48
|
+
```ruby
|
49
|
+
client.pushes
|
50
|
+
```
|
51
|
+
### Push
|
52
|
+
You can send following list:
|
32
53
|
|
54
|
+
- note
|
55
|
+
- link
|
56
|
+
- file
|
57
|
+
```ruby
|
58
|
+
client.push_note(
|
59
|
+
receiver: :device,
|
60
|
+
identifier: 'devide id',
|
61
|
+
params: {
|
62
|
+
title: 'Title',
|
63
|
+
body: 'Content'
|
64
|
+
}
|
65
|
+
)
|
66
|
+
```
|
33
67
|
## Contributing
|
34
68
|
|
35
69
|
Bug reports and pull requests are welcome on GitHub at https://github.com/creends/pushbullet_ruby.
|
36
70
|
|
37
71
|
|
38
|
-
|
72
|
+
##### This gem is inspired by [washbullet](https://github.com/hrysd/washbullet)
|
73
|
+
|
39
74
|
|
40
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
75
|
|
@@ -17,6 +17,10 @@ module PushbulletRuby
|
|
17
17
|
def push_file(receiver: nil, identifier: nil, params: {})
|
18
18
|
PushbulletRuby::Pushable::File.push(self, receiver, identifier, params)
|
19
19
|
end
|
20
|
+
|
21
|
+
def pushes
|
22
|
+
PushbulletRuby::Push.from_response(get('/v2/pushes'))
|
23
|
+
end
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
@@ -12,11 +12,9 @@ module PushbulletRuby
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def recent_pushes(tag)
|
15
|
-
|
16
|
-
|
17
|
-
pushes << PushbulletRuby::Push.new(push)
|
15
|
+
channel_info(tag).body['recent_pushes'].each_with_object([]) do |push, memo|
|
16
|
+
memo << PushbulletRuby::Push.new(push)
|
18
17
|
end
|
19
|
-
pushes
|
20
18
|
end
|
21
19
|
end
|
22
20
|
end
|
data/lib/pushbullet_ruby/push.rb
CHANGED
@@ -2,6 +2,13 @@ require 'pushbullet_ruby/entity'
|
|
2
2
|
|
3
3
|
module PushbulletRuby
|
4
4
|
class Push < Entity
|
5
|
+
def self.from_response(response)
|
6
|
+
response.body['pushes'].each_with_object([]) do |push, memo|
|
7
|
+
next unless push['active']
|
8
|
+
memo << new(push)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
5
12
|
def id
|
6
13
|
body['iden']
|
7
14
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pushbullet_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- creends
|
@@ -102,7 +102,6 @@ files:
|
|
102
102
|
- lib/pushbullet_ruby/user.rb
|
103
103
|
- lib/pushbullet_ruby/version.rb
|
104
104
|
- pushbullet_ruby.gemspec
|
105
|
-
- token.json
|
106
105
|
homepage: https://github.com/creends/pushbullet_ruby
|
107
106
|
licenses:
|
108
107
|
- MIT
|
data/token.json
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"token": "your api key here"}
|