koala 0.9.0 → 0.10.0

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.
Files changed (37) hide show
  1. data/CHANGELOG +10 -0
  2. data/Manifest +2 -14
  3. data/Rakefile +2 -1
  4. data/koala.gemspec +7 -4
  5. data/lib/koala/test_users.rb +72 -0
  6. data/lib/koala.rb +15 -1
  7. data/readme.md +3 -2
  8. data/spec/facebook_data.yml +5 -5
  9. data/spec/koala/api_base_tests.rb +7 -0
  10. data/spec/koala/graph_and_rest_api/graph_and_rest_api_with_token_tests.rb +1 -1
  11. data/spec/koala/graph_api/graph_api_with_access_token_tests.rb +1 -1
  12. data/spec/koala/graph_api/graph_collection_tests.rb +2 -2
  13. data/spec/koala/live_testing_data_helper.rb +40 -12
  14. data/spec/koala/net_http_service_tests.rb +164 -159
  15. data/spec/koala/oauth/oauth_tests.rb +9 -11
  16. data/spec/koala/rest_api/rest_api_no_access_token_tests.rb +5 -5
  17. data/spec/koala/rest_api/rest_api_with_access_token_tests.rb +1 -1
  18. data/spec/koala/test_users/test_users_tests.rb +215 -0
  19. data/spec/koala_spec_helper.rb +21 -4
  20. data/spec/koala_spec_without_mocks.rb +1 -1
  21. data/spec/mock_facebook_responses.yml +49 -1
  22. data/spec/mock_http_service.rb +1 -0
  23. metadata +20 -19
  24. data/examples/oauth_playground/Capfile +0 -2
  25. data/examples/oauth_playground/LICENSE +0 -22
  26. data/examples/oauth_playground/Rakefile +0 -4
  27. data/examples/oauth_playground/config/deploy.rb +0 -39
  28. data/examples/oauth_playground/config/facebook.yml +0 -13
  29. data/examples/oauth_playground/config.ru +0 -27
  30. data/examples/oauth_playground/lib/load_facebook.rb +0 -3
  31. data/examples/oauth_playground/lib/oauth_playground.rb +0 -187
  32. data/examples/oauth_playground/readme.md +0 -8
  33. data/examples/oauth_playground/spec/oauth_playground_spec.rb +0 -35
  34. data/examples/oauth_playground/spec/spec_helper.rb +0 -36
  35. data/examples/oauth_playground/tmp/restart.txt +0 -0
  36. data/examples/oauth_playground/views/index.erb +0 -206
  37. data/examples/oauth_playground/views/layout.erb +0 -39
@@ -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>