koala 0.9.0 → 0.9.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.
@@ -1,8 +0,0 @@
1
- A simple OAuth Playground chock full of the info you need to test your OAuth-based Facebook application.
2
-
3
- To Do's
4
- =======
5
-
6
- * Extend the permissions controls to cover all available permissions
7
- * Make expiration dates human-readable
8
- * Let people plug in their own app (updating the app's connect properties through setAppProperties)
@@ -1,35 +0,0 @@
1
- require 'spec_helper'
2
- require 'ruby-debug'
3
-
4
- describe 'OAuthPlayground' do
5
- before :each do
6
- @hydra = Typhoeus::Hydra.hydra
7
- end
8
-
9
- after :each do
10
- @hydra.clear_stubs
11
- end
12
-
13
- it 'should load the index' do
14
- get '/'
15
- last_response.should be_ok
16
- end
17
-
18
- =begin
19
- # unfortunately, this fails when you pass the get method a param named code!
20
- # fixing this will require some mucking around in Rack::Test
21
-
22
- it "should make a request to Facebook's OAuth server when passed a code" do
23
- test_string = Regexp.new("The time is #{Time.now.to_i}")
24
-
25
- # stub out the request and make sure it's returned
26
- @hydra.stub("https://#{Koala::Facebook::GRAPH_SERVER}/oauth/access_token", "get").and_return(test_string)
27
-
28
- get "/", {"code" => "foo_bar"}
29
-
30
- # make sure the body includes the request string
31
- last_response.body.should =~ test_string
32
- end
33
- =end
34
- end
35
-
@@ -1,36 +0,0 @@
1
- require 'rubygems'
2
- require 'sinatra'
3
- require 'rack/test'
4
- require 'typhoeus'
5
- require 'koala'
6
-
7
- require File.join(File.dirname(__FILE__), '..', 'lib', 'oauth_playground.rb')
8
- require File.join(File.dirname(__FILE__), '..', 'lib', 'load_facebook.rb')
9
-
10
- OAuthPlayground.set(
11
- :environment => :test,
12
- :run => false,
13
- :raise_errors => true,
14
- :logging => false
15
- )
16
-
17
- module TestHelper
18
-
19
- def app
20
- # change to your app class if using the 'classy' style
21
- OAuthPlayground
22
- end
23
-
24
- def body
25
- last_response.body
26
- end
27
-
28
- def status
29
- last_response.status
30
- end
31
-
32
- include Rack::Test::Methods
33
-
34
- end
35
-
36
- include TestHelper
File without changes
@@ -1,206 +0,0 @@
1
- <div id="header">
2
- <h1>Facebook OAuth Playground</h1>
3
- <h4>Powered by <a href="http://github.com/arsduo/koala" target="_blank">Koala</a></h2>
4
- <h4>For novelty use only. Remember, the application's secret key is public.</h4>
5
- </div>
6
-
7
- <style>
8
- #header {
9
- text-align: center;
10
- }
11
-
12
- h1, h2, h3, h4 { margin: 0; }
13
-
14
- .section {
15
- border: 1px solid black;
16
- padding: 10px;
17
- -moz-border-radius: 9px;
18
- -webkit-border-radius: 9px;
19
- margin-bottom: 10px;
20
- width: 100%;
21
- }
22
-
23
- #contents {
24
- border: 2px solid #CCC;
25
- border-width: 2px 0;
26
- background-color: #EEE;
27
- padding: 14px 3px 8px 8px;
28
- }
29
-
30
- #configurationInfo {
31
- float:left;
32
- margin-right: 2.5%;
33
- width: 25%;
34
- }
35
-
36
- #configurationInfo .section {
37
- background-color: #CCC;
38
- }
39
-
40
- #permissions .header {
41
- margin-bottom: 5px;
42
- }
43
-
44
- #permissions .list {
45
- height: 380px;
46
- overflow: auto;
47
- }
48
-
49
- #generatedInfo {
50
- float: left;
51
- width: 70%;
52
- }
53
-
54
- #generatedInfo .section {
55
- border-color: gray;
56
- background: #DDD;
57
- overflow: auto;
58
- }
59
-
60
- .clearFloat {
61
- height: 1px;
62
- height: 0px;
63
- clear: both;
64
- overflow: hidden;
65
- }
66
-
67
- ul, li { margin: 0; padding: 0; list-style: none; }
68
- ul { margin: 12px 0; }
69
-
70
- .code {
71
- font-family: Courier, fixed;
72
- font-size: 1.15em;
73
- width: 100%;
74
- }
75
-
76
- .explanation {
77
- font-size: 0.9em;
78
- }
79
-
80
- .datumName {
81
- font-weight: bold;
82
- }
83
-
84
- .permissionType {
85
- font-style: italic;
86
- }
87
- </style>
88
-
89
- </style>
90
-
91
- <div id="contents">
92
-
93
- <div id="configurationInfo">
94
- <div id="fbApp" class="section">
95
- <h3>Facebook App Info</h3>
96
- <ul>
97
- <% @app_data.each_pair do |key, value| %>
98
- <li><span class="datumName"><%= key %>:</span> <%= value %></li>
99
- <% end %>
100
- </ul>
101
- </div>
102
-
103
- <div id="permissions" class="section">
104
- <form method="get">
105
- <div class="header">
106
- <h3>Permissions</h3>
107
- <input type="submit" value="Update permissions" />
108
- <a href="/">Reset Selection</a>
109
- <div class="explanation">Choose permissions for the OAuth URL and the fb:login button.</div>
110
- <% if @fetched_permissions %>
111
- <div class="permissionType">Showing currently-active permissions</div>
112
- <div class="explanation">(These were fetched by Koala as the page loaded!)</div>
113
- <% else %>
114
- <div class="permissionType">Showing selected permissions</div>
115
- <% end %>
116
- </div>
117
-
118
- <div class="list">
119
- <% @available_permissions.each do |permissions| %>
120
- <h4><%= permissions[:name] %> Permissions</h4>
121
- <ul>
122
- <% permissions[:perms].each do |p| %>
123
- <li>
124
- <input type="checkbox" id="permission<%= p %>" name="permissions[]" value="<%= p %>" <%= @active_permissions.include?(p) ? "checked='checked'" : "" %> />
125
- <label for="permission<%= p %>"><%= p %></a> (<a href="#" onclick="FB.api({method: 'auth.revokeExtendedPermission', perm: '<%= p %>'}, function(response) { alert(response) }); return false;">revoke</a>)
126
- </li>
127
- <% end %>
128
- </ul>
129
- <% end %>
130
- </div>
131
- </form>
132
- </div>
133
- </div>
134
-
135
- <div id="generatedInfo">
136
- <div id="oauthURLs" class="section">
137
- <h3>OAuth URLs</h3>
138
- <ul>
139
- <li><span class="datumName">Generate a code:</span> <a href="<%= @oauth.url_for_oauth_code(:permissions => @permissions) %>"><%= @oauth.url_for_oauth_code(:permissions => @permissions) %></a></li>
140
- <li><span class="datumName">OAuth code:</span> <%= @code || "click on the link above" %></li>
141
- <li>
142
- <span class="datumName">Access token:</span> <%= @oauth_access_token || "click on the link above" %>
143
- <% if @oauth_access_token %><div class="explanation">This was fetched by Koala as the page loaded!</div><% end %>
144
- </li>
145
- <li><span class="datumName">Expiration:</span> <%= @expiration || "click on the link above" %></li>
146
- <li><span class="datumName">Raw access response:</span> <%= @raw_access_response || "click on the link above" %></li>
147
- <li><span class="datumName">URL for access code:</span>
148
- <% if @code %>
149
- <a href="<%= @oauth.url_for_access_token(@code) %>"><%= @oauth.url_for_access_token(@code) %></a>
150
- <% else %>
151
- click on the link above
152
- <% end %>
153
- </li>
154
- </ul>
155
- </div>
156
-
157
- <div id="jsLogin" class="section">
158
- <h3>Javascript Login (e.g. Facebook Connect)</h3>
159
- <p>
160
- <fb:login-button onlogin="location.reload()" perms="<%= (@permissions || []).join(",") %>"></fb:login-button>
161
- <% if @permissions %>
162
- and prompt for <%= @permissions.join(", ") %>
163
- <% end %>
164
- <% if @facebook_cookies %>
165
- <div class="logout">
166
- <a href="#" onclick="FB.logout(function() { location.reload() }); return false;">Logout</a>
167
- </div>
168
- <% end %>
169
- </p>
170
- </div>
171
-
172
- <div id="cookieInfo" class="section">
173
- <h3>Cookie info</h3>
174
- <ul>
175
- <% if @facebook_cookies %>
176
- <% @facebook_cookies.each_pair do |key, value| %>
177
- <li><span class="datumName"><%= key %>:</span> <%= value %></li>
178
- <% end %>
179
- <% else %>
180
- <li>You're not signed in via Javascript. Login below.</li>
181
- <% end %>
182
- <li><span class="datumName">Raw hash</span>:
183
- <div class="code"><%= request.cookies.inspect %></div>
184
- </li>
185
- </ul>
186
- </div>
187
-
188
- <div id="koala" class="section">
189
- <h3>Koala</h3>
190
- <ul>
191
- <li><span class="datumName">GraphAPI:</span>
192
- <div class="code"><%= @access_token ? "@graph = Koala::Facebook::GraphAPI.new(\"#{@access_token}\")" : "sign in above" %></div>
193
- </li>
194
- <li><span class="datumName">OAuth:</span>
195
- <div class="code">@oauth = Koala::Facebook::OAuth.new(<%= @app_data["app_id"] %>, "<%= @app_data["secret_key"] %>", "<%= @app_data["callback_url"] %>")</div>
196
- </li>
197
- </ul>
198
- </div>
199
- </div>
200
-
201
- <div class="clearFloat">&nbsp;</div>
202
- </div>
203
-
204
- <center>
205
- <h5>Check out the playground's code at <a href="http://github.com/arsduo/oauth_playground">http://github.com/arsduo/oauth_playground</a>!</h5>
206
- </center>
@@ -1,39 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Facebook OAuth Playground</title>
4
- <meta name="description" content="Making it easier to play with Facebook's new Graph API and OAuth authentication."></meta>
5
- <style>
6
- body {
7
- font-family: verdana, arial, sans-serif;
8
- font-size: 12px;
9
- margin: 0px;
10
- }
11
- </style>
12
- </head>
13
- <body>
14
-
15
- <script type="text/javascript">
16
-
17
- var _gaq = _gaq || [];
18
- _gaq.push(['_setAccount', 'UA-16395421-1']);
19
- _gaq.push(['_trackPageview']);
20
-
21
- (function() {
22
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
23
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
24
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
25
- })();
26
-
27
- </script>
28
-
29
- <%= yield %>
30
-
31
- <div id="fb-root"></div>
32
- <script src="http://connect.facebook.net/en_US/all.js"></script>
33
- <script>
34
- FB.init({ appId: <%= @app_data["app_id"] %>, cookie: true, status: true, xfbml: true });
35
- </script>
36
-
37
- </body>
38
-
39
- </html>