wix-apps 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# Wix::Apps
|
2
2
|
[![Build Status](https://secure.travis-ci.org/wix/wix-apps-ruby.png?branch=master)](http://travis-ci.org/wix/wix-apps-ruby)
|
3
3
|
|
4
|
-
|
4
|
+
Rack middleware use with "Third Party Applications".
|
5
|
+
It checks signature and passes the parsed_instance param to you application
|
5
6
|
|
6
7
|
## Installation
|
7
8
|
|
@@ -19,7 +20,18 @@ Or install it yourself as:
|
|
19
20
|
|
20
21
|
## Usage
|
21
22
|
|
22
|
-
|
23
|
+
### Any Rack Application
|
24
|
+
Add Wix::Apps::SignedInstanceMiddleware as any other middleware.
|
25
|
+
```ruby
|
26
|
+
use Wix::Apps::SignedInstanceMiddleware, secured_paths: ['/yours', '/paths'], secret_key: 'secret_key'
|
27
|
+
```
|
28
|
+
### Rails
|
29
|
+
In application.rb, add:
|
30
|
+
```ruby
|
31
|
+
config.middleware.use Wix::Apps::SignedInstanceMiddleware,
|
32
|
+
secured_paths: ['/yours', '/paths'], secret_key: 'your-secret-key'
|
33
|
+
```
|
34
|
+
|
23
35
|
|
24
36
|
## Contributing
|
25
37
|
|
data/lib/wix-apps/version.rb
CHANGED
@@ -35,7 +35,7 @@ describe Wix::Apps::SignedInstanceMiddleware do
|
|
35
35
|
describe "instance parsing" do
|
36
36
|
it "have instance_id" do
|
37
37
|
app.should_receive(:call) do |arg|
|
38
|
-
arg['rack.request.query_hash']['
|
38
|
+
arg['rack.request.query_hash']['parsed_instance']['instance_id']
|
39
39
|
.should eq('b8140e4d-475d-48ed-819f-bad0de447069')
|
40
40
|
|
41
41
|
[200, {}, []]
|
@@ -46,7 +46,7 @@ describe Wix::Apps::SignedInstanceMiddleware do
|
|
46
46
|
|
47
47
|
it "have sign_date" do
|
48
48
|
app.should_receive(:call) do |arg|
|
49
|
-
arg['rack.request.query_hash']['
|
49
|
+
arg['rack.request.query_hash']['parsed_instance']['sign_date']
|
50
50
|
.should eq(DateTime.parse("2012-08-11T13:56:44.635Z"))
|
51
51
|
[200, {}, []]
|
52
52
|
end
|
@@ -60,7 +60,7 @@ describe Wix::Apps::SignedInstanceMiddleware do
|
|
60
60
|
|
61
61
|
it "have user_id" do
|
62
62
|
app.should_receive(:call) do |arg|
|
63
|
-
arg['rack.request.query_hash']['
|
63
|
+
arg['rack.request.query_hash']['parsed_instance']['user_id']
|
64
64
|
.should eq('29d8204a-3b82-4a98-8d86-2464a6b836da')
|
65
65
|
[200, {}, []]
|
66
66
|
end
|
@@ -70,7 +70,7 @@ describe Wix::Apps::SignedInstanceMiddleware do
|
|
70
70
|
|
71
71
|
it "don't have permissions" do
|
72
72
|
app.should_receive(:call) do |arg|
|
73
|
-
arg['rack.request.query_hash']['
|
73
|
+
arg['rack.request.query_hash']['parsed_instance']['permissions']
|
74
74
|
.should be_nil
|
75
75
|
[200, {}, []]
|
76
76
|
end
|
@@ -85,7 +85,7 @@ describe Wix::Apps::SignedInstanceMiddleware do
|
|
85
85
|
|
86
86
|
it "it have user_id" do
|
87
87
|
app.should_receive(:call) do |arg|
|
88
|
-
arg['rack.request.query_hash']['
|
88
|
+
arg['rack.request.query_hash']['parsed_instance']['user_id']
|
89
89
|
.should eq('29d8204a-3b82-4a98-8d86-2464a6b836da')
|
90
90
|
[200, {}, []]
|
91
91
|
end
|
@@ -95,7 +95,7 @@ describe Wix::Apps::SignedInstanceMiddleware do
|
|
95
95
|
|
96
96
|
it "have permissions" do
|
97
97
|
app.should_receive(:call) do |arg|
|
98
|
-
arg['rack.request.query_hash']['
|
98
|
+
arg['rack.request.query_hash']['parsed_instance']['permissions']
|
99
99
|
.should eq('OWNER')
|
100
100
|
[200, {}, []]
|
101
101
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wix-apps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -130,7 +130,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
130
130
|
version: '0'
|
131
131
|
segments:
|
132
132
|
- 0
|
133
|
-
hash:
|
133
|
+
hash: 3249941168280676654
|
134
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
135
|
none: false
|
136
136
|
requirements:
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
version: '0'
|
140
140
|
segments:
|
141
141
|
- 0
|
142
|
-
hash:
|
142
|
+
hash: 3249941168280676654
|
143
143
|
requirements: []
|
144
144
|
rubyforge_project:
|
145
145
|
rubygems_version: 1.8.24
|