cloudapp 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -0
- data/bin/cloudapp +34 -1
- data/cloudapp.gemspec +1 -1
- data/lib/cloudapp.rb +1 -1
- metadata +9 -9
data/README.md
CHANGED
@@ -5,6 +5,8 @@ Experience all the pleasures of sharing with CloudApp now in your terminal.
|
|
5
5
|
|
6
6
|
## Desired Usage
|
7
7
|
|
8
|
+
**These commands don't exist yet. They're just here as a wish list of sorts.**
|
9
|
+
|
8
10
|
The goal of `cloudapp` is to be Unix-friendly and handle the following uses:
|
9
11
|
|
10
12
|
- Bookmark a link: `cloudapp bookmark http://getcloudapp.com`
|
data/bin/cloudapp
CHANGED
@@ -23,7 +23,40 @@ Main do
|
|
23
23
|
headers: { 'Accept' => 'application/json',
|
24
24
|
'Content-Type' => 'application/json' }
|
25
25
|
|
26
|
-
json = Yajl::Parser.new(:
|
26
|
+
json = Yajl::Parser.new(symbolize_keys: true).parse(response.body)
|
27
|
+
puts json.fetch :url
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Share a file: `cloudapp file screenshot.png`
|
32
|
+
mode :file do
|
33
|
+
argument('file') { cast :pathname }
|
34
|
+
|
35
|
+
def run
|
36
|
+
api_params = { username: config[:email],
|
37
|
+
password: config[:password],
|
38
|
+
auth_method: :digest,
|
39
|
+
headers: { 'Accept' => 'application/json',
|
40
|
+
'Content-Type' => 'application/json' }}
|
41
|
+
|
42
|
+
details_response = Typhoeus::Request.get 'http://my.cl.ly/items/new',
|
43
|
+
api_params.merge(verbose: ENV.fetch('DEBUG', false))
|
44
|
+
|
45
|
+
details = Yajl::Parser.new(symbolize_keys: true).
|
46
|
+
parse(details_response.body)
|
47
|
+
|
48
|
+
url = details[:url]
|
49
|
+
upload_params = details[:params].merge file: File.open(params[:file].value)
|
50
|
+
upload_response = Typhoeus::Request.post url,
|
51
|
+
verbose: ENV.fetch('DEBUG', false),
|
52
|
+
params: upload_params
|
53
|
+
|
54
|
+
follow_url = upload_response.headers_hash['Location']
|
55
|
+
|
56
|
+
create_response = Typhoeus::Request.get follow_url,
|
57
|
+
api_params.merge(verbose: ENV.fetch('DEBUG', false))
|
58
|
+
|
59
|
+
json = Yajl::Parser.new(symbolize_keys: true).parse(create_response.body)
|
27
60
|
puts json.fetch :url
|
28
61
|
end
|
29
62
|
end
|
data/cloudapp.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'cloudapp'
|
16
|
-
s.version = '0.0.
|
16
|
+
s.version = '0.0.3'
|
17
17
|
s.date = '2012-01-31'
|
18
18
|
s.rubyforge_project = 'cloudapp'
|
19
19
|
|
data/lib/cloudapp.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-01-31 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: main
|
16
|
-
requirement: &
|
16
|
+
requirement: &70172271130860 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70172271130860
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: typhoeus
|
27
|
-
requirement: &
|
27
|
+
requirement: &70172271130300 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70172271130300
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: yajl-ruby
|
38
|
-
requirement: &
|
38
|
+
requirement: &70172271129480 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70172271129480
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
|
-
requirement: &
|
49
|
+
requirement: &70172271128780 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70172271128780
|
58
58
|
description: Experience all the pleasures of sharing with CloudApp now in your terminal.
|
59
59
|
email: larry@marburger.cc
|
60
60
|
executables:
|