feed_satisfaction 0.1.0 → 0.1.1
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.
- data/lib/feed_satisfaction/fast_pass.rb +38 -26
- data/lib/feed_satisfaction/version.rb +1 -1
- metadata +2 -2
@@ -4,6 +4,8 @@ require 'oauth'
|
|
4
4
|
require 'oauth/client/net_http'
|
5
5
|
require 'erb'
|
6
6
|
|
7
|
+
# This file was adapted from http://support.soundcloud.com/fastpass/ruby.zip
|
8
|
+
|
7
9
|
#
|
8
10
|
# Helper module for integrating Get Satisfaction's FastPass single-sign-on service into a Ruby web
|
9
11
|
# app. Use #url to create a signed FastPass URL, and #script to generate the JS-based integration.
|
@@ -15,6 +17,14 @@ module FeedSatisfaction
|
|
15
17
|
def self.domain
|
16
18
|
FeedSatisfaction.domain
|
17
19
|
end
|
20
|
+
|
21
|
+
def self.key
|
22
|
+
FeedSatisfaction.fastpass_key
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.secret
|
26
|
+
FeedSatisfaction.fastpass_secret
|
27
|
+
end
|
18
28
|
|
19
29
|
#
|
20
30
|
# Generates a FastPass URL with the given +email+, +name+, and +uid+ signed with the provided
|
@@ -52,35 +62,37 @@ module FeedSatisfaction
|
|
52
62
|
# URLs to include a 'fastpass' query parameter with a signed fastpass URL.
|
53
63
|
#
|
54
64
|
def self.script(email, name, uid, secure=false, additional_fields={})
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
65
|
+
if key && secret
|
66
|
+
url = url(email, name, uid, secure, additional_fields)
|
67
|
+
|
68
|
+
html = <<-EOS
|
69
|
+
<script type="text/javascript">
|
70
|
+
var GSFN;
|
71
|
+
if(GSFN == undefined) { GSFN = {}; }
|
61
72
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
73
|
+
(function(){
|
74
|
+
add_js = function(jsid, url) {
|
75
|
+
var head = document.getElementsByTagName("head")[0];
|
76
|
+
script = document.createElement('script');
|
77
|
+
script.id = jsid;
|
78
|
+
script.type = 'text/javascript';
|
79
|
+
script.src = url;
|
80
|
+
head.appendChild(script);
|
81
|
+
}
|
82
|
+
add_js("fastpass_common", document.location.protocol + "//#{domain}/javascripts/fastpass.js");
|
72
83
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
84
|
+
if(window.onload) { var old_load = window.onload; }
|
85
|
+
window.onload = function() {
|
86
|
+
if(old_load) old_load();
|
87
|
+
add_js("fastpass", #{url.to_json});
|
88
|
+
}
|
89
|
+
})()
|
79
90
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
91
|
+
</script>
|
92
|
+
EOS
|
93
|
+
|
94
|
+
html.html_safe
|
95
|
+
end
|
84
96
|
end
|
85
97
|
end
|
86
98
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feed_satisfaction
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
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: 2011-07-
|
12
|
+
date: 2011-07-07 00:00:00.000000000 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
description: Simple Ruby on Rails engine that allows you to easily add a Get Satisfaction
|