ruby-pushbullet 0.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/pushbullet/push.rb +9 -1
- data/lib/pushbullet/pushable.rb +4 -11
- data/lib/pushbullet/resource.rb +5 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24ea52ae23543f776f27e23032a60b5009f74eb4
|
4
|
+
data.tar.gz: ff625189e17d3e6c2c60dfa1ceee179bedc505b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17e97ccc4e0fa09785bd82215ab70b98c8308b2595cba1fff7a7c773369f0f6ae1df2489327b295adebe04a610b16cca0bdfe33febf59d876efa17d06b1faa90
|
7
|
+
data.tar.gz: 8faa04548d1bc4f5aab466fa3871d8f4787a967e3468a211c0ec1f5fa4b93d3260531ef7e93278a63b0339e5f035d523ad4e8f6bb296f14577abfc7a380dc92e
|
data/README.md
CHANGED
@@ -9,6 +9,14 @@ This library is an implementation of [Pushbullet API](https://docs.pushbullet.co
|
|
9
9
|
|
10
10
|
Feel free to contribute :smile:
|
11
11
|
|
12
|
+
**NOTE: This is not production ready (yet).**
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
```
|
17
|
+
gem install ruby-pushbullet
|
18
|
+
```
|
19
|
+
|
12
20
|
## Configuration
|
13
21
|
|
14
22
|
You can get your api token from [Account Settings](https://www.pushbullet.com/account)
|
data/lib/pushbullet/push.rb
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
module Pushbullet
|
2
2
|
class Push < Resource
|
3
|
-
|
3
|
+
|
4
|
+
def self.create(type, iden, payload)
|
5
|
+
id = iden[/.@.?/].nil? ? :device_iden : :email
|
6
|
+
super(payload.merge(type: type, id => iden))
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.path
|
10
|
+
'pushes'
|
11
|
+
end
|
4
12
|
end
|
5
13
|
end
|
data/lib/pushbullet/pushable.rb
CHANGED
@@ -2,26 +2,19 @@ module Pushbullet
|
|
2
2
|
module Pushable
|
3
3
|
|
4
4
|
def push_note(title, body)
|
5
|
-
|
5
|
+
Push.create :note, target_id, title: title, body: body
|
6
6
|
end
|
7
7
|
|
8
8
|
def push_link(title, url, body)
|
9
|
-
|
9
|
+
Push.create :link, target_id, title: title, url: url, body: body
|
10
10
|
end
|
11
11
|
|
12
12
|
def push_address(name, address)
|
13
|
-
|
13
|
+
Push.create :address, target_id, name: name, address: address
|
14
14
|
end
|
15
15
|
|
16
16
|
def push_list(title, items)
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def push(type, iden, payload)
|
23
|
-
id = iden[/.@.?/].nil? ? :device_iden : :email
|
24
|
-
Push.create(payload.merge(type: type, id => iden))
|
17
|
+
Push.create :list, target_id, title: title, items: items
|
25
18
|
end
|
26
19
|
end
|
27
20
|
end
|
data/lib/pushbullet/resource.rb
CHANGED
@@ -1,10 +1,5 @@
|
|
1
1
|
module Pushbullet
|
2
2
|
class Resource < OpenStruct
|
3
|
-
def self.path
|
4
|
-
klass = self.is_a?(Class) ? self : self.class
|
5
|
-
@path ||= "#{klass.to_s.demodulize.downcase}s"
|
6
|
-
end
|
7
|
-
|
8
3
|
def self.create(params)
|
9
4
|
new Pushbullet.client.post(path, params)
|
10
5
|
end
|
@@ -24,5 +19,10 @@ module Pushbullet
|
|
24
19
|
Pushbullet.client.delete "#{self.class.path}/#{iden}"
|
25
20
|
true
|
26
21
|
end
|
22
|
+
|
23
|
+
def self.path
|
24
|
+
klass = self.is_a?(Class) ? self : self.class
|
25
|
+
@path ||= "#{klass.to_s.demodulize.downcase}s"
|
26
|
+
end
|
27
27
|
end
|
28
28
|
end
|