prooflink_connect 0.0.19 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/prooflink_connect/version.rb +1 -1
- data/lib/prooflink_connect.rb +11 -2
- data/spec/prooflink_connect_spec.rb +47 -10
- metadata +5 -6
- data/Gemfile.lock +0 -38
data/lib/prooflink_connect.rb
CHANGED
@@ -28,14 +28,23 @@ module ProoflinkConnect
|
|
28
28
|
:subdomain => config.subdomain,
|
29
29
|
:token_url => 'https://example.com/auth/callbacks',
|
30
30
|
:forced_connect => false,
|
31
|
-
:embed_forms => false,
|
31
|
+
:embed_forms => false, # will be deprecated
|
32
32
|
:split_screen => false,
|
33
|
+
:use_popups => true,
|
34
|
+
:register_flow => false,
|
33
35
|
:width => '520px',
|
34
36
|
:height => '250px'}.merge(options)
|
35
37
|
|
36
38
|
domain_part = [options[:subdomain], config.provider_endpoint].compact.join(".")
|
37
39
|
path_part = [options[:locale], 'authentications', 'embedded'].compact.join("/")
|
38
|
-
query_part = "token_url=#{options[:token_url]}
|
40
|
+
query_part = "token_url=#{options[:token_url]}"
|
41
|
+
query_part << "&forced_connect=1" if options[:forced_connect]
|
42
|
+
query_part << "&embed_forms=1" if options[:embed_forms]
|
43
|
+
query_part << "&split_screen=1" if options[:split_screen]
|
44
|
+
query_part << "&use_popups=1" if options[:use_popups]
|
45
|
+
query_part << "&show_header=#{options[:show_header] ? 1 : 0}" if !options[:show_header].nil?
|
46
|
+
query_part << "®ister_flow=1" if options[:register_flow]
|
47
|
+
query_part << "&scenario=#{options[:scenario]}" if options[:scenario]
|
39
48
|
frame_url = "#{config.protocol}://#{domain_part}/#{path_part}?#{query_part}"
|
40
49
|
html = "<iframe src='#{frame_url}' style='width: #{options[:width]}; height: #{options[:height]}; border: 0; display: block;' frameborder='0' allowTransparency='true'></iframe>"
|
41
50
|
html.respond_to?(:html_safe) ? html.html_safe : html
|
@@ -2,37 +2,74 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe ProoflinkConnect do
|
4
4
|
it "returns iframe html with defaults" do
|
5
|
-
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks&
|
5
|
+
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks&use_popups=1' style='width: 520px; height: 250px; border: 0; display: block;' frameborder='0' allowTransparency='true'></iframe>"
|
6
6
|
ProoflinkConnect.embedded.should == result
|
7
7
|
end
|
8
8
|
|
9
9
|
it "allows pixels or percentage for width" do
|
10
|
-
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks&
|
10
|
+
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks&use_popups=1' style='width: 100%; height: 250px; border: 0; display: block;' frameborder='0' allowTransparency='true'></iframe>"
|
11
11
|
ProoflinkConnect.embedded({:width => "100%"}).should == result
|
12
12
|
end
|
13
13
|
|
14
14
|
it "adds px to width if not given" do
|
15
|
-
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks&
|
15
|
+
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks&use_popups=1' style='width: 100px; height: 250px; border: 0; display: block;' frameborder='0' allowTransparency='true'></iframe>"
|
16
16
|
ProoflinkConnect.embedded({:width => "100"}).should == result
|
17
17
|
end
|
18
18
|
|
19
19
|
it "allows pixels or percentage for height" do
|
20
|
-
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks&
|
20
|
+
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks&use_popups=1' style='width: 520px; height: 100%; border: 0; display: block;' frameborder='0' allowTransparency='true'></iframe>"
|
21
21
|
ProoflinkConnect.embedded({:height => "100%"}).should == result
|
22
22
|
end
|
23
23
|
|
24
24
|
it "adds px to height if not given" do
|
25
|
-
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks&
|
25
|
+
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks&use_popups=1' style='width: 520px; height: 100px; border: 0; display: block;' frameborder='0' allowTransparency='true'></iframe>"
|
26
26
|
ProoflinkConnect.embedded({:height => "100"}).should == result
|
27
27
|
end
|
28
28
|
|
29
|
-
it "
|
30
|
-
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks&
|
29
|
+
it "sets split screen option" do
|
30
|
+
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks&embed_forms=1&split_screen=1&use_popups=1' style='width: 520px; height: 250px; border: 0; display: block;' frameborder='0' allowTransparency='true'></iframe>"
|
31
31
|
ProoflinkConnect.embedded(:split_screen => true, :embed_forms => true).should == result
|
32
32
|
end
|
33
33
|
|
34
|
-
it "
|
35
|
-
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks&
|
36
|
-
ProoflinkConnect.embedded(:
|
34
|
+
it "sets use_popups option" do
|
35
|
+
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks&use_popups=1' style='width: 520px; height: 250px; border: 0; display: block;' frameborder='0' allowTransparency='true'></iframe>"
|
36
|
+
ProoflinkConnect.embedded(:use_popups => true).should == result
|
37
|
+
end
|
38
|
+
|
39
|
+
it "disables use_popups option" do
|
40
|
+
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks' style='width: 520px; height: 250px; border: 0; display: block;' frameborder='0' allowTransparency='true'></iframe>"
|
41
|
+
ProoflinkConnect.embedded(:use_popups => false).should == result
|
42
|
+
end
|
43
|
+
|
44
|
+
it "enables show_header option" do
|
45
|
+
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks&use_popups=1&show_header=1' style='width: 520px; height: 250px; border: 0; display: block;' frameborder='0' allowTransparency='true'></iframe>"
|
46
|
+
ProoflinkConnect.embedded(:show_header => true).should == result
|
47
|
+
end
|
48
|
+
|
49
|
+
it "disables show_header option" do
|
50
|
+
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks&use_popups=1&show_header=0' style='width: 520px; height: 250px; border: 0; display: block;' frameborder='0' allowTransparency='true'></iframe>"
|
51
|
+
ProoflinkConnect.embedded(:show_header => false).should == result
|
52
|
+
end
|
53
|
+
|
54
|
+
it "sets register_flow option" do
|
55
|
+
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks&use_popups=1®ister_flow=1' style='width: 520px; height: 250px; border: 0; display: block;' frameborder='0' allowTransparency='true'></iframe>"
|
56
|
+
ProoflinkConnect.embedded(:register_flow => true).should == result
|
57
|
+
end
|
58
|
+
|
59
|
+
context "scenario" do
|
60
|
+
it "sets manual option" do
|
61
|
+
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks&use_popups=1&scenario=manual' style='width: 520px; height: 250px; border: 0; display: block;' frameborder='0' allowTransparency='true'></iframe>"
|
62
|
+
ProoflinkConnect.embedded(:scenario => "manual").should == result
|
63
|
+
end
|
64
|
+
|
65
|
+
it "sets social option" do
|
66
|
+
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks&use_popups=1&scenario=social' style='width: 520px; height: 250px; border: 0; display: block;' frameborder='0' allowTransparency='true'></iframe>"
|
67
|
+
ProoflinkConnect.embedded(:scenario => "social").should == result
|
68
|
+
end
|
69
|
+
|
70
|
+
it "sets split screen option" do
|
71
|
+
result = "<iframe src='https://example.prooflink.com/authentications/embedded?token_url=https://example.com/auth/callbacks&use_popups=1&scenario=split_screen' style='width: 520px; height: 250px; border: 0; display: block;' frameborder='0' allowTransparency='true'></iframe>"
|
72
|
+
ProoflinkConnect.embedded(:scenario => "split_screen").should == result
|
73
|
+
end
|
37
74
|
end
|
38
75
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prooflink_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 55
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 20
|
10
|
+
version: 0.0.20
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chiel Wester
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-12-21 00:00:00 +01:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -120,7 +120,6 @@ files:
|
|
120
120
|
- .rspec
|
121
121
|
- .travis.yml
|
122
122
|
- Gemfile
|
123
|
-
- Gemfile.lock
|
124
123
|
- README.md
|
125
124
|
- Rakefile
|
126
125
|
- lib/prooflink_connect.rb
|
@@ -171,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
170
|
requirements: []
|
172
171
|
|
173
172
|
rubyforge_project: prooflink_connect
|
174
|
-
rubygems_version: 1.
|
173
|
+
rubygems_version: 1.4.1
|
175
174
|
signing_key:
|
176
175
|
specification_version: 3
|
177
176
|
summary: Make a connection to the prooflink connect api
|
data/Gemfile.lock
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
prooflink_connect (0.0.17)
|
5
|
-
activesupport
|
6
|
-
httparty
|
7
|
-
json
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: http://rubygems.org/
|
11
|
-
specs:
|
12
|
-
activesupport (3.0.10)
|
13
|
-
addressable (2.2.6)
|
14
|
-
crack (0.1.8)
|
15
|
-
diff-lcs (1.1.2)
|
16
|
-
httparty (0.7.8)
|
17
|
-
crack (= 0.1.8)
|
18
|
-
json (1.5.3)
|
19
|
-
rspec (2.6.0)
|
20
|
-
rspec-core (~> 2.6.0)
|
21
|
-
rspec-expectations (~> 2.6.0)
|
22
|
-
rspec-mocks (~> 2.6.0)
|
23
|
-
rspec-core (2.6.4)
|
24
|
-
rspec-expectations (2.6.0)
|
25
|
-
diff-lcs (~> 1.1.2)
|
26
|
-
rspec-mocks (2.6.0)
|
27
|
-
webmock (1.7.2)
|
28
|
-
addressable (~> 2.2, > 2.2.5)
|
29
|
-
crack (>= 0.1.7)
|
30
|
-
|
31
|
-
PLATFORMS
|
32
|
-
ruby
|
33
|
-
|
34
|
-
DEPENDENCIES
|
35
|
-
bundler (>= 1.0.0)
|
36
|
-
prooflink_connect!
|
37
|
-
rspec
|
38
|
-
webmock
|