bushido 0.0.25 → 0.0.26

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,20 +3,20 @@ module Bushido
3
3
  # PUT /bushido/data/
4
4
  def index
5
5
  @key = params.delete(:key)
6
- if ENV["BUSHIDO_KEY"] != @key
6
+ if ENV["BUSHIDO_APP_KEY"] != @key
7
7
  respond_to do |format|
8
8
  format.html { render :layout => false, :text => true, :status => :forbidden }
9
- format.json { render :status => :unprocessable_entity }
9
+ format.json { render :status => 401 }
10
10
  return
11
11
  end
12
+ end
12
13
 
13
14
  puts "OMG GOT DATA FROM BUSHIBUS"
14
15
  puts params.inspect
15
- Bushido::Data.fire(params)
16
+ Bushido::Data.fire('global', params)
16
17
  respond_to do |format|
17
- format.json {render :json =>{'acknowledged' => true} :status => 200}
18
+ format.json {render :json => {'acknowledged' => true}, :status => 200}
18
19
  end
19
- end
20
20
  end
21
21
  end
22
22
  end
@@ -4,20 +4,20 @@ module Bushido
4
4
  @@hooks = {}
5
5
 
6
6
  class << self
7
- def fire *hooks, data
7
+ def fire(data, *hooks)
8
8
  unless @@hooks[:global].nil?
9
- @@hooks[:global].call('global', data)
9
+ @@hooks[:global].call(data, 'global')
10
10
  end
11
-
11
+
12
12
  if hooks.length > 0
13
13
  hooks.each do |h|
14
14
  unless @@hooks[h].nil?
15
- @@hooks[h].call(h, data)
15
+ @@hooks[h].call(data, hook)
16
16
  end
17
17
  end
18
18
  end
19
19
  end
20
-
20
+
21
21
  def listen *hooks, &block
22
22
  if hooks.empty? and block_given?
23
23
  @@hooks[:global] = block
@@ -4,20 +4,20 @@ module Bushido
4
4
  @@hooks = {}
5
5
 
6
6
  class << self
7
- def fire *hooks
7
+ def fire(data, *hooks)
8
8
  unless @@hooks[:global].nil?
9
- @@hooks[:global].call('global')
9
+ @@hooks[:global].call(data, 'global')
10
10
  end
11
-
11
+
12
12
  if hooks.length > 0
13
13
  hooks.each do |h|
14
14
  unless @@hooks[h].nil?
15
- @@hooks[h].call(h, data)
15
+ @@hooks[h].call(data, hook)
16
16
  end
17
17
  end
18
18
  end
19
19
  end
20
-
20
+
21
21
  def listen *hooks, &block
22
22
  if hooks.empty? and block_given?
23
23
  @@hooks[:global] = block
@@ -1,4 +1,4 @@
1
1
  module Bushido
2
2
  # Current version of the Bushido gem
3
- VERSION = "0.0.25"
3
+ VERSION = "0.0.26"
4
4
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bushido
3
3
  version: !ruby/object:Gem::Version
4
- hash: 45
4
+ hash: 43
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 25
10
- version: 0.0.25
9
+ - 26
10
+ version: 0.0.26
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sean Grove
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-06-13 00:00:00 -07:00
19
+ date: 2011-06-17 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency