pusher-hackathon 0.0.3 → 0.0.4

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
  SHA1:
3
- metadata.gz: b23d0851b6eae28898741700a414602408bb87e1
4
- data.tar.gz: fa6880ccd5a5faf419112d9975af8d4516f61df9
3
+ metadata.gz: 1452fc461d4d8bcb72914fc68946f50700123ad2
4
+ data.tar.gz: b29fa9cf62e662e2688dae220e9bec79cc48807d
5
5
  SHA512:
6
- metadata.gz: e5eaeb0d50ac9daff4678eaf99b174adfd27eaa109f85242e704d6ce964a1f79e9f862036f4fbfd82d97bdef653cbe5650b76a07ca2eca454f83030b1e017de6
7
- data.tar.gz: 23c1ba0504ae25a5752433127334e4434402d5f63163ea495c7e43ca8872055aa0b42afbc42d3c540cf88c81b1d96a46c807a7b90985478366eccdecb68277cb
6
+ metadata.gz: 9e168ca29cf1b02aa34a23dcbcc16605f57a5642f9f996f8c788e6268cdcc8dc63ef6a50858ff67d56a52cf3cf2e5c5e53d54d8a472913a3e678b28c6bfbc0ec
7
+ data.tar.gz: f0ba9eb7507b7ea18476ea5e181de4544e7ab193effcd334ee6f44f369ec4ab56d4209456e837a74a65331d7a15ced679238e28251eb0cf612edf4dc66c7f14c
data/README.md CHANGED
@@ -1,26 +1,38 @@
1
- # Pusher::Hackathon
1
+ # Hackauthon
2
2
 
3
- TODO: Write a gem description
3
+ Setting up a server that authenticates private- and presence-channels for hackathon attendees, so they have more time to get hacking.
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line to your application's Gemfile:
7
+ $ gem install pusher-hackathon
8
8
 
9
- ```ruby
10
- gem 'pusher-hackathon'
11
- ```
9
+ ## Usage
12
10
 
13
- And then execute:
11
+ Simply run the `pusher-hackathon` command, with your app's `id`, `key`, and `secret` as options. If you wish, you can choose to specify a `port`.
14
12
 
15
- $ bundle
13
+ $ pusher-hackathon run --id your_app_id \
14
+ --secret your_app_secret \
15
+ --key your_app_key \
16
+ [--port your_port]
16
17
 
17
- Or install it yourself as:
18
+ This will set up a Sinatra server for you. The default port it will be running on is `9090`.
18
19
 
19
- $ gem install pusher-hackathon
20
+ Then, in your Javascript code, make the Pusher connection point to this server's `pusher/auth` endpoint for authentication. For presence-channels, you can also specify information to be associated with a channel member. A `user_id` is required, and `user_info` is optional.
20
21
 
21
- ## Usage
22
+ ```js
23
+ var pusher = new Pusher('APP_KEY', {
24
+ authEndpoint: "http://localhost:9090/pusher/auth", // 9090 can be substituted for the port you specified.
25
+
26
+ auth: {
27
+ params: {
28
+ user_id: 1,
29
+ user_info: JSON.stringify({twitter: "pusher"}) // optional
30
+ }
31
+ }
32
+ });
33
+ ```
22
34
 
23
- TODO: Write usage instructions here
35
+ Boom, job done! Now get hacking!
24
36
 
25
37
  ## Contributing
26
38
 
@@ -1,3 +1,3 @@
1
1
  module PusherHackathon
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/hackathon.rb CHANGED
@@ -10,8 +10,8 @@ module PusherHackathon
10
10
  response['Access-Control-Allow-Origin'] = '*'
11
11
 
12
12
  Pusher[params[:channel_name]].authenticate(params[:socket_id], {
13
- user_id: params[:user_id],
14
- user_info: JSON.parse(params[:user_info])
13
+ user_id: params[:user_id] || 1,
14
+ user_info: JSON.parse(params[:user_info] || {twitter: 'pusher'}.to_json)
15
15
  }).to_json
16
16
  end
17
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pusher-hackathon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Patel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-29 00:00:00.000000000 Z
11
+ date: 2015-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler