pandapush 1.2.0 → 1.3.0
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 +4 -13
- data/lib/pandapush/client.rb +8 -4
- data/lib/pandapush/version.rb +1 -1
- metadata +5 -8
- data/MIT-LICENSE +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7eaf114b2127c4e9c12b3957c3fab1587d78b1f4
|
4
|
+
data.tar.gz: 76f9166307aa27257b5915c6a8be0152e5267a90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00cadbacf74c653b7d730560c8f6108ba556fc2ca1d451f6fc4f839fd44dd29df6f1e88c759c1b197d0118abfd186d1aaa4e012bf05131cf6f4b41bcf75f0e7c
|
7
|
+
data.tar.gz: 6beea7e93ad36f7bcb806dd15c0291066420890ca0e033418ba3709d3a289a024ddfc7d1bb8f8bffb48a630cba72d9b72ad3a35e9bc751ee14db590a3f21162f
|
data/README.md
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# Pandapush
|
2
2
|
|
3
|
-
[https://www.github.com/neilgupta/pandapush](https://www.github.com/neilgupta/pandapush)
|
4
|
-
|
5
3
|
[](http://badge.fury.io/rb/pandapush)
|
6
4
|
|
7
5
|
Pandapush is an event push system similar to Pusher for internal Instructure use.
|
@@ -76,14 +74,15 @@ Pandapush.publish(channel: 'messages', message: {user: {id: 1, name: 'Neil Gupta
|
|
76
74
|
|
77
75
|
Note: `channel` is a string and can be any valid uri, such as `'users/1'`. Pandapush will handle generating the URL with your app id and channel type.
|
78
76
|
|
79
|
-
### Pandapush.generate_token(channel:, channel_type: 'private', pub: true, sub: true)
|
77
|
+
### Pandapush.generate_token(channel:, channel_type: 'private', pub: true, sub: true, presence: nil)
|
80
78
|
|
81
79
|
Generates a JWT token for client authentication.
|
82
80
|
|
83
81
|
* `channel` - The channel name the token works for (required)
|
84
|
-
* `channel_type` - 'public' or '
|
82
|
+
* `channel_type` - 'public', 'private', or 'presence'. Defaults to private
|
85
83
|
* `pub` - true if this token allows publishing. Defaults to true
|
86
84
|
* `sub` - true if this token allows subscribing. Note that sub on a public channel is redundant. Defaults to true
|
85
|
+
* `presence` - A hash used to identify a user when subscribing to a presence channel. Must have at least an `id` key.
|
87
86
|
|
88
87
|
Example:
|
89
88
|
|
@@ -105,14 +104,6 @@ Getter and setter for your app secret.
|
|
105
104
|
|
106
105
|
### Pandapush.url
|
107
106
|
|
108
|
-
Getter and setter to override the default url we use for Pandapush.
|
107
|
+
Getter and setter to override the default url we use for Pandapush. Useful for running dockerized pandapush.
|
109
108
|
|
110
109
|
All methods can also be accessed from `Pandapush::Client.new`.
|
111
|
-
|
112
|
-
## Author
|
113
|
-
|
114
|
-
Neil Gupta [http://metamorphium.com](http://metamorphium.com)
|
115
|
-
|
116
|
-
## License
|
117
|
-
|
118
|
-
The MIT License (MIT) Copyright (c) 2015 Neil Gupta. See [MIT-LICENSE](https://raw.github.com/neilgupta/pandapush/master/MIT-LICENSE)
|
data/lib/pandapush/client.rb
CHANGED
@@ -20,7 +20,7 @@ module Pandapush
|
|
20
20
|
def publish(channel:, message:, channel_type: 'private')
|
21
21
|
raise ConfigurationError, 'Missing client configuration: please check that key, secret and app_id are configured.' unless configured?
|
22
22
|
|
23
|
-
RestClient.post channel_uri(channel, channel_type, include_base_url: true), message.to_json,
|
23
|
+
RestClient.post channel_uri(channel, channel_type, include_base_url: true), message.to_json,
|
24
24
|
{:content_type => :json, :Authorization => "Token #{generate_token(channel: channel, channel_type: channel_type)}"}
|
25
25
|
end
|
26
26
|
|
@@ -32,15 +32,19 @@ module Pandapush
|
|
32
32
|
#
|
33
33
|
# @example
|
34
34
|
# client.generate_token(channel: 'messages', sub: false)
|
35
|
-
def generate_token(channel:, channel_type: 'private', pub: true, sub: true)
|
35
|
+
def generate_token(channel:, channel_type: 'private', pub: true, sub: true, presence: nil)
|
36
36
|
raise ConfigurationError, 'Missing client configuration: please check that key, secret and app_id are configured.' unless configured?
|
37
37
|
|
38
|
-
|
38
|
+
payload = {
|
39
39
|
keyId: key,
|
40
40
|
channel: channel_uri(channel, channel_type),
|
41
41
|
pub: pub,
|
42
42
|
sub: sub
|
43
|
-
}
|
43
|
+
}
|
44
|
+
|
45
|
+
payload[:presence] = presence if presence
|
46
|
+
|
47
|
+
JWT.encode(payload, secret)
|
44
48
|
end
|
45
49
|
|
46
50
|
private
|
data/lib/pandapush/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pandapush
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neil Gupta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -101,15 +101,13 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
-
- MIT-LICENSE
|
105
104
|
- README.md
|
106
105
|
- Rakefile
|
107
106
|
- lib/pandapush.rb
|
108
107
|
- lib/pandapush/client.rb
|
109
108
|
- lib/pandapush/version.rb
|
110
|
-
homepage: https://
|
111
|
-
licenses:
|
112
|
-
- MIT
|
109
|
+
homepage: https://instructure.com
|
110
|
+
licenses: []
|
113
111
|
metadata: {}
|
114
112
|
post_install_message:
|
115
113
|
rdoc_options: []
|
@@ -127,9 +125,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
125
|
version: '0'
|
128
126
|
requirements: []
|
129
127
|
rubyforge_project:
|
130
|
-
rubygems_version: 2.
|
128
|
+
rubygems_version: 2.5.1
|
131
129
|
signing_key:
|
132
130
|
specification_version: 4
|
133
131
|
summary: Ruby client for pushing to Pandapush
|
134
132
|
test_files: []
|
135
|
-
has_rdoc:
|
data/MIT-LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright 2015 Neil Gupta
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|