pushbullet_client 0.0.5 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83e5f94556f66fdad7d641f0a6b8bb5ce9d0add7c656b7c1cdebd9ff2da519b6
4
- data.tar.gz: d799ac4ee79f89524ed9cf45bd96357363e79c2ae1b6293dd4ecf08bcb21081e
3
+ metadata.gz: 41e090f3defb5e7fdab2d0d09ac0f9e4724acd0c4de1bac80cb211921a201081
4
+ data.tar.gz: '0429f947e802b79d68bae4567f2f3e85d7c1b3a8672864ec0575b0b5d1e5ab56'
5
5
  SHA512:
6
- metadata.gz: 2252837846568ff01b37094f4f1d6172e3cee7da0223db8b8990bac17fe3e20bd5e9fedf7880b14671dcd002c93d111b4aa4b455997a64de4474a0b23a0f6221
7
- data.tar.gz: 79ab13c24299baa6bd57eaf11fb463408704443352b3eaaf7957eb2d05a7f372e2b5b4498146c35f26a5d126f630b61a57575c0a42373f23f8dee74cec206fc7
6
+ metadata.gz: b0fc33fb5b681f4522a36d730607c44c42876209f1321c068dffc43c0dc2b182ad0e928d240e66aef41e25acf3fe8e476c2b6c9f772a8ef5baee5faf6b46d0a1
7
+ data.tar.gz: e4106fd2235666a8d43e73fbe60700154300791b1e84af3d782c45dc10179eda2d1486068dbdd550ca475b2eaf6d7e8b0991a30b1879d7b0554e125c0a769ee4
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Pushbullet
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pushbullet_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - trex22