polleverywhere 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +1 -4
- data/README.md +35 -15
- data/Rakefile +51 -15
- data/api/config.rb +16 -14
- data/api/config.ru +0 -9
- data/api/public/favicon.ico +0 -0
- data/api/public/javascripts/jquery-1.6.2.min.js +18 -0
- data/api/public/javascripts/jquery.tableofcontents.js +312 -0
- data/api/views/index.html.haml +81 -105
- data/api/views/layout.haml +39 -15
- data/api/views/stylesheets/site.css.sass +4 -2
- data/lib/polleverywhere/haml.rb +13 -0
- data/lib/polleverywhere/http/request_builder.rb +0 -3
- data/lib/polleverywhere/version.rb +2 -2
- data/lib/polleverywhere.rb +0 -1
- data/polleverywhere.gemspec +1 -1
- data/spec/spec_helper.rb +0 -2
- metadata +39 -45
- data/api/build/index.html +0 -0
- data/docs/api.haml +0 -112
- data/lib/polleverywhere/api.rb +0 -37
@@ -0,0 +1,312 @@
|
|
1
|
+
/*
|
2
|
+
TableOfContents Plugin for jQuery
|
3
|
+
|
4
|
+
Programmed by Doug Neiner
|
5
|
+
|
6
|
+
Version: 0.8
|
7
|
+
|
8
|
+
Based on code and concept by Janko Jovanovic
|
9
|
+
in his article: http://www.jankoatwarpspeed.com/post/2009/08/20/Table-of-contents-using-jQuery.aspx
|
10
|
+
|
11
|
+
This plugin is offered under the MIT license:
|
12
|
+
|
13
|
+
(c) 2009 by Doug Neiner, http://dougneiner.com
|
14
|
+
|
15
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
16
|
+
a copy of this software and associated documentation files (the
|
17
|
+
"Software"), to deal in the Software without restriction, including
|
18
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
19
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
20
|
+
permit persons to whom the Software is furnished to do so, subject to
|
21
|
+
the following conditions:
|
22
|
+
|
23
|
+
The above copyright notice and this permission notice shall be
|
24
|
+
included in all copies or substantial portions of the Software.
|
25
|
+
|
26
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
27
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
28
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
29
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
30
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
31
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
32
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
33
|
+
|
34
|
+
*/
|
35
|
+
|
36
|
+
|
37
|
+
(function($){
|
38
|
+
|
39
|
+
$.TableOfContents = function(el, scope, options){
|
40
|
+
// To avoid scope issues, use 'base' instead of 'this'
|
41
|
+
// to reference this class from internal events and functions.
|
42
|
+
var base = this;
|
43
|
+
|
44
|
+
// Access to jQuery and DOM versions of element
|
45
|
+
base.$el = $(el);
|
46
|
+
base.el = el;
|
47
|
+
|
48
|
+
base.toc = ""; // We use this to build our TOC;
|
49
|
+
base.listStyle = null; // This will store the type of list
|
50
|
+
base.tags = ["h1","h2","h3","h4","h5","h6"]; // The six header tags
|
51
|
+
|
52
|
+
|
53
|
+
base.init = function(){
|
54
|
+
// Merge the defaultOptions with any options passed in
|
55
|
+
base.options = $.extend({},$.TableOfContents.defaultOptions, options);
|
56
|
+
|
57
|
+
// Gets the scope. Defaults to the entire document if not specified
|
58
|
+
if(typeof(scope) == "undefined" || scope == null) scope = document.body;
|
59
|
+
base.$scope = $(scope);
|
60
|
+
|
61
|
+
// Find the first heading withing the scope
|
62
|
+
var $first = base.$scope.find(base.tags.join(', ')).filter(':first');
|
63
|
+
|
64
|
+
// If no headings were found, stop building the TOC
|
65
|
+
if($first.length != 1) return;
|
66
|
+
|
67
|
+
// Set the starting depth
|
68
|
+
base.starting_depth = base.options.startLevel;
|
69
|
+
|
70
|
+
// Quick validation on depth
|
71
|
+
if(base.options.depth < 1) base.options.depth = 1;
|
72
|
+
|
73
|
+
// Get only the tags starting with startLevel, and counting the depth
|
74
|
+
var filtered_tags = base.tags.splice(base.options.startLevel - 1, base.options.depth);
|
75
|
+
|
76
|
+
// Cache all the headings that match our new filter
|
77
|
+
base.$headings = base.$scope.find(filtered_tags.join(', '));
|
78
|
+
|
79
|
+
|
80
|
+
// If topLinks is enabled, set/get an id for the body element
|
81
|
+
if(base.options.topLinks !== false){
|
82
|
+
var id = $(document.body).attr('id');
|
83
|
+
if(id == "") {
|
84
|
+
id = base.options.topBodyId;
|
85
|
+
document.body.id = id;
|
86
|
+
};
|
87
|
+
|
88
|
+
// Cache the id locally
|
89
|
+
base.topLinkId = id;
|
90
|
+
};
|
91
|
+
|
92
|
+
|
93
|
+
// Find out which list style to use
|
94
|
+
if(base.$el.is('ul')){
|
95
|
+
base.listStyle = 'ul';
|
96
|
+
} else if (base.$el.is('ol')){
|
97
|
+
base.listStyle = 'ol';
|
98
|
+
};
|
99
|
+
|
100
|
+
|
101
|
+
base.buildTOC();
|
102
|
+
|
103
|
+
if(base.options.proportionateSpacing === true && !base.tieredList()){
|
104
|
+
base.addSpacing();
|
105
|
+
};
|
106
|
+
|
107
|
+
return base; // Return this object for memory cleanup
|
108
|
+
};
|
109
|
+
|
110
|
+
// Helper function that returns true for both OL and UL lists
|
111
|
+
base.tieredList = function(){
|
112
|
+
return (base.listStyle == 'ul' || base.listStyle == 'ol');
|
113
|
+
};
|
114
|
+
|
115
|
+
base.buildTOC = function(){
|
116
|
+
base.current_depth = base.starting_depth;
|
117
|
+
|
118
|
+
base.$headings.each(function(i,element){
|
119
|
+
// Get current depth base on h1, h2, h3, etc.
|
120
|
+
var depth = this.nodeName.toLowerCase().substr(1,1);
|
121
|
+
|
122
|
+
// This changes depth, or adds separators, only if not the first item
|
123
|
+
if(i > 0 || ( i == 0 && depth != base.current_depth)){
|
124
|
+
|
125
|
+
base.changeDepth(depth)
|
126
|
+
};
|
127
|
+
|
128
|
+
// Add the TOC link
|
129
|
+
base.toc += base.formatLink(this, depth, i) + "\n";
|
130
|
+
|
131
|
+
// Add the topLink if enabled
|
132
|
+
if(base.options.topLinks !== false) base.addTopLink(this);
|
133
|
+
});
|
134
|
+
|
135
|
+
// Close up any nested list
|
136
|
+
base.changeDepth(base.starting_depth, true);
|
137
|
+
|
138
|
+
// Wrap entire TOC in an LI if item was nested.
|
139
|
+
if(base.tieredList()) base.toc = "<li>\n" + base.toc + "</li>\n";
|
140
|
+
|
141
|
+
// Update the TOC element with the completed TOC
|
142
|
+
base.$el.html(base.toc);
|
143
|
+
};
|
144
|
+
|
145
|
+
base.addTopLink = function(element){
|
146
|
+
// Get the text for the link (if topLinks === true, it defaults to "Top")
|
147
|
+
var text = (base.options.topLinks === true ? "Top" : base.options.topLinks );
|
148
|
+
var $a = $("<a href='#" + base.topLinkId + "' class='" + base.options.topLinkClass + "'></a>").html(text);
|
149
|
+
|
150
|
+
// Append to the current Header element
|
151
|
+
$(element).append($a);
|
152
|
+
};
|
153
|
+
|
154
|
+
base.formatLink = function(element, depth, index){
|
155
|
+
// Get the current id of the header element
|
156
|
+
var id = element.id;
|
157
|
+
|
158
|
+
// If no id exisits, create a unique one
|
159
|
+
if(id == ""){
|
160
|
+
id = base.buildSlug($(element).text());
|
161
|
+
element.id = id;
|
162
|
+
};
|
163
|
+
|
164
|
+
// Start building the a link
|
165
|
+
var a = "<a href='#" + id + "'";
|
166
|
+
|
167
|
+
// If this isn't a tiered list, we need to add the depth class
|
168
|
+
if(!base.tieredList()) a += " class='" + base.depthClass(depth) + "'";
|
169
|
+
|
170
|
+
// Finish building the link
|
171
|
+
a += ">" + base.options.levelText.replace('%', $(element).text()) + '</a>';
|
172
|
+
return a;
|
173
|
+
};
|
174
|
+
|
175
|
+
base.changeDepth = function(new_depth, last){
|
176
|
+
if(last !== true) last = false;
|
177
|
+
|
178
|
+
// If straight links, just change depth and return
|
179
|
+
if(!base.tieredList()){
|
180
|
+
base.current_depth = new_depth;
|
181
|
+
return true;
|
182
|
+
};
|
183
|
+
|
184
|
+
// If nested
|
185
|
+
if(new_depth > base.current_depth){
|
186
|
+
// Add enough opening tags to step into the heading
|
187
|
+
// as it is possible that a poorly built document
|
188
|
+
// steps from h1 to h3 without an h2
|
189
|
+
var opening_tags = [];
|
190
|
+
for(var i = base.current_depth; i < new_depth; i++){
|
191
|
+
opening_tags.push('<' + base.listStyle + '>' + "\n");
|
192
|
+
};
|
193
|
+
var li = "<li>\n";
|
194
|
+
|
195
|
+
// Add the code to our TOC and an opening LI
|
196
|
+
base.toc += opening_tags.join(li) + li;
|
197
|
+
|
198
|
+
} else if (new_depth < base.current_depth){
|
199
|
+
// Close all the loops
|
200
|
+
var closing_tags = [];
|
201
|
+
for(var i = base.current_depth; i > new_depth; i--){
|
202
|
+
closing_tags.push('</' + base.listStyle + '>' + "\n");
|
203
|
+
};
|
204
|
+
|
205
|
+
// Add closing LI and any additional closing tags
|
206
|
+
base.toc += "</li>\n" + closing_tags.join('</li>' + "\n");
|
207
|
+
|
208
|
+
// Open next block
|
209
|
+
if (!last) {
|
210
|
+
base.toc += "</li>\n<li>\n";
|
211
|
+
}
|
212
|
+
} else {
|
213
|
+
// Just close a tag and open a new one
|
214
|
+
// since the depth has not changed
|
215
|
+
if (!last) {
|
216
|
+
base.toc += "</li>\n<li>\n";
|
217
|
+
}
|
218
|
+
};
|
219
|
+
|
220
|
+
// Store the new depth
|
221
|
+
base.current_depth = new_depth;
|
222
|
+
};
|
223
|
+
|
224
|
+
base.buildSlug = function(text){
|
225
|
+
text = text.toLowerCase().replace(/[^a-z0-9 -]/gi,'').replace(/ /gi,'-');
|
226
|
+
text = text.substr(0,50);
|
227
|
+
return text;
|
228
|
+
};
|
229
|
+
|
230
|
+
base.depthClass = function(depth){
|
231
|
+
// Normalizes the depths to always start at 1, even if the starting tier is a h4
|
232
|
+
return base.options.levelClass.replace('%', (depth - ( base.starting_depth - 1 ) ) );
|
233
|
+
};
|
234
|
+
|
235
|
+
base.addSpacing = function(){
|
236
|
+
var start = base.$headings.filter(':first').position().top;
|
237
|
+
|
238
|
+
base.$headings.each(function(i,el){
|
239
|
+
var $a = base.$el.find('a:eq(' + i + ')');
|
240
|
+
var pos = (
|
241
|
+
( $(this).position().top - start ) /
|
242
|
+
( base.$scope.height() - start )
|
243
|
+
) * base.$el.height();
|
244
|
+
$a.css({
|
245
|
+
position: "absolute",
|
246
|
+
top: pos
|
247
|
+
});
|
248
|
+
});
|
249
|
+
};
|
250
|
+
|
251
|
+
return base.init();
|
252
|
+
};
|
253
|
+
|
254
|
+
|
255
|
+
$.TableOfContents.defaultOptions = {
|
256
|
+
// One option is set by the container element, and not by changing
|
257
|
+
// a setting here. That is the type of TOC to output. For a nested ordered list
|
258
|
+
// make sure your wrapping element is an <ol>. For a nested bulleted list
|
259
|
+
// make sure your wrapping element is an <ul>. For a straight outputting of links
|
260
|
+
// use any other element.
|
261
|
+
|
262
|
+
// Which H tags should be the root items. h1 = 1, h2 = 2, etc.
|
263
|
+
startLevel: 1,
|
264
|
+
|
265
|
+
// How many levels of H tags should be shown, including the startLevel
|
266
|
+
// startLevel: 1, depth: 3 = h1, h2, h3
|
267
|
+
// startLevel: 2, depth: 3 = h2, h3, h4
|
268
|
+
depth: 3,
|
269
|
+
|
270
|
+
// Each link in a straight set is give a class designating how deep it is.
|
271
|
+
// You can change the class by changing this option,
|
272
|
+
// but you must include a % sign where you want the number to go.
|
273
|
+
// Nested lists do not add classes, as you can determine their depth with straight css
|
274
|
+
levelClass: "toc-depth-%",
|
275
|
+
|
276
|
+
// When each link is formed, you can supply additional html or text to be formatted
|
277
|
+
// with the text of the header. % represents the text of the header
|
278
|
+
levelText: "%",
|
279
|
+
|
280
|
+
// This plugin can add "To Top" links to each header element if you want.
|
281
|
+
// Set topLinks to true to use the text "Top" or set it to some text or html
|
282
|
+
// content you wish to use as the body of the link
|
283
|
+
topLinks: false,
|
284
|
+
|
285
|
+
// If topLinks is either true or a text/html value, you can also set the following options:
|
286
|
+
|
287
|
+
// Class of the link that is added to the headers
|
288
|
+
topLinkClass: "toc-top-link",
|
289
|
+
|
290
|
+
// Which class should be added to the body element if it does not
|
291
|
+
// already have an id associated with it
|
292
|
+
topBodyId: "toc-top",
|
293
|
+
|
294
|
+
// To have the TOC spaced proportionatly to the spacing of the headings,
|
295
|
+
// you must have a fixed height on the TOC wrapper, and it must "haveLayout"
|
296
|
+
// either position = fixed | absolute | relative
|
297
|
+
// Finally, the TOC wrapper must not be a UL or an LI or this setting will
|
298
|
+
// have no effect
|
299
|
+
proportionateSpacing: false
|
300
|
+
|
301
|
+
};
|
302
|
+
|
303
|
+
|
304
|
+
$.fn.tableOfContents = function(scope, options){
|
305
|
+
return this.each(function(){
|
306
|
+
var toc = new $.TableOfContents(this, scope, options);
|
307
|
+
delete toc; // Free memory
|
308
|
+
});
|
309
|
+
};
|
310
|
+
|
311
|
+
|
312
|
+
})(jQuery);
|
data/api/views/index.html.haml
CHANGED
@@ -1,112 +1,88 @@
|
|
1
|
-
|
2
|
-
%
|
3
|
-
|
4
|
-
|
5
|
-
%
|
6
|
-
|
7
|
-
|
1
|
+
%section#main
|
2
|
+
%p This documentation assumes that you are familar with the low-level semantics of HTTP, including the use of tools like cURL, and JSON.
|
3
|
+
|
4
|
+
%h1 Authentication
|
5
|
+
%p A Poll Everywhere username and password is used to login to the API and manipulate polls on an account. These credentials can be created at <a href="http://www.polleverywhere.com/reserve">Poll Everywhere</a>.
|
6
|
+
|
7
|
+
%p The credentials can be configured on the Poll Everywhere gem or manually via HTTP Basic authentication (More information on HTTP Basic credentials an encoding can be found at <a href="http://en.wikipedia.org/wiki/Basic_access_authentication">Wikipedia</a>).
|
8
|
+
|
9
|
+
%pre.ruby
|
10
|
+
:preserve
|
11
|
+
PollEverywhere.config do
|
12
|
+
username "my_pollev_username"
|
13
|
+
password "my_pollev_password"
|
14
|
+
end
|
15
|
+
|
16
|
+
%h1 Its all JSON
|
17
|
+
%p JSON key-value data structures are used throughout the API application to persist and modify data to the web application. Typically resources will include a root key that corresponds with the name of the name of the resource; from example, multiple choice polls all have the root key 'multiple_choice_poll'.
|
8
18
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
%h1 Authentication
|
13
|
-
%p HTTP Basic authentication is currently used for logging into Poll Everywhere accounts. More information can be found at <a href="http://en.wikipedia.org/HTTP Basic">Wikipedia</a>.
|
19
|
+
%h1 Polls
|
20
|
+
%h2 Multiple choice polls
|
21
|
+
%p These polls are great for collecting structured information from audiences if you want to define a set of answers that participants may choose from.
|
14
22
|
|
15
|
-
|
16
|
-
|
23
|
+
%h3 Attributes
|
24
|
+
%dl.attributes
|
25
|
+
%dt=PollEverywhere::MultipleChoicePoll.root_key
|
26
|
+
%dd Root key for multiple choice poll data.
|
27
|
+
%dd
|
28
|
+
%dl
|
29
|
+
-PollEverywhere::MultipleChoicePoll.props.each do |_, prop|
|
30
|
+
%dt=prop.name
|
31
|
+
%dd=prop.description
|
32
|
+
-if prop.name == :options
|
33
|
+
%dd
|
34
|
+
%dl
|
35
|
+
-PollEverywhere::MultipleChoicePoll::Option.props.each do |_, prop|
|
36
|
+
%dt=prop.name
|
37
|
+
%dd=prop.description
|
38
|
+
|
39
|
+
%h3 Creating a multiple choice poll
|
40
|
+
%p Specify a title and a few options to create a multiple choice poll.
|
41
|
+
:example
|
42
|
+
@mcp = PollEverywhere::MultipleChoicePoll.from_hash(:title => 'Hey dude!', :options => %w[red blue green]).save
|
43
|
+
|
44
|
+
%h3 Changing the title of a multiple choice poll
|
45
|
+
:example
|
46
|
+
@mcp.title = "I like different titles"
|
47
|
+
@mcp.save
|
17
48
|
|
18
|
-
|
19
|
-
|
20
|
-
|
49
|
+
%h3 Starting and stopping multiple choice polls
|
50
|
+
%p To prevent audience members from responding to a poll, change the poll state to "closed".
|
51
|
+
:example
|
52
|
+
@mcp.stop
|
53
|
+
|
54
|
+
%p To open it back up and allow responses to come on through change the state to "opened".
|
55
|
+
:example
|
56
|
+
@mcp.start
|
21
57
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
:ruby
|
39
|
-
example do
|
40
|
-
@mcp = PollEverywhere::MultipleChoicePoll.from_hash(:title => 'Hey dude!', :options => %w[red blue green]).save
|
41
|
-
end
|
42
|
-
|
43
|
-
%h3 Changing the title of a multiple choice poll
|
44
|
-
:ruby
|
45
|
-
example do
|
46
|
-
@mcp.title = "I like different titles"
|
47
|
-
@mcp.save
|
48
|
-
end
|
58
|
+
%h3 Delete a multiple choice poll
|
59
|
+
%p When you're totally finished with the poll and you want to tidy things up a bit, you can delete polls
|
60
|
+
:example
|
61
|
+
@mcp.destroy
|
62
|
+
|
63
|
+
%h2 Free text polls
|
64
|
+
%p These polls are used to collect short answers or unstructured responses from participants.
|
65
|
+
%h3 Attributes
|
66
|
+
%dl.attributes
|
67
|
+
%dt=PollEverywhere::FTP.root_key
|
68
|
+
%dd Root key for free text poll data.
|
69
|
+
%dd
|
70
|
+
%dl
|
71
|
+
-PollEverywhere::FTP.props.each do |_, prop|
|
72
|
+
%dt=prop.name
|
73
|
+
%dd=prop.description
|
49
74
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
@mcp.stop
|
55
|
-
end
|
56
|
-
|
57
|
-
%p To open it back up (and allow responses to come on through) change the state to "opened"
|
58
|
-
:ruby
|
59
|
-
example do
|
60
|
-
@mcp.start
|
61
|
-
end
|
75
|
+
%h3 Create free text polls
|
76
|
+
%p Creating a free text poll is similar to building a multiple choice poll, just without the options attribute.
|
77
|
+
:example
|
78
|
+
@ftp = PollEverywhere::FreeTextPoll.from_hash(:title => "What is the meaning of life?").save
|
62
79
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
end
|
69
|
-
|
70
|
-
%h2 Free text polls
|
71
|
-
%p These polls are used to collect short answers or unstructured responses from participants.
|
72
|
-
%h3 Attributes
|
73
|
-
%dl.attributes
|
74
|
-
%dt=PollEverywhere::FTP.root_key
|
75
|
-
%dd Root key for free text poll data.
|
76
|
-
%dd
|
77
|
-
%dl
|
78
|
-
-PollEverywhere::FTP.props.each do |_, prop|
|
79
|
-
%dt=prop.name
|
80
|
-
%dd=prop.description
|
80
|
+
%h3 Modify a free text poll
|
81
|
+
%p Change the title attribute to change the poll
|
82
|
+
:example
|
83
|
+
@ftp.title = "No really, what is the meaning of life?"
|
84
|
+
@ftp.save
|
81
85
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
example do
|
86
|
-
@ftp = PollEverywhere::FreeTextPoll.from_hash(:title => "What is the meaning of life?").save
|
87
|
-
end
|
88
|
-
|
89
|
-
%h3 Modify a free text poll
|
90
|
-
%p Change the title attribute to change the poll
|
91
|
-
:ruby
|
92
|
-
example do
|
93
|
-
@ftp.state = "opened"
|
94
|
-
@ftp.save
|
95
|
-
end
|
96
|
-
|
97
|
-
%h3 Delete a free text poll
|
98
|
-
:ruby
|
99
|
-
example do
|
100
|
-
@ftp.destroy
|
101
|
-
end
|
102
|
-
|
103
|
-
%footer
|
104
|
-
%p
|
105
|
-
This documentation was automatically generated by the Poll Everywhere rubygem at
|
106
|
-
=succeed '.' do
|
107
|
-
%a(href="http://github.com/polleverywhere/polleverywhere") http://github.com/polleverywhere/polleverywhere
|
108
|
-
Community support for the API is available on the
|
109
|
-
%a(href="http://groups.google.com/group/polleverywhere-dev") Poll Everywhere Developer mailing list
|
110
|
-
and paid professional support at
|
111
|
-
=succeed '.' do
|
112
|
-
%a(href="http://www.polleverywhere.com/professional-support") Poll Everywhere
|
86
|
+
%h3 Delete a free text poll
|
87
|
+
:example
|
88
|
+
@ftp.destroy
|
data/api/views/layout.haml
CHANGED
@@ -1,21 +1,45 @@
|
|
1
1
|
!!! 5
|
2
|
-
%html
|
2
|
+
%html(lang="en")
|
3
3
|
%head
|
4
|
-
%
|
5
|
-
|
4
|
+
%title The Poll Everywhere API
|
5
|
+
%meta(charset="utf-8")
|
6
6
|
/ Always force latest IE rendering engine (even in intranet) & Chrome Frame
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
=
|
12
|
-
|
7
|
+
/[if IE]
|
8
|
+
%meta(content="IE=edge,chrome=1" http-equiv="X-UA-Compatible")
|
9
|
+
=stylesheet_link_tag "site.css"
|
10
|
+
=javascript_include_tag 'jquery-1.6.2.min', 'jquery.tableofcontents'
|
11
|
+
=yield_content :head
|
13
12
|
:javascript
|
14
|
-
|
13
|
+
$(function(){
|
14
|
+
$('#toc').tableOfContents('#main');
|
15
|
+
});
|
16
|
+
|
17
|
+
%body(class=page_classes)
|
18
|
+
%header
|
19
|
+
%h1 The Poll Everywhere API
|
20
|
+
%aside#nav
|
21
|
+
%section
|
22
|
+
%ol.toc#toc
|
23
|
+
%article#main=yield
|
24
|
+
%footer
|
25
|
+
%h2 Additional Resources
|
26
|
+
%dl
|
27
|
+
%dt
|
28
|
+
%a(href="http://github.com/polleverywhere/polleverywhere") Source Code
|
29
|
+
%dd Review or contribute to the source code that generated this documentation.
|
30
|
+
|
31
|
+
%dt
|
32
|
+
%a(href="http://groups.google.com/group/polleverywhere-dev") Community Mailing List Support
|
33
|
+
%dd Free support from the Poll Everywhere development community.
|
15
34
|
|
16
|
-
|
17
|
-
|
18
|
-
|
35
|
+
%dt
|
36
|
+
%a(href="http://www.polleverywhere.com/professional-support") Paid Professional Support
|
37
|
+
%dd If you need more responsive support or a custom API feature, engage Poll Everywhere's professional support services.
|
19
38
|
|
20
|
-
|
21
|
-
|
39
|
+
%dt
|
40
|
+
%a(href="http://www.polleverywhere.com/") Poll Everywhere
|
41
|
+
%p
|
42
|
+
This documentation was automatically generated by the
|
43
|
+
%a(href="https://rubygems.org/gems/polleverywhere/versions/#{PollEverywhere::VERSION}")==Poll Everywhere Ruby Gem v#{PollEverywhere::VERSION}
|
44
|
+
at
|
45
|
+
==#{Time.now.utc}
|
@@ -10,7 +10,7 @@ body
|
|
10
10
|
width: 40em
|
11
11
|
margin: auto auto
|
12
12
|
|
13
|
-
|
13
|
+
pre
|
14
14
|
font-family: monaco, courier
|
15
15
|
font-size: $code-font-size
|
16
16
|
line-height: $base-font-size
|
@@ -19,10 +19,12 @@ code
|
|
19
19
|
padding: 1em
|
20
20
|
background: #eee
|
21
21
|
margin: 1em 0
|
22
|
+
overflow: hidden
|
23
|
+
&:hover
|
24
|
+
overflow: visible
|
22
25
|
|
23
26
|
h1,h2,h3,h4,h5,h6
|
24
27
|
font-weight: normal
|
25
|
-
|
26
28
|
h1
|
27
29
|
font-size: 30px
|
28
30
|
h2
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Renders various formats of code for a given piece of Ruby API code.
|
2
|
+
module Haml::Filters::Example
|
3
|
+
include Haml::Filters::Base
|
4
|
+
|
5
|
+
def render(text)
|
6
|
+
# TODO move this into a klass so that different formats are supported 'n' such
|
7
|
+
formats = {}
|
8
|
+
formats[:ruby] = text
|
9
|
+
eval(text, self.send(:binding)) # Run the ruby code so we can get at the curl formats, etc
|
10
|
+
formats[:curl] = PollEverywhere.config.http_adapter.last_requests.map(&:to_curl).join("\n\n")
|
11
|
+
formats.map{ |format, example| %(<pre class="#{format}">#{example}</pre>) }.join
|
12
|
+
end
|
13
|
+
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
module
|
2
|
-
VERSION = "0.0.
|
1
|
+
module PollEverywhere
|
2
|
+
VERSION = "0.0.5"
|
3
3
|
end
|
data/lib/polleverywhere.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module PollEverywhere
|
2
2
|
autoload :Configuration, 'polleverywhere/configuration'
|
3
3
|
autoload :HTTP, 'polleverywhere/http'
|
4
|
-
autoload :API, 'polleverywhere/api'
|
5
4
|
autoload :CoreExt, 'polleverywhere/core_ext'
|
6
5
|
autoload :Serializable, 'polleverywhere/serializable'
|
7
6
|
autoload :Configurable, 'polleverywhere/configurable'
|
data/polleverywhere.gemspec
CHANGED
@@ -4,7 +4,7 @@ require "polleverywhere/version"
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "polleverywhere"
|
7
|
-
s.version =
|
7
|
+
s.version = PollEverywhere::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Brad Gessler, Steel Fu"]
|
10
10
|
s.email = ["opensource@polleverywhere.com"]
|