shroud 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ pkg/
2
+ test/
3
+ .yardoc/
@@ -0,0 +1 @@
1
+ v0.0. Initial release
@@ -0,0 +1,7 @@
1
+ CHANGELOG
2
+ README.markdown
3
+ Rakefile
4
+ bin/shroud
5
+ lib/shroud.rb
6
+ test/test.rb
7
+ Manifest
@@ -0,0 +1,48 @@
1
+ # Shroud
2
+
3
+ A ruby wrapper for [Cloud.app's](http://getcloudapp.com/) [REST API](http://support.getcloudapp.com/faqs/developers/api).
4
+
5
+ __NB__: If you try to upload an item and wonder why it doesn't work, it's because it doesn't work *yet*. I am working on it.
6
+
7
+
8
+
9
+ ## Example
10
+
11
+ require 'shroud'
12
+
13
+ Shroud.get_item('a') #=> returns a hash of info on http://cl.ly/a
14
+
15
+ # For every other thing you need to log in
16
+
17
+ c = Shroud::Session.new('my_email', 'my_password')
18
+
19
+ c.list_items(:type => 'image') #=> return a list of my recent images
20
+
21
+ b = c.create_bookmark('http://getcloudapp.com/', 'CloudApp') #=> Shorten url
22
+
23
+ c.delete_item(b['slug']) #=> Delete the bookmark you just created
24
+
25
+ # not working atm
26
+ c.upload_file('list.txt') #=> uploads 'list.txt'
27
+
28
+
29
+
30
+ ## Command Line
31
+
32
+ You can use the `shroud` executable to interact with the REST API from the command line. Type `shroud -h` to see the list of commands. To add your login details you need to edit your `~/.bashrc` and add:
33
+
34
+ export SHROUD_USER="yourusername"
35
+ export SHROUD_PASS="yourpassword"
36
+
37
+
38
+ ## License
39
+
40
+ __MIT LICENSE__
41
+
42
+ Copyright (c) 2010 Joshua Hawxwell
43
+
44
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
45
+
46
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
47
+
48
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,26 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gemspec|
7
+ gemspec.name = "shroud"
8
+ gemspec.summary = %Q{Ruby wrapper for the CloudApp REST API}
9
+ gemspec.description = %Q{A wrapper for the CloudApp REST API, including a command line executable}
10
+ gemspec.email = "m@hawx.me"
11
+ gemspec.homepage = "http://github.com/hawx/shroud"
12
+ gemspec.authors = ["Joshua Hawxwell"]
13
+ end
14
+ Jeweler::GemcutterTasks.new
15
+ rescue LoadError
16
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
17
+ end
18
+
19
+ begin
20
+ require 'yard'
21
+ YARD::Rake::YardocTask.new
22
+ rescue LoadError
23
+ task :yardoc do
24
+ abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
25
+ end
26
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.1
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.dirname(__FILE__) + '/../lib/shroud'
4
+ require 'optparse'
5
+ require 'pp'
6
+
7
+ @user = ENV['SHROUD_USER'] || ENV['SHROUD_USERNAME'] || ENV['SHROUD_EMAIL']
8
+ @pass = ENV['SHROUD_PASS'] || ENV['SHROUD_PASSWORD']
9
+
10
+ opts = OptionParser.new do |opts|
11
+ opts.on("--shorten url", "-s url", "Shorten URL") do |url|
12
+ puts Shroud::Session.new(@user, @pass).create_bookmark(url)
13
+ end
14
+
15
+ opts.on("--upload path", "-u path", "Upload Item") do |file|
16
+ puts Shroud::Session.new(@user, @pass).upload_file(file)
17
+ end
18
+
19
+ opts.on("--delete item", "-d item", "Delete Item") do |item|
20
+ if Shroud::Session.new(@user, @pass).delete_item(item)
21
+ "#{item} was deleted"
22
+ end
23
+ end
24
+
25
+ opts.on("--list [page]", "-l [page]", "List Items") do |page|
26
+ page ||= 1
27
+ puts Shroud::Session.new(@user, @pass).list_items(:page => page).to_yaml
28
+ end
29
+
30
+ opts.on("--view item", "-v item", "View item") do |item|
31
+ # that is a bit of a cheat, but it works
32
+ puts Shroud.get_item(item).to_yaml
33
+ end
34
+
35
+ opts.on("--version", "Display current version") do
36
+ puts Shroud.Version
37
+ end
38
+ end
39
+
40
+ opts.parse!
@@ -0,0 +1,204 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta name="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>Module: Shroud</title>
7
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
8
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
9
+
10
+ <script type="text/javascript" charset="utf-8">
11
+ relpath = '';
12
+ if (relpath != '') relpath += '/';
13
+ </script>
14
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
15
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
16
+
17
+ </head>
18
+ <body>
19
+ <script type="text/javascript" charset="utf-8">
20
+ if (window.top.frames.main) document.body.className = 'frames';
21
+ </script>
22
+
23
+ <div id="header">
24
+ <div id="menu">
25
+
26
+ <a href="_index.html">Index (S)</a> &raquo;
27
+
28
+
29
+ <span class="title">Shroud</span>
30
+
31
+
32
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
33
+ </div>
34
+
35
+ <div id="search">
36
+ <a id="class_list_link" href="#">Class List</a>
37
+ <a id="method_list_link" href="#">Method List</a>
38
+ <a id ="file_list_link" href="#">File List</a>
39
+ </div>
40
+
41
+ <div class="clear"></div>
42
+ </div>
43
+
44
+ <iframe id="search_frame"></iframe>
45
+
46
+ <div id="content"><h1>Module: Shroud
47
+
48
+
49
+ </h1>
50
+
51
+ <dl class="box">
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+ <dt class="r1 last">Defined in:</dt>
61
+ <dd class="r1 last">lib/shroud.rb</dd>
62
+
63
+ </dl>
64
+ <div class="clear"></div>
65
+
66
+ <h2>Overview</h2><div class="docstring">
67
+ <div class="discussion">
68
+
69
+
70
+ </div>
71
+ </div>
72
+ <div class="tags">
73
+ <h3>Author:</h3>
74
+ <ul class="author">
75
+
76
+ <li>
77
+
78
+
79
+
80
+
81
+
82
+ <div class='inline'><p>
83
+ Joshua Hawxwell
84
+ </p>
85
+ </div>
86
+
87
+ </li>
88
+
89
+ </ul>
90
+
91
+ </div><h2>Defined Under Namespace</h2>
92
+ <p class="children">
93
+
94
+
95
+
96
+
97
+ <strong class="classes">Classes:</strong> <a href="Shroud/AuthorizationError.html" title="Shroud::AuthorizationError (class)">AuthorizationError</a>, <a href="Shroud/FileNotFound.html" title="Shroud::FileNotFound (class)">FileNotFound</a>, <a href="Shroud/ItemNotFound.html" title="Shroud::ItemNotFound (class)">ItemNotFound</a>, <a href="Shroud/Session.html" title="Shroud::Session (class)">Session</a>
98
+
99
+
100
+ </p>
101
+
102
+ <h2>Constant Summary</h2>
103
+
104
+ <dl class="constants">
105
+
106
+ <dt id="Version-constant" class="">Version =
107
+
108
+ </dt>
109
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.1</span><span class='tstring_end'>'</span></span></pre></dd>
110
+
111
+ </dl>
112
+
113
+
114
+
115
+
116
+
117
+ <h2>Class Method Summary</h2>
118
+
119
+ <ul class="summary">
120
+
121
+ <li class="public ">
122
+ <span class="summary_signature">
123
+
124
+ <a href="#get_item-class_method" title="get_item (class method)">+ (Object) <strong>get_item</strong>(item) </a>
125
+
126
+
127
+
128
+ </span>
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+ <span class="summary_desc"><div class='inline'></div></span>
137
+
138
+ </li>
139
+
140
+
141
+ </ul>
142
+
143
+
144
+
145
+
146
+ <div id="class_method_details" class="method_details_list">
147
+ <h2>Class Method Details</h2>
148
+
149
+
150
+ <div class="method_details first">
151
+ <p class="signature first" id="get_item-class_method">
152
+
153
+ + (<tt>Object</tt>) <strong>get_item</strong>(item)
154
+
155
+
156
+
157
+ </p><div class="docstring">
158
+ <div class="discussion">
159
+
160
+
161
+ </div>
162
+ </div>
163
+ <div class="tags">
164
+
165
+ <h3>See Also:</h3>
166
+ <ul class="see">
167
+
168
+ <li><a href="Shroud/Session.html#get_item-instance_method" title="Shroud::Session#get_item (method)">Session#get_item</a></li>
169
+
170
+ </ul>
171
+
172
+ </div><table class="source_code">
173
+ <tr>
174
+ <td>
175
+ <pre class="lines">
176
+
177
+
178
+ 16
179
+ 17
180
+ 18</pre>
181
+ </td>
182
+ <td>
183
+ <pre class="code"><span class="info file"># File 'lib/shroud.rb', line 16</span>
184
+
185
+ <span class='kw'>def</span> <span class='const'>Shroud</span><span class='period'>.</span><span class='id get_item'>get_item</span><span class='lparen'>(</span><span class='id item'>item</span><span class='rparen'>)</span>
186
+ <span class='const'>Session</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>d</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>d</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id get_item'>get_item</span><span class='lparen'>(</span><span class='id item'>item</span><span class='rparen'>)</span>
187
+ <span class='kw'>end</span></pre>
188
+ </td>
189
+ </tr>
190
+ </table>
191
+ </div>
192
+
193
+ </div>
194
+
195
+ </div>
196
+
197
+ <div id="footer">
198
+ Generated on Thu May 13 18:53:17 2010 by
199
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
200
+ 0.5.4 (ruby-1.9.1).
201
+ </div>
202
+
203
+ </body>
204
+ </html>
@@ -0,0 +1,99 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta name="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>Exception: Shroud::AuthorizationError</title>
7
+ <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
8
+ <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
9
+
10
+ <script type="text/javascript" charset="utf-8">
11
+ relpath = '..';
12
+ if (relpath != '') relpath += '/';
13
+ </script>
14
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
15
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
16
+
17
+ </head>
18
+ <body>
19
+ <script type="text/javascript" charset="utf-8">
20
+ if (window.top.frames.main) document.body.className = 'frames';
21
+ </script>
22
+
23
+ <div id="header">
24
+ <div id="menu">
25
+
26
+ <a href="../_index.html">Index (A)</a> &raquo;
27
+ <span class='title'><a href="../Shroud.html" title="Shroud (module)">Shroud</a></span>
28
+ &raquo;
29
+ <span class="title">AuthorizationError</span>
30
+
31
+
32
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
33
+ </div>
34
+
35
+ <div id="search">
36
+ <a id="class_list_link" href="#">Class List</a>
37
+ <a id="method_list_link" href="#">Method List</a>
38
+ <a id ="file_list_link" href="#">File List</a>
39
+ </div>
40
+
41
+ <div class="clear"></div>
42
+ </div>
43
+
44
+ <iframe id="search_frame"></iframe>
45
+
46
+ <div id="content"><h1>Exception: Shroud::AuthorizationError
47
+
48
+
49
+ </h1>
50
+
51
+ <dl class="box">
52
+
53
+ <dt class="r1">Inherits:</dt>
54
+ <dd class="r1">
55
+ <span class="inheritName">StandardError</span>
56
+
57
+ <ul class="fullTree">
58
+ <li>Object</li>
59
+
60
+ <li class="next">StandardError</li>
61
+
62
+ <li class="next">Shroud::AuthorizationError</li>
63
+
64
+ </ul>
65
+ <a href="#" class="inheritanceTree">show all</a>
66
+
67
+ </dd>
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+ <dt class="r2 last">Defined in:</dt>
78
+ <dd class="r2 last">lib/shroud.rb</dd>
79
+
80
+ </dl>
81
+ <div class="clear"></div>
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+ </div>
91
+
92
+ <div id="footer">
93
+ Generated on Thu May 13 18:53:17 2010 by
94
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
95
+ 0.5.4 (ruby-1.9.1).
96
+ </div>
97
+
98
+ </body>
99
+ </html>
@@ -0,0 +1,99 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta name="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>Exception: Shroud::FileNotFound</title>
7
+ <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
8
+ <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
9
+
10
+ <script type="text/javascript" charset="utf-8">
11
+ relpath = '..';
12
+ if (relpath != '') relpath += '/';
13
+ </script>
14
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
15
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
16
+
17
+ </head>
18
+ <body>
19
+ <script type="text/javascript" charset="utf-8">
20
+ if (window.top.frames.main) document.body.className = 'frames';
21
+ </script>
22
+
23
+ <div id="header">
24
+ <div id="menu">
25
+
26
+ <a href="../_index.html">Index (F)</a> &raquo;
27
+ <span class='title'><a href="../Shroud.html" title="Shroud (module)">Shroud</a></span>
28
+ &raquo;
29
+ <span class="title">FileNotFound</span>
30
+
31
+
32
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
33
+ </div>
34
+
35
+ <div id="search">
36
+ <a id="class_list_link" href="#">Class List</a>
37
+ <a id="method_list_link" href="#">Method List</a>
38
+ <a id ="file_list_link" href="#">File List</a>
39
+ </div>
40
+
41
+ <div class="clear"></div>
42
+ </div>
43
+
44
+ <iframe id="search_frame"></iframe>
45
+
46
+ <div id="content"><h1>Exception: Shroud::FileNotFound
47
+
48
+
49
+ </h1>
50
+
51
+ <dl class="box">
52
+
53
+ <dt class="r1">Inherits:</dt>
54
+ <dd class="r1">
55
+ <span class="inheritName">StandardError</span>
56
+
57
+ <ul class="fullTree">
58
+ <li>Object</li>
59
+
60
+ <li class="next">StandardError</li>
61
+
62
+ <li class="next">Shroud::FileNotFound</li>
63
+
64
+ </ul>
65
+ <a href="#" class="inheritanceTree">show all</a>
66
+
67
+ </dd>
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+ <dt class="r2 last">Defined in:</dt>
78
+ <dd class="r2 last">lib/shroud.rb</dd>
79
+
80
+ </dl>
81
+ <div class="clear"></div>
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+ </div>
91
+
92
+ <div id="footer">
93
+ Generated on Thu May 13 18:53:17 2010 by
94
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
95
+ 0.5.4 (ruby-1.9.1).
96
+ </div>
97
+
98
+ </body>
99
+ </html>