pushbullet_client 0.0.2 → 0.0.7
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/.gitignore +0 -0
- data/CODE_OF_CONDUCT.md +0 -0
- data/Gemfile +0 -0
- data/LICENSE +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/bin/make +3 -0
- data/lib/pushbullet.rb +8 -1
- data/lib/pushbullet/chats.rb +3 -2
- data/lib/pushbullet/client.rb +17 -3
- data/lib/pushbullet/constants.rb +1 -0
- 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
- data/pushbullet_client.gemspec +1 -1
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bdb05a958b0de8f404bcf83f0e4f181912f6a3880c326479a18fb95a8d8a3ee
|
4
|
+
data.tar.gz: 115200ad226012ccb28727725a382a4cd8dfc2dcdaabccf34a6bf3b18b019ee0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a02938bb062f56bbd94a15ad108bac37e6f3cb101dcc98602c85c0a33824646269d8d900ecbdaebf7abe53939aa9120cd3641343d0829e14b5cc0c49173109ed
|
7
|
+
data.tar.gz: 385072aab1a37d8f70d2ee7e37c55286e595811738c16fa5aa3bb2b32e72bd22f7b4708de13e9a7139d0252f25e13ce2e1493cff39f02a8c279c1b03820fc5d0
|
data/.gitignore
CHANGED
File without changes
|
data/CODE_OF_CONDUCT.md
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/LICENSE
CHANGED
File without changes
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
data/bin/make
ADDED
data/lib/pushbullet.rb
CHANGED
@@ -5,9 +5,16 @@ require 'pushbullet/version'
|
|
5
5
|
require 'pushbullet/constants'
|
6
6
|
|
7
7
|
# Endpoints
|
8
|
+
require 'pushbullet/chats'
|
9
|
+
require 'pushbullet/devices'
|
10
|
+
require 'pushbullet/permanents'
|
11
|
+
require 'pushbullet/pushes'
|
12
|
+
require 'pushbullet/subscriptions'
|
13
|
+
require 'pushbullet/texts'
|
14
|
+
require 'pushbullet/users'
|
8
15
|
|
9
16
|
require 'pushbullet/client'
|
10
17
|
|
11
|
-
module
|
18
|
+
module Pushbullet
|
12
19
|
class Error < StandardError; end
|
13
20
|
end
|
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
@@ -23,10 +23,11 @@ module Pushbullet
|
|
23
23
|
|
24
24
|
attr_reader :key, :secret, :base_path, :port
|
25
25
|
|
26
|
-
def initialize(access_token:, base_path:
|
26
|
+
def initialize(access_token:, base_path: API_V2_BASE_PATH, port: 80, limit: 500)
|
27
27
|
@access_token = access_token
|
28
28
|
@base_path = base_path
|
29
29
|
@port = port
|
30
|
+
@limit = limit
|
30
31
|
end
|
31
32
|
|
32
33
|
def self.compatible_api_version
|
@@ -43,6 +44,12 @@ module Pushbullet
|
|
43
44
|
def authorise_and_send(http_method:, path:, payload: {}, params: {})
|
44
45
|
start_time = micro_second_time_now
|
45
46
|
|
47
|
+
if params.nil? || params.empty?
|
48
|
+
params = {}
|
49
|
+
end
|
50
|
+
|
51
|
+
params['limit'] = @limit
|
52
|
+
|
46
53
|
response = HTTParty.send(
|
47
54
|
http_method.to_sym,
|
48
55
|
construct_base_path(path, params),
|
@@ -73,7 +80,8 @@ module Pushbullet
|
|
73
80
|
{
|
74
81
|
'start_time' => start_time,
|
75
82
|
'end_time' => end_time,
|
76
|
-
'total_time' => total_time
|
83
|
+
'total_time' => total_time,
|
84
|
+
'cursor' => response.dig('cursor')
|
77
85
|
}
|
78
86
|
end
|
79
87
|
|
@@ -104,7 +112,7 @@ module Pushbullet
|
|
104
112
|
def construct_base_path(path, params)
|
105
113
|
constructed_path = "#{base_path}/#{path}"
|
106
114
|
|
107
|
-
if params
|
115
|
+
if params == {}
|
108
116
|
constructed_path
|
109
117
|
else
|
110
118
|
"#{constructed_path}?#{process_params(params)}"
|
@@ -114,5 +122,11 @@ module Pushbullet
|
|
114
122
|
def process_params(params)
|
115
123
|
params.keys.map { |key| "#{key}=#{params[key]}" }.join('&')
|
116
124
|
end
|
125
|
+
|
126
|
+
def process_cursor(cursor, params: {})
|
127
|
+
unless cursor.nil? || cursor.empty?
|
128
|
+
params['cursor'] = cursor
|
129
|
+
end
|
130
|
+
end
|
117
131
|
end
|
118
132
|
end
|
data/lib/pushbullet/constants.rb
CHANGED
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
data/pushbullet_client.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
|
24
24
|
spec.add_dependency 'active_attr', '~> 0.15'
|
25
25
|
spec.add_dependency 'httparty', '~> 0.18'
|
26
|
-
spec.add_dependency 'nokogiri', '
|
26
|
+
spec.add_dependency 'nokogiri', '>= 1.11.0.rc4'
|
27
27
|
|
28
28
|
# Development dependancies
|
29
29
|
spec.add_development_dependency 'bundler', '~> 1.17'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pushbullet_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- trex22
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_attr
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: nokogiri
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.11.0.rc4
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.11.0.rc4
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -194,6 +194,7 @@ files:
|
|
194
194
|
- README.md
|
195
195
|
- Rakefile
|
196
196
|
- bin/console
|
197
|
+
- bin/make
|
197
198
|
- bin/setup
|
198
199
|
- lib/pushbullet.rb
|
199
200
|
- lib/pushbullet/chats.rb
|
@@ -211,7 +212,7 @@ homepage: https://github.com/TRex22/pushbullet_client
|
|
211
212
|
licenses:
|
212
213
|
- MIT
|
213
214
|
metadata: {}
|
214
|
-
post_install_message:
|
215
|
+
post_install_message:
|
215
216
|
rdoc_options: []
|
216
217
|
require_paths:
|
217
218
|
- lib
|
@@ -226,8 +227,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
227
|
- !ruby/object:Gem::Version
|
227
228
|
version: '0'
|
228
229
|
requirements: []
|
229
|
-
rubygems_version: 3.
|
230
|
-
signing_key:
|
230
|
+
rubygems_version: 3.2.3
|
231
|
+
signing_key:
|
231
232
|
specification_version: 4
|
232
233
|
summary: A client for using the Pushbullet API in Ruby.
|
233
234
|
test_files: []
|