rubiojr-iorb 0.2.20090420182616
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +11 -0
- data/README.txt +52 -0
- data/Rakefile +17 -0
- data/bin/iorb +208 -0
- data/dropio-ruby-api-examples/basic_client.rb +60 -0
- data/dropio-ruby-api-examples/find_drop.rb +31 -0
- data/dropio-ruby-api-examples/find_my_drop.rb +41 -0
- data/iorb.gemspec +37 -0
- data/lib/iorb.rb +110 -0
- data/scripts/newrelease +7 -0
- metadata +85 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
= iorb
|
2
|
+
|
3
|
+
* http://github.com/rubiojr/iorb
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
http://drop.io CLI interface
|
8
|
+
|
9
|
+
== FEATURES/PROBLEMS:
|
10
|
+
|
11
|
+
* Many things not yet implemented
|
12
|
+
|
13
|
+
== SYNOPSIS:
|
14
|
+
|
15
|
+
iorb --drop-name foodrop --create file1 [file2] [file3]...
|
16
|
+
|
17
|
+
iorb -h prints help
|
18
|
+
|
19
|
+
== REQUIREMENTS:
|
20
|
+
|
21
|
+
* dropio ruby library from Jake Good:
|
22
|
+
http://github.com/whoisjake/dropio_api_ruby/tree/master
|
23
|
+
|
24
|
+
== INSTALL:
|
25
|
+
|
26
|
+
1. gem source -a http://gems.github.com
|
27
|
+
2. gem install rubiojr-iorb
|
28
|
+
|
29
|
+
== LICENSE:
|
30
|
+
|
31
|
+
(The MIT License)
|
32
|
+
|
33
|
+
Copyright (c) 2009 Sergio Rubio <sergio@rubio.name>
|
34
|
+
|
35
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
36
|
+
a copy of this software and associated documentation files (the
|
37
|
+
'Software'), to deal in the Software without restriction, including
|
38
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
39
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
40
|
+
permit persons to whom the Software is furnished to do so, subject to
|
41
|
+
the following conditions:
|
42
|
+
|
43
|
+
The above copyright notice and this permission notice shall be
|
44
|
+
included in all copies or substantial portions of the Software.
|
45
|
+
|
46
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
47
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
48
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
49
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
50
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
51
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
52
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rake'
|
2
|
+
$:.unshift(File.dirname(__FILE__) + "/lib")
|
3
|
+
require 'hoe'
|
4
|
+
require 'iorb'
|
5
|
+
|
6
|
+
Hoe.new('iorb', IORB::VERSION) do |p|
|
7
|
+
p.name = "iorb"
|
8
|
+
p.author = "Sergio Rubio"
|
9
|
+
p.description = %q{drop.io CLI interface}
|
10
|
+
p.email = 'sergio@rubio.name'
|
11
|
+
p.summary = "drop.io CLI interface"
|
12
|
+
p.url = "http://github.com/rubiojr/iorb"
|
13
|
+
p.remote_rdoc_dir = '' # Release to root
|
14
|
+
p.extra_deps << [ "dropio",">= 0.9" ]
|
15
|
+
p.extra_deps << [ "highline",">= 1.0" ]
|
16
|
+
p.developer('Sergio Rubio', 'sergio@rubio.name')
|
17
|
+
end
|
data/bin/iorb
ADDED
@@ -0,0 +1,208 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# API Docs http://groups.google.com/group/dropio-api/web/full-api-documentation
|
3
|
+
require 'rubygems'
|
4
|
+
require 'dropio'
|
5
|
+
require 'choice'
|
6
|
+
begin
|
7
|
+
require "#{File.join(File.dirname(__FILE__), '../lib/iorb.rb')}"
|
8
|
+
rescue LoadError
|
9
|
+
require 'iorb'
|
10
|
+
end
|
11
|
+
include Dropio
|
12
|
+
|
13
|
+
IORB::Config.check
|
14
|
+
|
15
|
+
Choice.options do
|
16
|
+
header ''
|
17
|
+
header 'Available options:'
|
18
|
+
|
19
|
+
option :version do
|
20
|
+
long '--version'
|
21
|
+
short '-v'
|
22
|
+
desc 'Show iorb version'
|
23
|
+
action do
|
24
|
+
puts "iorb version #{IORB::VERSION}"
|
25
|
+
exit
|
26
|
+
end
|
27
|
+
end
|
28
|
+
option :no_save do
|
29
|
+
long '--no-save'
|
30
|
+
end
|
31
|
+
|
32
|
+
option :find_drop do
|
33
|
+
short '-f'
|
34
|
+
long '--find=NAME'
|
35
|
+
desc 'Find a drop matching NAME'
|
36
|
+
end
|
37
|
+
|
38
|
+
option :list do
|
39
|
+
short '-l'
|
40
|
+
long '--list=NAME'
|
41
|
+
desc 'List assets in drop NAME'
|
42
|
+
end
|
43
|
+
|
44
|
+
option :create do
|
45
|
+
short '-c'
|
46
|
+
long '--create=[NAME]'
|
47
|
+
desc 'Create a drop'
|
48
|
+
end
|
49
|
+
|
50
|
+
option :expiration_length do
|
51
|
+
short '-e'
|
52
|
+
long '--expiration-length LENGTH'
|
53
|
+
desc 'Drop expiration length. (1 week by default)'
|
54
|
+
default '1_WEEK_FROM_NOW'
|
55
|
+
end
|
56
|
+
|
57
|
+
option :mydrops do
|
58
|
+
long '--mydrops'
|
59
|
+
desc 'Print the drops I have created'
|
60
|
+
end
|
61
|
+
|
62
|
+
option :save_details do
|
63
|
+
long '--save-details'
|
64
|
+
short '-s'
|
65
|
+
desc 'Save drop details (Needed to admin the drop later)'
|
66
|
+
end
|
67
|
+
|
68
|
+
option :destroy do
|
69
|
+
long '--destroy NAME'
|
70
|
+
short '-d'
|
71
|
+
desc 'Destroy a drop (needs to be defined in the config file)'
|
72
|
+
end
|
73
|
+
|
74
|
+
option :drop_name do
|
75
|
+
long '--drop-name NAME'
|
76
|
+
desc 'Drop name'
|
77
|
+
end
|
78
|
+
|
79
|
+
option :add_files do
|
80
|
+
long '--add-files *FILES'
|
81
|
+
desc 'Add files to a drop (if --drop-name not specified, it will create a new drop)'
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
if IORB::Config.api_key.nil?
|
87
|
+
$stderr.puts "Invalid API key in #{API_KEY_FILE}"
|
88
|
+
exit
|
89
|
+
end
|
90
|
+
|
91
|
+
Dropio.api_key = IORB::Config.api_key
|
92
|
+
|
93
|
+
if Choice.choices.create
|
94
|
+
name = Choice.choices.create
|
95
|
+
options = {
|
96
|
+
:expiration_length => Choice.choices.expiration_length,
|
97
|
+
:guests_can_add => false,
|
98
|
+
:guests_can_comment => false
|
99
|
+
}
|
100
|
+
if name.is_a? String
|
101
|
+
options.merge!({ :name => name.strip.chomp })
|
102
|
+
end
|
103
|
+
drop = Drop.create(options)
|
104
|
+
|
105
|
+
puts "\nDrop created.\n\n"
|
106
|
+
|
107
|
+
details = IORB::DropDetails.build_from(drop)
|
108
|
+
details.print
|
109
|
+
details.save if not Choice.choices.no_save
|
110
|
+
|
111
|
+
if PLATFORM =~ /.*darwin*/
|
112
|
+
IORB::Util::MacClipboard.write "http://drop.io/#{drop.name}"
|
113
|
+
puts "\nPublic URL copied to the clipboard."
|
114
|
+
end
|
115
|
+
elsif Choice.choices.destroy
|
116
|
+
begin
|
117
|
+
drop_name = Choice.choices.destroy
|
118
|
+
drop_details = IORB::DropManager.find(drop_name)
|
119
|
+
if drop_details.nil? or drop_details['admin-token'].nil?
|
120
|
+
$stderr.puts "Drop details or admin-token not found in #{IORB::Config.file}"
|
121
|
+
exit 1
|
122
|
+
end
|
123
|
+
token = nil
|
124
|
+
token = drop_details['admin-token']
|
125
|
+
drop = Drop.find(drop_name, token)
|
126
|
+
drop.destroy
|
127
|
+
drop_details['destroyed'] = true
|
128
|
+
drop_details.save
|
129
|
+
rescue Dropio::MissingResourceError
|
130
|
+
$stderr.puts "Drop '#{Choice.choices.destroy}' does not exist"
|
131
|
+
rescue Dropio::AuthorizationError
|
132
|
+
$stderr.puts "Authorization error. This drop is private or the admin token is invalid."
|
133
|
+
end
|
134
|
+
|
135
|
+
elsif Choice.choices.find_drop
|
136
|
+
begin
|
137
|
+
drop_name = Choice.choices.find_drop
|
138
|
+
drop_details = IORB::DropManager.find(drop_name)
|
139
|
+
token = nil
|
140
|
+
token = drop_details['admin-token'] if drop_details
|
141
|
+
drop = Drop.find(drop_name, token)
|
142
|
+
new_details = IORB::DropDetails.build_from(drop)
|
143
|
+
new_details.print
|
144
|
+
if Choice.choices.save_details
|
145
|
+
puts "\nSaving drop details."
|
146
|
+
new_details.save
|
147
|
+
end
|
148
|
+
rescue Dropio::MissingResourceError
|
149
|
+
$stderr.puts "Drop '#{Choice.choices.find_drop}' does not exist"
|
150
|
+
rescue Dropio::AuthorizationError
|
151
|
+
$stderr.puts "Authorization error. This drop is private or the admin token is invalid."
|
152
|
+
end
|
153
|
+
elsif Choice.choices.add_files
|
154
|
+
drop_name = Choice.choices.drop_name
|
155
|
+
if drop_name
|
156
|
+
drop_details = IORB::DropManager.find(drop_name)
|
157
|
+
if drop_details.nil?
|
158
|
+
$stderr.puts "Drop #{drop_name} not found in config."
|
159
|
+
exit 1
|
160
|
+
end
|
161
|
+
else
|
162
|
+
options = {
|
163
|
+
:expiration_length => Choice.choices.expiration_length,
|
164
|
+
:guests_can_add => false,
|
165
|
+
:guests_can_comment => false
|
166
|
+
}
|
167
|
+
drop = Drop.create(options)
|
168
|
+
IORB::DropDetails.build_from(drop).save if not Choice.choices.no_save
|
169
|
+
puts "\nDrop #{drop.name} created.\n\n"
|
170
|
+
|
171
|
+
Choice.choices.add_files.each do |f|
|
172
|
+
if File.exist?(f)
|
173
|
+
drop.add_file(f)
|
174
|
+
puts "File #{f} added."
|
175
|
+
else
|
176
|
+
$stderr.puts "File #{f} not found, skipping."
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
elsif Choice.choices.mydrops
|
181
|
+
IORB::DropManager.each do |d|
|
182
|
+
puts d['name']
|
183
|
+
end
|
184
|
+
elsif Choice.choices.list
|
185
|
+
drop_name = Choice.choices.list
|
186
|
+
drop_details = IORB::DropManager.find(drop_name)
|
187
|
+
token = nil
|
188
|
+
token = drop_details['admin-token'] if drop_details
|
189
|
+
begin
|
190
|
+
drop = Drop.find(drop_name, token)
|
191
|
+
drop.assets.each do |a|
|
192
|
+
puts "Asset name: #{a.name}"
|
193
|
+
puts "Title: #{a.title}"
|
194
|
+
puts "Created at: #{a.created_at}"
|
195
|
+
puts "Type: #{a.type}"
|
196
|
+
puts "File Size: #{a.filesize}"
|
197
|
+
puts "URL: http://drop.io/#{drop_name}/asset/#{a.name}"
|
198
|
+
puts "\n"
|
199
|
+
end
|
200
|
+
rescue Dropio::MissingResourceError
|
201
|
+
$stderr.puts "Drop '#{drop_name}' does not exist"
|
202
|
+
rescue Dropio::AuthorizationError
|
203
|
+
$stderr.puts "Authorization error. This drop is private or the admin token is invalid."
|
204
|
+
end
|
205
|
+
else
|
206
|
+
$stderr.puts "\nInvalid command. Either --add, --find or --list are mandatory.\n\n"
|
207
|
+
puts Choice.help
|
208
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require 'dropio'
|
4
|
+
include Dropio
|
5
|
+
|
6
|
+
#
|
7
|
+
# drop.io ruby client example.
|
8
|
+
#
|
9
|
+
# Create a new drop and upload a file
|
10
|
+
#
|
11
|
+
# Usage: dropio_rubyclient <file>
|
12
|
+
#
|
13
|
+
raise ArgumentError.new('Usage: dropio <file>') if not File.exist?(ARGV[0] || '')
|
14
|
+
|
15
|
+
#
|
16
|
+
# get your API key @ http://api.drop.io
|
17
|
+
#
|
18
|
+
Dropio.api_key = 'your_api_key_here'
|
19
|
+
|
20
|
+
#
|
21
|
+
# Create the drop
|
22
|
+
#
|
23
|
+
drop = Drop.create(
|
24
|
+
{ :expiration_length => '1_DAY_FROM_NOW',
|
25
|
+
:description => 'foo stuff',
|
26
|
+
:guests_can_add => false,
|
27
|
+
:guests_can_comment => false,
|
28
|
+
}
|
29
|
+
)
|
30
|
+
|
31
|
+
#
|
32
|
+
# Drop details
|
33
|
+
#
|
34
|
+
drop.email
|
35
|
+
drop.max_bytes
|
36
|
+
drop.name
|
37
|
+
drop.admin_token
|
38
|
+
drop.hidden_upload_url
|
39
|
+
# Get the admin URL
|
40
|
+
drop.generate_url
|
41
|
+
|
42
|
+
puts "Drop URL: http://drop.io/#{drop.name}"
|
43
|
+
puts "Admin URL: #{drop.generate_url}"
|
44
|
+
|
45
|
+
#
|
46
|
+
# Add a file to the drop
|
47
|
+
#
|
48
|
+
asset = drop.add_file(ARGV[0])
|
49
|
+
#
|
50
|
+
# File details
|
51
|
+
#
|
52
|
+
asset.filesize
|
53
|
+
asset.type
|
54
|
+
asset.status
|
55
|
+
asset.hidden_url
|
56
|
+
asset.name
|
57
|
+
asset.description
|
58
|
+
|
59
|
+
puts "Filename: #{asset.name}"
|
60
|
+
puts "File URL: http://drop.io/#{drop.name}/asset/#{asset.name}"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require 'dropio'
|
4
|
+
include Dropio
|
5
|
+
|
6
|
+
#
|
7
|
+
# Find a public drop and get some attributes
|
8
|
+
#
|
9
|
+
|
10
|
+
#
|
11
|
+
# get your API key @ http://api.drop.io
|
12
|
+
#
|
13
|
+
Dropio.api_key = 'your_api_key_here'
|
14
|
+
|
15
|
+
drop_name = 'rubyclient'
|
16
|
+
begin
|
17
|
+
|
18
|
+
# throws Dropio::MissionResourceError if not found
|
19
|
+
drop = Drop.find(drop_name)
|
20
|
+
# Drop public URL
|
21
|
+
puts "Public URL: http://drop.io/#{drop.name}"
|
22
|
+
|
23
|
+
# Drop size limit
|
24
|
+
puts "Max Bytes: #{drop.max_bytes}"
|
25
|
+
|
26
|
+
rescue Dropio::MissingResourceError
|
27
|
+
puts 'Drop does not exist.'
|
28
|
+
rescue Dropio::AuthorizationError # no permissions to read the drop
|
29
|
+
puts 'Not authorized.'
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
require 'dropio'
|
4
|
+
include Dropio
|
5
|
+
|
6
|
+
#
|
7
|
+
# Finds you have created (got admin token)
|
8
|
+
#
|
9
|
+
# And displays some properties
|
10
|
+
#
|
11
|
+
|
12
|
+
#
|
13
|
+
# get your API key @ http://api.drop.io
|
14
|
+
#
|
15
|
+
Dropio.api_key = 'your_api_key_here'
|
16
|
+
admin_token = '0000000000'
|
17
|
+
drop_name = 'mydropname'
|
18
|
+
|
19
|
+
begin
|
20
|
+
|
21
|
+
drop = Drop.find(drop_name, admin_token)
|
22
|
+
|
23
|
+
rescue Dropio::MissingResourceError
|
24
|
+
puts 'Drop does not exist.'
|
25
|
+
rescue Dropio::AuthorizationError # no permissions to read the drop
|
26
|
+
puts 'Not authorized.'
|
27
|
+
end
|
28
|
+
|
29
|
+
#
|
30
|
+
# Drop details
|
31
|
+
#
|
32
|
+
# Drop public URL
|
33
|
+
puts "Public URL: http://drop.io/#{drop.name}"
|
34
|
+
# Drop size limit
|
35
|
+
puts "Max Bytes: #{drop.max_bytes}"
|
36
|
+
# Drop inbox (mail items to this drop)
|
37
|
+
puts "Email: #{drop.email}"
|
38
|
+
puts "Admin Token: #{drop.admin_token}"
|
39
|
+
puts "Hidden Uploads: #{drop.hidden_upload_url}"
|
40
|
+
# Get the admin URL
|
41
|
+
puts "Admin URL: #{drop.generate_url}"
|
data/iorb.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = %q{iorb}
|
3
|
+
s.version = "0.2.20090420182616"
|
4
|
+
|
5
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
|
+
s.authors = ["Sergio RubioSergio Rubio"]
|
7
|
+
s.date = %q{2009-04-20}
|
8
|
+
s.default_executable = %q{iorb}
|
9
|
+
s.description = %q{drop.io CLI interface}
|
10
|
+
s.email = %q{sergio@rubio.namesergio@rubio.name}
|
11
|
+
s.executables = ["iorb"]
|
12
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
13
|
+
s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "bin/iorb", "dropio-ruby-api-examples/basic_client.rb", "dropio-ruby-api-examples/find_drop.rb", "dropio-ruby-api-examples/find_my_drop.rb", "iorb.gemspec", "lib/iorb.rb", "scripts/newrelease"]
|
14
|
+
s.has_rdoc = true
|
15
|
+
s.homepage = %q{http://github.com/rubiojr/iorb}
|
16
|
+
s.rdoc_options = ["--main", "README.txt"]
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.rubyforge_project = %q{iorb}
|
19
|
+
s.rubygems_version = %q{1.3.1}
|
20
|
+
s.summary = %q{drop.io CLI interface}
|
21
|
+
|
22
|
+
if s.respond_to? :specification_version then
|
23
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
|
+
s.specification_version = 2
|
25
|
+
|
26
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
|
+
s.add_runtime_dependency(%q<dropio>, [">= 0.9"])
|
28
|
+
s.add_development_dependency(%q<hoe>, [">= 1.12.1"])
|
29
|
+
else
|
30
|
+
s.add_dependency(%q<dropio>, [">= 0.9"])
|
31
|
+
s.add_dependency(%q<hoe>, [">= 1.12.1"])
|
32
|
+
end
|
33
|
+
else
|
34
|
+
s.add_dependency(%q<dropio>, [">= 0.9"])
|
35
|
+
s.add_dependency(%q<hoe>, [">= 1.12.1"])
|
36
|
+
end
|
37
|
+
end
|
data/lib/iorb.rb
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
require 'highline/import'
|
2
|
+
|
3
|
+
module IORB
|
4
|
+
VERSION = "0.2.20090421102937"
|
5
|
+
module Util
|
6
|
+
# Code stolen from:
|
7
|
+
# http://evan.tiggerpalace.com/2008/04/26/pastie-from-the-mac-clipboard/
|
8
|
+
#
|
9
|
+
class MacClipboard
|
10
|
+
class << self
|
11
|
+
def read
|
12
|
+
IO.popen('pbpaste') {|clipboard| clipboard.read}
|
13
|
+
end
|
14
|
+
def write(stuff)
|
15
|
+
IO.popen('pbcopy', 'w+') {|clipboard| clipboard.write(stuff)}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
module IORB
|
23
|
+
|
24
|
+
class DropManager
|
25
|
+
def self.each
|
26
|
+
drops = YAML.load_file(IORB::Config.file)['mydrops']
|
27
|
+
if not drops.nil?
|
28
|
+
drops.each do |key, val|
|
29
|
+
next if val['destroyed'] == true
|
30
|
+
yield IORB::DropDetails.build_from(val)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
def self.find(name)
|
35
|
+
each do |details|
|
36
|
+
return details if details['name'] == name
|
37
|
+
end
|
38
|
+
nil
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class Config
|
43
|
+
|
44
|
+
def self.check
|
45
|
+
if not File.exist?(self.file)
|
46
|
+
$stderr.puts "\niorb config file missing, creating one."
|
47
|
+
key = ask("Paste you drop.io api key: ") { |q| q.echo = '*' }
|
48
|
+
File.open(self.file, 'w') do |f|
|
49
|
+
f.puts({ 'api-key' => (key.strip.chomp || 'invalid') }.to_yaml)
|
50
|
+
end
|
51
|
+
$stderr.puts "\nConfig file #{self.file} created.\n\n"
|
52
|
+
exit 1
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.file
|
57
|
+
"#{ENV['HOME']}/.iorbrc"
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.api_key
|
61
|
+
YAML.load_file(self.file)['api-key']
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
class DropDetails < Hash
|
66
|
+
|
67
|
+
def self.build_from(drop)
|
68
|
+
details = DropDetails.new
|
69
|
+
if drop.is_a? Dropio::Drop
|
70
|
+
details['name'] = drop.name
|
71
|
+
details['email'] = drop.email
|
72
|
+
details['admin-url'] = drop.generate_url
|
73
|
+
details['admin-token'] = drop.admin_token
|
74
|
+
details['public-url'] = "http://drop.io/#{drop.name}"
|
75
|
+
details['hidden-uploads'] = drop.hidden_upload_url
|
76
|
+
details['max-bytes'] = drop.max_bytes
|
77
|
+
else
|
78
|
+
details['name'] = drop['name']
|
79
|
+
details['email'] = drop['email']
|
80
|
+
details['admin-url'] = drop['admin-url']
|
81
|
+
details['admin-token'] = drop['admin-token']
|
82
|
+
details['public-url'] = "http://drop.io/#{drop['name']}"
|
83
|
+
details['hidden-uploads'] = drop['hidden-uploads']
|
84
|
+
details['max-bytes'] = drop['max-bytes']
|
85
|
+
end
|
86
|
+
details
|
87
|
+
end
|
88
|
+
|
89
|
+
def print
|
90
|
+
puts "Name: #{self['name']}"
|
91
|
+
puts "Drop Email: #{self['email']}"
|
92
|
+
puts "URL: http://drop.io/#{self['name']}"
|
93
|
+
puts "Max Bytes: #{self['max-bytes']}"
|
94
|
+
puts "Admin Token: #{self['admin-token']}"
|
95
|
+
puts "Hidden Upload URL: #{self['hidden-uploads']}"
|
96
|
+
# Get the admin URL
|
97
|
+
puts "Admin URL: #{self['admin-url']}"
|
98
|
+
end
|
99
|
+
|
100
|
+
def save
|
101
|
+
config = YAML.load_file(IORB::Config.file)
|
102
|
+
config['mydrops'] = {} if config['mydrops'].nil?
|
103
|
+
config['mydrops'][self['name']] = {}.merge(self)
|
104
|
+
File.open(IORB::Config.file, 'w') do |f|
|
105
|
+
f.puts config.to_yaml
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
data/scripts/newrelease
ADDED
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubiojr-iorb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.20090420182616
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sergio RubioSergio Rubio
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-04-20 00:00:00 -07:00
|
13
|
+
default_executable: iorb
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: dropio
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0.9"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: hoe
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.12.1
|
34
|
+
version:
|
35
|
+
description: drop.io CLI interface
|
36
|
+
email: sergio@rubio.namesergio@rubio.name
|
37
|
+
executables:
|
38
|
+
- iorb
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- History.txt
|
43
|
+
- Manifest.txt
|
44
|
+
- README.txt
|
45
|
+
files:
|
46
|
+
- History.txt
|
47
|
+
- Manifest.txt
|
48
|
+
- README.txt
|
49
|
+
- Rakefile
|
50
|
+
- bin/iorb
|
51
|
+
- dropio-ruby-api-examples/basic_client.rb
|
52
|
+
- dropio-ruby-api-examples/find_drop.rb
|
53
|
+
- dropio-ruby-api-examples/find_my_drop.rb
|
54
|
+
- iorb.gemspec
|
55
|
+
- lib/iorb.rb
|
56
|
+
- scripts/newrelease
|
57
|
+
has_rdoc: true
|
58
|
+
homepage: http://github.com/rubiojr/iorb
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options:
|
61
|
+
- --main
|
62
|
+
- README.txt
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: "0"
|
70
|
+
version:
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: "0"
|
76
|
+
version:
|
77
|
+
requirements: []
|
78
|
+
|
79
|
+
rubyforge_project: iorb
|
80
|
+
rubygems_version: 1.2.0
|
81
|
+
signing_key:
|
82
|
+
specification_version: 2
|
83
|
+
summary: drop.io CLI interface
|
84
|
+
test_files: []
|
85
|
+
|