pushbullet_ruby 1.0.2.1 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pushbullet_ruby/api/ephemerals.rb +17 -0
- data/lib/pushbullet_ruby/api/pushes.rb +6 -6
- data/lib/pushbullet_ruby/api.rb +2 -0
- data/lib/pushbullet_ruby/client.rb +1 -1
- data/lib/pushbullet_ruby/device.rb +4 -0
- data/lib/pushbullet_ruby/ephemerable/notifitation.rb +22 -0
- data/lib/pushbullet_ruby/ephemerable/sms.rb +22 -0
- data/lib/pushbullet_ruby/ephemerable.rb +30 -0
- data/lib/pushbullet_ruby/ephemeral.rb +7 -0
- data/lib/pushbullet_ruby/pushable/file.rb +1 -1
- data/lib/pushbullet_ruby/pushable.rb +1 -1
- data/lib/pushbullet_ruby/version.rb +1 -1
- data/lib/pushbullet_ruby.rb +1 -0
- metadata +6 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a0e06cea76b41d45aa865be349cf82153c535f3
|
4
|
+
data.tar.gz: 5841c789ef3925c3baeacd399d91d0f1bf9ede5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 364433330836d920dbd7edc6f6e2ea37c9050fcbae37251d88729e1e3f222c81470c21e0eb54482714610d90b519b6bc938a29cb29b31ca7861b70998fe7d0ad
|
7
|
+
data.tar.gz: c315781d3a2a1cae08cbc6552cfb0a8edebd33416fcb3b765d3da10dd17241501869358a77e51c03158da4591e2f829c24e5ed0a31cb46fc2749274ef5d2776f
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'pushbullet_ruby/ephemerable'
|
2
|
+
require 'pushbullet_ruby/ephemerable/sms'
|
3
|
+
require 'pushbullet_ruby/ephemerable/notifitation'
|
4
|
+
|
5
|
+
module PushbulletRuby
|
6
|
+
module API
|
7
|
+
module Ephemerals
|
8
|
+
def send_sms(user_identifier: nil, device_identifier: nil, params: {})
|
9
|
+
PushbulletRuby::Ephemerable::Sms.push(self, user_identifier, device_identifier, params)
|
10
|
+
end
|
11
|
+
|
12
|
+
def push_notification(user_identifier: nil, device_identifier: nil, params: {})
|
13
|
+
PushbulletRuby::Ephemerable::Notification.push(self, user_identifier, device_identifier, params)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -6,16 +6,16 @@ require 'pushbullet_ruby/pushable/file'
|
|
6
6
|
module PushbulletRuby
|
7
7
|
module API
|
8
8
|
module Pushes
|
9
|
-
def push_note(receiver: nil,
|
10
|
-
PushbulletRuby::Pushable::Note.push(self, receiver,
|
9
|
+
def push_note(receiver: nil, device_identifier: nil, params: {})
|
10
|
+
PushbulletRuby::Pushable::Note.push(self, receiver, device_identifier, params)
|
11
11
|
end
|
12
12
|
|
13
|
-
def push_link(receiver: nil,
|
14
|
-
PushbulletRuby::Pushable::Link.push(self, receiver,
|
13
|
+
def push_link(receiver: nil, device_identifier: nil, params: {})
|
14
|
+
PushbulletRuby::Pushable::Link.push(self, receiver, device_identifier, params)
|
15
15
|
end
|
16
16
|
|
17
|
-
def push_file(receiver: nil,
|
18
|
-
PushbulletRuby::Pushable::File.push(self, receiver,
|
17
|
+
def push_file(receiver: nil, device_identifier: nil, params: {})
|
18
|
+
PushbulletRuby::Pushable::File.push(self, receiver, device_identifier, params)
|
19
19
|
end
|
20
20
|
|
21
21
|
def pushes
|
data/lib/pushbullet_ruby/api.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'pushbullet_ruby/api/me'
|
2
2
|
require 'pushbullet_ruby/api/devices'
|
3
3
|
require 'pushbullet_ruby/api/pushes'
|
4
|
+
require 'pushbullet_ruby/api/ephemerals'
|
4
5
|
require 'pushbullet_ruby/api/contacts'
|
5
6
|
require 'pushbullet_ruby/api/subscriptions'
|
6
7
|
|
@@ -9,6 +10,7 @@ module PushbulletRuby
|
|
9
10
|
include Me
|
10
11
|
include Devices
|
11
12
|
include Pushes
|
13
|
+
include Ephemerals
|
12
14
|
include Contacts
|
13
15
|
include Subscriptions
|
14
16
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module PushbulletRuby
|
2
|
+
class Ephemerable
|
3
|
+
class Notification < Ephemerable
|
4
|
+
def type
|
5
|
+
:push
|
6
|
+
end
|
7
|
+
|
8
|
+
def required_parameters
|
9
|
+
[:title, :body]
|
10
|
+
end
|
11
|
+
|
12
|
+
def construct_payload(user_identifier, device_identifier)
|
13
|
+
{
|
14
|
+
source_user_iden: user_identifier,
|
15
|
+
source_device_iden: device_identifier,
|
16
|
+
package_name: 'com.pushbullet.android',
|
17
|
+
type: 'mirror'
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module PushbulletRuby
|
2
|
+
class Ephemerable
|
3
|
+
class Sms < Ephemerable
|
4
|
+
def type
|
5
|
+
:push
|
6
|
+
end
|
7
|
+
|
8
|
+
def required_parameters
|
9
|
+
[:conversation_iden, :message]
|
10
|
+
end
|
11
|
+
|
12
|
+
def construct_payload(user_identifier, device_identifier)
|
13
|
+
{
|
14
|
+
source_user_iden: user_identifier,
|
15
|
+
target_device_iden: device_identifier,
|
16
|
+
package_name: 'com.pushbullet.android',
|
17
|
+
type: 'messaging_extension_reply'
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'pushbullet_ruby/ephemeral'
|
2
|
+
|
3
|
+
module PushbulletRuby
|
4
|
+
class Ephemerable
|
5
|
+
class MissingParameter < StandardError; end
|
6
|
+
|
7
|
+
attr_reader :client, :user_identifier, :device_identifier, :params
|
8
|
+
|
9
|
+
def self.push(client, user_identifier, device_identifier, params)
|
10
|
+
Ephemeral.new(new(client, user_identifier, device_identifier, params).push.body)
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(client, user_identifier, device_identifier, params)
|
14
|
+
@client = client
|
15
|
+
@user_identifier = user_identifier
|
16
|
+
@device_identifier = device_identifier
|
17
|
+
@params = params
|
18
|
+
end
|
19
|
+
|
20
|
+
def push
|
21
|
+
raise MissingParameter unless required_parameters.all? { |e| params.keys.include?(e) }
|
22
|
+
|
23
|
+
payload = {
|
24
|
+
type: type,
|
25
|
+
push: params.merge(construct_payload(user_identifier, device_identifier))
|
26
|
+
}
|
27
|
+
client.post('/v2/ephemerals', payload.to_json)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -2,7 +2,7 @@ module PushbulletRuby
|
|
2
2
|
class Pushable
|
3
3
|
class File < Pushable
|
4
4
|
def push
|
5
|
-
raise MissingParameter unless params.keys.
|
5
|
+
raise MissingParameter unless required_parameters.all? { |e| params.keys.include?(e) }
|
6
6
|
|
7
7
|
file_name = params[:file_name]
|
8
8
|
file_path = params[:file_path]
|
@@ -18,7 +18,7 @@ module PushbulletRuby
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def push
|
21
|
-
raise MissingParameter unless params.keys.
|
21
|
+
raise MissingParameter unless required_parameters.all? { |e| params.keys.include?(e) }
|
22
22
|
|
23
23
|
payload = params.merge(type: type)
|
24
24
|
payload = specify_receiver(payload)
|
data/lib/pushbullet_ruby.rb
CHANGED
@@ -2,6 +2,7 @@ require 'pushbullet_ruby/client'
|
|
2
2
|
require 'pushbullet_ruby/user'
|
3
3
|
require 'pushbullet_ruby/device'
|
4
4
|
require 'pushbullet_ruby/pushable'
|
5
|
+
require 'pushbullet_ruby/ephemerable'
|
5
6
|
require 'pushbullet_ruby/contact'
|
6
7
|
require 'pushbullet_ruby/channel'
|
7
8
|
require 'pushbullet_ruby/token'
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- creends
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- lib/pushbullet_ruby/api.rb
|
82
82
|
- lib/pushbullet_ruby/api/contacts.rb
|
83
83
|
- lib/pushbullet_ruby/api/devices.rb
|
84
|
+
- lib/pushbullet_ruby/api/ephemerals.rb
|
84
85
|
- lib/pushbullet_ruby/api/me.rb
|
85
86
|
- lib/pushbullet_ruby/api/pushes.rb
|
86
87
|
- lib/pushbullet_ruby/api/subscriptions.rb
|
@@ -90,6 +91,10 @@ files:
|
|
90
91
|
- lib/pushbullet_ruby/contact.rb
|
91
92
|
- lib/pushbullet_ruby/device.rb
|
92
93
|
- lib/pushbullet_ruby/entity.rb
|
94
|
+
- lib/pushbullet_ruby/ephemerable.rb
|
95
|
+
- lib/pushbullet_ruby/ephemerable/notifitation.rb
|
96
|
+
- lib/pushbullet_ruby/ephemerable/sms.rb
|
97
|
+
- lib/pushbullet_ruby/ephemeral.rb
|
93
98
|
- lib/pushbullet_ruby/http_exeption.rb
|
94
99
|
- lib/pushbullet_ruby/parse_json.rb
|
95
100
|
- lib/pushbullet_ruby/push.rb
|