clavem 1.4.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis-gemfile +2 -1
- data/.travis.yml +1 -2
- data/Gemfile +3 -2
- data/README.md +13 -6
- data/Rakefile +1 -1
- data/bin/clavem +29 -18
- data/clavem.gemspec +5 -4
- data/doc/Clavem.html +6 -6
- data/doc/Clavem/Authorizer.html +1141 -2216
- data/doc/Clavem/Exceptions.html +4 -4
- data/doc/Clavem/Exceptions/Failure.html +5 -5
- data/doc/Clavem/Server.html +370 -0
- data/doc/Clavem/Version.html +5 -5
- data/doc/_index.html +8 -15
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +21 -14
- data/doc/frames.html +1 -1
- data/doc/index.html +21 -14
- data/doc/method_list.html +32 -14
- data/doc/top-level-namespace.html +3 -3
- data/lib/clavem.rb +4 -3
- data/lib/clavem/authorizer.rb +75 -121
- data/lib/clavem/server.rb +52 -0
- data/lib/clavem/version.rb +3 -3
- data/locales/en.yml +15 -6
- data/locales/it.yml +15 -6
- data/spec/clavem/authorizer_spec.rb +86 -244
- data/spec/clavem/server_spec.rb +40 -0
- data/spec/coverage_helper.rb +2 -2
- data/spec/spec_helper.rb +2 -1
- data/test_server.rb +28 -10
- metadata +32 -27
- data/doc/Clavem/Exceptions/AuthorizationDenied.html +0 -133
- data/doc/Clavem/Exceptions/Timeout.html +0 -133
- data/doc/index.html.save +0 -133
- data/lib/clavem/template.html.erb +0 -25
data/doc/index.html.save
DELETED
@@ -1,133 +0,0 @@
|
|
1
|
-
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
3
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
-
<head>
|
6
|
-
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII" />
|
7
|
-
<title>
|
8
|
-
File: README
|
9
|
-
|
10
|
-
— Documentation by YARD 0.8.3
|
11
|
-
|
12
|
-
</title>
|
13
|
-
|
14
|
-
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
15
|
-
|
16
|
-
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
17
|
-
|
18
|
-
<script type="text/javascript" charset="utf-8">
|
19
|
-
hasFrames = window.top.frames.main ? true : false;
|
20
|
-
relpath = '';
|
21
|
-
framesUrl = "frames.html#!" + escape(window.location.href);
|
22
|
-
</script>
|
23
|
-
|
24
|
-
|
25
|
-
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
26
|
-
|
27
|
-
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
28
|
-
|
29
|
-
|
30
|
-
</head>
|
31
|
-
<body>
|
32
|
-
<div id="header">
|
33
|
-
<div id="menu">
|
34
|
-
|
35
|
-
<a href="_index.html">Index</a> »
|
36
|
-
<span class="title">File: README</span>
|
37
|
-
|
38
|
-
|
39
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
40
|
-
</div>
|
41
|
-
|
42
|
-
<div id="search">
|
43
|
-
|
44
|
-
<a class="full_list_link" id="class_list_link"
|
45
|
-
href="class_list.html">
|
46
|
-
Class List
|
47
|
-
</a>
|
48
|
-
|
49
|
-
<a class="full_list_link" id="method_list_link"
|
50
|
-
href="method_list.html">
|
51
|
-
Method List
|
52
|
-
</a>
|
53
|
-
|
54
|
-
<a class="full_list_link" id="file_list_link"
|
55
|
-
href="file_list.html">
|
56
|
-
File List
|
57
|
-
</a>
|
58
|
-
|
59
|
-
</div>
|
60
|
-
<div class="clear"></div>
|
61
|
-
</div>
|
62
|
-
|
63
|
-
<iframe id="search_frame"></iframe>
|
64
|
-
|
65
|
-
<div id="content"><div id='filecontents'><h1>Introduction</h1>
|
66
|
-
|
67
|
-
<p><a href="https://travis-ci.org/ShogunPanda/clavem"><img src="https://secure.travis-ci.org/ShogunPanda/clavem.png?branch=master" alt="Build Status"></a>
|
68
|
-
<a href="https://gemnasium.com/ShogunPanda/clavem"><img src="https://gemnasium.com/ShogunPanda/clavem.png?travis" alt="Dependency Status"></a>
|
69
|
-
<a href="https://codeclimate.com/github/ShogunPanda/clavem"><img src="https://codeclimate.com/badge.png" alt="Code Climate"></a></p>
|
70
|
-
|
71
|
-
<p>A local callback server for oAuth web-flow.</p>
|
72
|
-
|
73
|
-
<p><a href="http://sw.cow.tc/clavem">http://sw.cow.tc/clavem</a></p>
|
74
|
-
|
75
|
-
<p><a href="http://rdoc.info/gems/clavem">http://rdoc.info/gems/clavem</a></p>
|
76
|
-
|
77
|
-
<h2>Usage</h2>
|
78
|
-
|
79
|
-
<p>clavem allows you to handle a full oAuth authentication flow directly from the console.</p>
|
80
|
-
|
81
|
-
<p>Simply instantiate the authorizer and run the authorize method with the URL:</p>
|
82
|
-
|
83
|
-
<pre class="code ruby"><code><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>clavem</span><span class='tstring_end'>"</span></span>
|
84
|
-
|
85
|
-
<span class='comment'># Initalize your oAuth access.
|
86
|
-
</span>
|
87
|
-
<span class='id identifier rubyid_authorizer'>authorizer</span> <span class='op'>=</span> <span class='const'>Clavem</span><span class='op'>::</span><span class='const'>Authorizer</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
88
|
-
|
89
|
-
<span class='comment'># Get your authorization URL and append the callback.
|
90
|
-
</span>
|
91
|
-
<span class='id identifier rubyid_url'>url</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>?oauth_callback=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_authorizer'>authorizer</span><span class='period'>.</span><span class='id identifier rubyid_callback_url'>callback_url</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
92
|
-
<span class='id identifier rubyid_authorizer'>authorizer</span><span class='period'>.</span><span class='id identifier rubyid_authorize'>authorize</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='rparen'>)</span>
|
93
|
-
|
94
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_authorizer'>authorizer</span><span class='period'>.</span><span class='id identifier rubyid_status'>status</span> <span class='op'>==</span> <span class='symbol'>:succeded</span> <span class='kw'>then</span>
|
95
|
-
<span class='id identifier rubyid_access_token'>access_token</span> <span class='op'>=</span> <span class='id identifier rubyid_authorizer'>authorizer</span><span class='period'>.</span><span class='id identifier rubyid_token'>token</span>
|
96
|
-
|
97
|
-
<span class='comment'># Go on!
|
98
|
-
</span><span class='kw'>else</span>
|
99
|
-
<span class='comment'># Authorization denied
|
100
|
-
</span><span class='kw'>end</span>
|
101
|
-
</code></pre>
|
102
|
-
|
103
|
-
<p>Alternatively, you can also specify a timeout and a block to the constructor to customizer the response handling.</p>
|
104
|
-
|
105
|
-
<p>See the <a href="http://rdoc.info/gems/clavem">documentation</a> for more information.</p>
|
106
|
-
|
107
|
-
<h2>Contributing to clavem</h2>
|
108
|
-
|
109
|
-
<ul>
|
110
|
-
<li>Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.</li>
|
111
|
-
<li>Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.</li>
|
112
|
-
<li>Fork the project.</li>
|
113
|
-
<li>Start a feature/bugfix branch.</li>
|
114
|
-
<li>Commit and push until you are happy with your contribution.</li>
|
115
|
-
<li>Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.</li>
|
116
|
-
<li>Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.</li>
|
117
|
-
</ul>
|
118
|
-
|
119
|
-
<h2>Copyright</h2>
|
120
|
-
|
121
|
-
<p>Copyright (C) 2013 and above Shogun (<a href="mailto:shogun_panda@me.com">shogun_panda@me.com</a>).</p>
|
122
|
-
|
123
|
-
<p>Licensed under the MIT license, which can be found at <a href="http://www.opensource.org/licenses/mit-license.php">http://www.opensource.org/licenses/mit-license.php</a>.</p>
|
124
|
-
</div></div>
|
125
|
-
|
126
|
-
<div id="footer">
|
127
|
-
Generated on Sun Jan 27 14:14:59 2013 by
|
128
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
129
|
-
0.8.3 (ruby-1.9.3).
|
130
|
-
</div>
|
131
|
-
|
132
|
-
</body>
|
133
|
-
</html>
|
@@ -1,25 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<%
|
3
|
-
# encoding: utf-8
|
4
|
-
#
|
5
|
-
# This file is part of the clavem gem. Copyright (C) 2013 and above Shogun <shogun_panda@me.com>.
|
6
|
-
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
|
7
|
-
#
|
8
|
-
%>
|
9
|
-
<html>
|
10
|
-
<head>
|
11
|
-
<title><%= @title %></title>
|
12
|
-
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap.no-icons.min.css"/>
|
13
|
-
<script type="text/javascript"> close_window = (function(){ window.open("", "_self", ""); window.close(); })(); </script>
|
14
|
-
</head>
|
15
|
-
<body>
|
16
|
-
<div class="container">
|
17
|
-
<br/>
|
18
|
-
<div class="alert alert-<%= @status == :success ? "success" : "error" %>">
|
19
|
-
<h4><%= @title %></h4>
|
20
|
-
<h1><%= @i18n.template.send(@status == :success ? :header_success : :header_failure) %></h1>
|
21
|
-
<p><%= @i18n.template.close_message %></p>
|
22
|
-
</div>
|
23
|
-
</div>
|
24
|
-
</body>
|
25
|
-
</html>
|