pushbullet_client 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pushbullet/chats.rb +3 -2
- data/lib/pushbullet/client.rb +12 -1
- data/lib/pushbullet/devices.rb +3 -2
- data/lib/pushbullet/permanents.rb +8 -4
- data/lib/pushbullet/pushes.rb +10 -2
- data/lib/pushbullet/subscriptions.rb +3 -2
- data/lib/pushbullet/texts.rb +3 -2
- data/lib/pushbullet/users.rb +3 -2
- data/lib/pushbullet/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41e090f3defb5e7fdab2d0d09ac0f9e4724acd0c4de1bac80cb211921a201081
|
4
|
+
data.tar.gz: '0429f947e802b79d68bae4567f2f3e85d7c1b3a8672864ec0575b0b5d1e5ab56'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0fc33fb5b681f4522a36d730607c44c42876209f1321c068dffc43c0dc2b182ad0e928d240e66aef41e25acf3fe8e476c2b6c9f772a8ef5baee5faf6b46d0a1
|
7
|
+
data.tar.gz: e4106fd2235666a8d43e73fbe60700154300791b1e84af3d782c45dc10179eda2d1486068dbdd550ca475b2eaf6d7e8b0991a30b1879d7b0554e125c0a769ee4
|
data/lib/pushbullet/chats.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
module Pushbullet
|
2
2
|
module Chats
|
3
|
-
def chats
|
3
|
+
def chats(params: {}, cursor: nil)
|
4
|
+
params = process_cursor(cursor, params: params)
|
4
5
|
path = 'chats'
|
5
|
-
authorise_and_send(http_method: :get, path: path)
|
6
|
+
authorise_and_send(http_method: :get, path: path, params: params)
|
6
7
|
end
|
7
8
|
end
|
8
9
|
end
|
data/lib/pushbullet/client.rb
CHANGED
@@ -44,6 +44,10 @@ module Pushbullet
|
|
44
44
|
def authorise_and_send(http_method:, path:, payload: {}, params: {})
|
45
45
|
start_time = micro_second_time_now
|
46
46
|
|
47
|
+
if params.nil? || params.empty?
|
48
|
+
params = {}
|
49
|
+
end
|
50
|
+
|
47
51
|
params['limit'] = @limit
|
48
52
|
|
49
53
|
response = HTTParty.send(
|
@@ -76,7 +80,8 @@ module Pushbullet
|
|
76
80
|
{
|
77
81
|
'start_time' => start_time,
|
78
82
|
'end_time' => end_time,
|
79
|
-
'total_time' => total_time
|
83
|
+
'total_time' => total_time,
|
84
|
+
'cursor' => response.dig('cursor')
|
80
85
|
}
|
81
86
|
end
|
82
87
|
|
@@ -117,5 +122,11 @@ module Pushbullet
|
|
117
122
|
def process_params(params)
|
118
123
|
params.keys.map { |key| "#{key}=#{params[key]}" }.join('&')
|
119
124
|
end
|
125
|
+
|
126
|
+
def process_cursor(cursor, params: {})
|
127
|
+
unless cursor.nil? || cursor.empty?
|
128
|
+
params['cursor'] = cursor
|
129
|
+
end
|
130
|
+
end
|
120
131
|
end
|
121
132
|
end
|
data/lib/pushbullet/devices.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
module Pushbullet
|
2
2
|
module Devices
|
3
|
-
def devices
|
3
|
+
def devices(params: {}, cursor: nil)
|
4
|
+
params = process_cursor(cursor, params: params)
|
4
5
|
path = 'devices'
|
5
|
-
authorise_and_send(http_method: :get, path: path)
|
6
|
+
authorise_and_send(http_method: :get, path: path, params: params)
|
6
7
|
end
|
7
8
|
end
|
8
9
|
end
|
@@ -1,14 +1,18 @@
|
|
1
1
|
module Pushbullet
|
2
2
|
module Permanents
|
3
3
|
# See: https://stackoverflow.com/questions/38027963/pushbullet-api-thread-id-to-conversation-iden-for-sms
|
4
|
-
def permanents(device_identity:)
|
4
|
+
def permanents(device_identity:, params: {}, cursor: nil)
|
5
|
+
params = process_cursor(cursor, params: params)
|
6
|
+
|
5
7
|
path = "permanents/#{device_identity}_threads"
|
6
|
-
authorise_and_send(http_method: :get, path: path)
|
8
|
+
authorise_and_send(http_method: :get, path: path, params: params)
|
7
9
|
end
|
8
10
|
|
9
|
-
def permanent_conversation(device_identity:, thread_id:)
|
11
|
+
def permanent_conversation(device_identity:, thread_id:, params: {}, cursor: nil)
|
12
|
+
params = process_cursor(cursor, params: params)
|
13
|
+
|
10
14
|
path = "permanents/#{device_identity}_thread_#{thread_id}"
|
11
|
-
authorise_and_send(http_method: :get, path: path)
|
15
|
+
authorise_and_send(http_method: :get, path: path, params: params)
|
12
16
|
end
|
13
17
|
end
|
14
18
|
end
|
data/lib/pushbullet/pushes.rb
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
module Pushbullet
|
2
2
|
module Pushes
|
3
|
-
def pushes
|
3
|
+
def pushes(params: {}, cursor: nil)
|
4
|
+
params = process_cursor(cursor, params: params)
|
4
5
|
path = 'pushes'
|
5
|
-
authorise_and_send(http_method: :get, path: path)
|
6
|
+
authorise_and_send(http_method: :get, path: path, params: params)
|
7
|
+
end
|
8
|
+
|
9
|
+
def self_pushes(params: {}, cursor: nil)
|
10
|
+
params = process_cursor(cursor, params: params.merge({ self: true }))
|
11
|
+
|
12
|
+
path = 'pushes'
|
13
|
+
authorise_and_send(http_method: :get, path: path, params: params)
|
6
14
|
end
|
7
15
|
end
|
8
16
|
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
module Pushbullet
|
2
2
|
module Subscriptions
|
3
|
-
def subscriptions
|
3
|
+
def subscriptions(params: {}, cursor: nil)
|
4
|
+
params = process_cursor(cursor, params: params)
|
4
5
|
path = 'subscriptions'
|
5
|
-
authorise_and_send(http_method: :get, path: path)
|
6
|
+
authorise_and_send(http_method: :get, path: path, params: params)
|
6
7
|
end
|
7
8
|
end
|
8
9
|
end
|
data/lib/pushbullet/texts.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
module Pushbullet
|
2
2
|
module Texts
|
3
|
-
def texts
|
3
|
+
def texts(params: {}, cursor: nil)
|
4
|
+
params = process_cursor(cursor, params: params)
|
4
5
|
path = 'texts'
|
5
|
-
authorise_and_send(http_method: :get, path: path)
|
6
|
+
authorise_and_send(http_method: :get, path: path, params: params)
|
6
7
|
end
|
7
8
|
end
|
8
9
|
end
|
data/lib/pushbullet/users.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
module Pushbullet
|
2
2
|
module Users
|
3
|
-
def me
|
3
|
+
def me(params: {}, cursor: nil)
|
4
|
+
params = process_cursor(cursor, params: params)
|
4
5
|
path = 'users/me'
|
5
|
-
authorise_and_send(http_method: :get, path: path)
|
6
|
+
authorise_and_send(http_method: :get, path: path, params: params)
|
6
7
|
end
|
7
8
|
end
|
8
9
|
end
|
data/lib/pushbullet/version.rb
CHANGED