cloudapp-export 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +36 -0
- data/.gitignore +17 -0
- data/.rubocop.yml +58 -0
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/README.md +43 -0
- data/Rakefile +18 -0
- data/bin/cloudapp-export +10 -0
- data/cloudapp-export.gemspec +30 -0
- data/lib/cloudapp_export.rb +9 -0
- data/lib/cloudapp_export/api.rb +64 -0
- data/lib/cloudapp_export/cli.rb +83 -0
- data/lib/cloudapp_export/exporter.rb +80 -0
- data/lib/cloudapp_export/item.rb +22 -0
- data/lib/cloudapp_export/item_list.rb +59 -0
- data/lib/cloudapp_export/version.rb +3 -0
- data/lib/tasks/cloudapp_export.rake +10 -0
- metadata +162 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1579ad02b2a2789e95e6e5c743765006091e9c67
|
4
|
+
data.tar.gz: bfac4398babc3afc70aa4d1a44c57085128c0d52
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d20379fcab2828e82ee1e70e6fd35c246c9f00804b9b85a78a7e2fe680ae278d1c6e32c9905ab0e4636cc3f6bcb08e242973e6a0930749c45b82803e49361b7d
|
7
|
+
data.tar.gz: 9ea24ea8e415140425fe60c9c16e522acea2b3e4c8c5b4514e68ef38f734f51ebda8da9c294f50d4ab021b8e332f34298be468cf15f5de4073063bf2dbe54cfc
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# Ruby CircleCI 2.0 configuration file
|
2
|
+
#
|
3
|
+
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
+
#
|
5
|
+
version: 2
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
docker:
|
9
|
+
- image: circleci/ruby:2.4.2
|
10
|
+
working_directory: ~/repo
|
11
|
+
|
12
|
+
steps:
|
13
|
+
- checkout
|
14
|
+
|
15
|
+
# Download and cache dependencies
|
16
|
+
- restore_cache:
|
17
|
+
keys:
|
18
|
+
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
19
|
+
# fallback to using the latest cache if no exact match is found
|
20
|
+
- v1-dependencies-
|
21
|
+
|
22
|
+
- run:
|
23
|
+
name: install dependencies
|
24
|
+
command: |
|
25
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
26
|
+
|
27
|
+
- save_cache:
|
28
|
+
paths:
|
29
|
+
- ./vendor/bundle
|
30
|
+
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
31
|
+
|
32
|
+
# run tests!
|
33
|
+
- run:
|
34
|
+
name: run tests
|
35
|
+
command: |
|
36
|
+
rake
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
AllCops:
|
2
|
+
DisplayCopNames: true
|
3
|
+
Exclude:
|
4
|
+
- 'Gemfile'
|
5
|
+
- 'Gemfile.lock'
|
6
|
+
- '*.gemspec'
|
7
|
+
- 'vendor/**/*'
|
8
|
+
|
9
|
+
Style/FrozenStringLiteralComment:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
Style/StringLiterals:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Style/MutableConstant:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Style/Documentation:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Style/DoubleNegation:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Style/MultilineTernaryOperator:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Style/RegexpLiteral:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
# Screens are big, even when they're small
|
31
|
+
Metrics/LineLength:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Style/TrailingCommaInArguments:
|
35
|
+
EnforcedStyleForMultiline: consistent_comma
|
36
|
+
|
37
|
+
Style/TrailingCommaInArrayLiteral:
|
38
|
+
EnforcedStyleForMultiline: consistent_comma
|
39
|
+
|
40
|
+
Style/TrailingCommaInHashLiteral:
|
41
|
+
EnforcedStyleForMultiline: consistent_comma
|
42
|
+
|
43
|
+
Style/ClassAndModuleChildren:
|
44
|
+
Exclude:
|
45
|
+
- '**/*_test.rb'
|
46
|
+
Metrics/MethodLength:
|
47
|
+
Max: 16
|
48
|
+
Exclude:
|
49
|
+
- '**/*_test.rb'
|
50
|
+
|
51
|
+
# Namespace blocks contain multiple tasks
|
52
|
+
Metrics/BlockLength:
|
53
|
+
Exclude:
|
54
|
+
- '**/*.rake'
|
55
|
+
|
56
|
+
# TODO: Refactor to reduce this
|
57
|
+
Metrics/AbcSize:
|
58
|
+
Max: 26
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 Marc Qualie
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# CloudApp Export
|
2
|
+
|
3
|
+
A quick way to grab all the data you have stored in [CloudApp](https://www.getcloudapp.com/).
|
4
|
+
|
5
|
+
|
6
|
+
## Credentials
|
7
|
+
|
8
|
+
The script requiests the following environment variables. These are easiest to
|
9
|
+
set via the .env file in this directory which will be automatically detected.
|
10
|
+
|
11
|
+
```
|
12
|
+
export CLOUDAPP_API_HOST="my.cl.ly"
|
13
|
+
export CLOUDAPP_USERNAME="YOUR_EMAIL"
|
14
|
+
export CLOUDAPP_PASSWORD="YOUR_PASSWORD"
|
15
|
+
```
|
16
|
+
|
17
|
+
|
18
|
+
## API Output Format
|
19
|
+
|
20
|
+
Each item will have the following attributes
|
21
|
+
|
22
|
+
```
|
23
|
+
slug: 3a1X1J383340
|
24
|
+
name: marcqualie-nyc-2017.jpg
|
25
|
+
created_at: '2017-07-06T17:48:01Z'
|
26
|
+
updated_at: '2017-07-06T17:48:02Z'
|
27
|
+
long_link: true
|
28
|
+
item_type: image
|
29
|
+
view_counter: 0
|
30
|
+
content_url: http://share.marcqualie.com/3a1X1J383340/marcqualie-nyc-2017.jpg
|
31
|
+
redirect_url:
|
32
|
+
remote_url: http://f.cl.ly/items/292o1N3J3s0A281O3Y2x/marcqualie-nyc-2017.jpg
|
33
|
+
source: CloudApp/4.2.4 (1054) (Mac OS X 10.12.5)
|
34
|
+
thumbnail_url: https://d1dqt6infcio59.cloudfront.net/3a1X1J383340/010428f967be2109bac41acfae90cb55
|
35
|
+
share_url: http://share.marcqualie.com/3a1X1J383340
|
36
|
+
```
|
37
|
+
|
38
|
+
You can download the direct file via `remote_url`
|
39
|
+
|
40
|
+
|
41
|
+
## LICENSE
|
42
|
+
|
43
|
+
[MIT](LICENSE)
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rake/testtask"
|
3
|
+
require "rubocop/rake_task"
|
4
|
+
|
5
|
+
lib = File.expand_path("lib", __dir__)
|
6
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
7
|
+
|
8
|
+
load "tasks/cloudapp_export.rake"
|
9
|
+
|
10
|
+
Rake::TestTask.new(:test) do |t|
|
11
|
+
t.libs << "test"
|
12
|
+
t.libs << "lib"
|
13
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
14
|
+
end
|
15
|
+
|
16
|
+
RuboCop::RakeTask.new
|
17
|
+
|
18
|
+
task default: %w[rubocop test]
|
data/bin/cloudapp-export
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require_relative "lib/cloudapp_export/version"
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "cloudapp-export"
|
5
|
+
spec.version = CloudappExport::VERSION
|
6
|
+
spec.authors = ["Marc Qualie"]
|
7
|
+
spec.email = ["marc@marcqualie.com"]
|
8
|
+
|
9
|
+
spec.summary = "A quick way to export all the data you have stored in CloudApp"
|
10
|
+
spec.homepage = "https://github.com/marcqualie/cloudapp-export"
|
11
|
+
spec.license = "MIT"
|
12
|
+
|
13
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
14
|
+
f.match(%r{^(test|spec|features)/})
|
15
|
+
end
|
16
|
+
spec.bindir = "bin"
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.required_ruby_version = ">= 2.3.3"
|
21
|
+
|
22
|
+
spec.add_dependency "dotenv", "2.2.1"
|
23
|
+
spec.add_dependency "net-http-digest_auth", "1.4.1"
|
24
|
+
spec.add_dependency "thor", "0.20.0"
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
27
|
+
spec.add_development_dependency "rake", "~> 12.3"
|
28
|
+
spec.add_development_dependency "rubocop", "~> 0.54.0"
|
29
|
+
spec.add_development_dependency "minitest", "~> 5.11"
|
30
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'net/http'
|
3
|
+
require 'net/http/digest_auth'
|
4
|
+
require 'open-uri'
|
5
|
+
require 'uri'
|
6
|
+
|
7
|
+
module CloudappExport
|
8
|
+
class Api
|
9
|
+
DEFAULT_HOST = "my.cl.ly"
|
10
|
+
|
11
|
+
def initialize(options = {})
|
12
|
+
@options = options
|
13
|
+
end
|
14
|
+
|
15
|
+
def request(path)
|
16
|
+
digest_auth = Net::HTTP::DigestAuth.new
|
17
|
+
uri = URI.parse("https://#{host}/v3/#{path}")
|
18
|
+
uri.user = CGI.escape(username)
|
19
|
+
uri.password = password
|
20
|
+
|
21
|
+
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
|
22
|
+
# First request is a 401 response with a WWW-Authenticate header
|
23
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
24
|
+
response = http.request(request)
|
25
|
+
|
26
|
+
# Create a new request with the Authorization header
|
27
|
+
auth = digest_auth.auth_header(uri, response['www-authenticate'], 'GET')
|
28
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
29
|
+
request.add_field('Authorization', auth)
|
30
|
+
|
31
|
+
# re-issue request with Authorization
|
32
|
+
ApiResponse.new(http.request(request))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
protected
|
37
|
+
|
38
|
+
def host
|
39
|
+
@options['host'] || DEFAULT_HOST
|
40
|
+
end
|
41
|
+
|
42
|
+
def username
|
43
|
+
@options['username'] || raise('Username is required for API use')
|
44
|
+
end
|
45
|
+
|
46
|
+
def password
|
47
|
+
@options['password'] || raise('Password is required for API use')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class ApiResponse
|
52
|
+
def initialize(http_response)
|
53
|
+
@http_response = http_response
|
54
|
+
end
|
55
|
+
|
56
|
+
def body
|
57
|
+
@http_response.body
|
58
|
+
end
|
59
|
+
|
60
|
+
def data
|
61
|
+
JSON.parse(@http_response.body)['data']
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require "base64"
|
2
|
+
require "fileutils"
|
3
|
+
require "thor"
|
4
|
+
|
5
|
+
module CloudappExport
|
6
|
+
class CLI < Thor
|
7
|
+
class_option :username, type: :string, desc: "Account username"
|
8
|
+
class_option :password, type: :string, desc: "Account password (not recommended to pass via command line)"
|
9
|
+
|
10
|
+
desc :all, "Export all data from your Cloudapp account"
|
11
|
+
option :limit, default: 5, type: :numeric
|
12
|
+
option :dir, default: "#{ENV['HOME']}/Downloads/CloudappExport", type: :string, desc: "Directory to download all files to"
|
13
|
+
option :cache, type: :boolean, default: true
|
14
|
+
def all
|
15
|
+
items = CloudappExport::ItemList.new(
|
16
|
+
api,
|
17
|
+
'limit' => options['limit'],
|
18
|
+
'cache' => options['cache'],
|
19
|
+
)
|
20
|
+
|
21
|
+
exporter = ::CloudappExport::Exporter.new(
|
22
|
+
items,
|
23
|
+
'dir' => options['dir'],
|
24
|
+
)
|
25
|
+
exporter.on_log do |message|
|
26
|
+
print message
|
27
|
+
end
|
28
|
+
exporter.export_all
|
29
|
+
end
|
30
|
+
|
31
|
+
# rubocop:disable Metrics/AbcSize
|
32
|
+
# rubocop:disable Layout/TrailingWhitespace
|
33
|
+
desc :stats, "Show stats for CloudApp items"
|
34
|
+
option :dir, default: "#{ENV['HOME']}/Downloads/CloudappExport", type: :string, desc: "Directory where your files were downloaded to"
|
35
|
+
option :cache, type: :boolean, default: true
|
36
|
+
def stats
|
37
|
+
items = CloudappExport::ItemList.new(
|
38
|
+
api,
|
39
|
+
'cache' => options['cache'],
|
40
|
+
)
|
41
|
+
|
42
|
+
downloaded_items = items.data.select { |item| File.exist?("#{options['dir']}/#{item.filename}") }
|
43
|
+
downloaded_items_size = downloaded_items.inject(0) { |sum, item| sum + File.size("#{options['dir']}/#{item.filename}") }
|
44
|
+
|
45
|
+
say("Dir #{options['dir']}")
|
46
|
+
say("Items #{items.count}")
|
47
|
+
say("Downloaded #{downloaded_items.count}")
|
48
|
+
say(" #{(downloaded_items_size.to_f / 1_000_000).round 2} mb")
|
49
|
+
end
|
50
|
+
# rubocop:enable Metrics/AbcSize
|
51
|
+
# rubocop:enable Layout/TrailingWhitespace
|
52
|
+
|
53
|
+
no_commands do
|
54
|
+
def api
|
55
|
+
@api ||= begin
|
56
|
+
CloudappExport::Api.new(
|
57
|
+
'username' => username,
|
58
|
+
'password' => password,
|
59
|
+
)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def username
|
64
|
+
@username ||= begin
|
65
|
+
username = options['username']
|
66
|
+
username ||= ENV['CLOUDAPP_USERNAME']
|
67
|
+
username ||= ask("Username:")
|
68
|
+
username || raise("Username is required")
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def password
|
73
|
+
say("WARNING: Passing password via the command line is not recommended!", :yellow) if options['password']
|
74
|
+
@password ||= begin
|
75
|
+
password = options['password']
|
76
|
+
password ||= ENV['CLOUDAPP_PASSWORD']
|
77
|
+
password ||= (ask("Password:", echo: false) && say('*' * 20))
|
78
|
+
password || raise("Password is required")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
module CloudappExport
|
2
|
+
class Exporter
|
3
|
+
attr_reader :items
|
4
|
+
|
5
|
+
def initialize(items, options = {})
|
6
|
+
@items = items
|
7
|
+
@options = options
|
8
|
+
@log_callbacks = []
|
9
|
+
end
|
10
|
+
|
11
|
+
def export_all
|
12
|
+
FileUtils.mkdir_p(download_dir) unless Dir.exist?(download_dir)
|
13
|
+
|
14
|
+
items_count = items.count
|
15
|
+
items.each_with_index do |item, index|
|
16
|
+
percent = (index + 1).to_f / items_count * 100
|
17
|
+
log "[#{(index + 1).to_s.rjust(4, '0')} / #{items_count.to_s.rjust(4, '0')} #{percent.round.to_s.rjust(3, ' ')}%]"
|
18
|
+
export_item(item)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def export_item(item)
|
23
|
+
log " #{item.name} -> #{item.filename}".ljust(80, ' ')
|
24
|
+
|
25
|
+
filepath = "#{download_dir}/#{item.filename}"
|
26
|
+
if File.exist?(filepath)
|
27
|
+
log " SK #{item_filesize_human(item)}"
|
28
|
+
else
|
29
|
+
begin
|
30
|
+
log " DL"
|
31
|
+
copy_file(item['remote_url'], filepath)
|
32
|
+
log " #{item_filesize_human(item)}"
|
33
|
+
rescue StandardError => error
|
34
|
+
log " ER #{error.message}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
log "\n"
|
38
|
+
end
|
39
|
+
|
40
|
+
def on_log(&block)
|
41
|
+
@log_callbacks.push(block)
|
42
|
+
end
|
43
|
+
|
44
|
+
protected
|
45
|
+
|
46
|
+
def copy_file(remote_url, local_path)
|
47
|
+
remote_uri = URI(remote_url)
|
48
|
+
File.open(local_path, 'wb') do |file|
|
49
|
+
file << Net::HTTP.get(remote_uri)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def item_filesize(item)
|
54
|
+
filepath = "#{download_dir}/#{item.filename}"
|
55
|
+
File.exist?(filepath) ? File.size(filepath) : 0
|
56
|
+
end
|
57
|
+
|
58
|
+
def item_filesize_human(item)
|
59
|
+
filesize = item_filesize(item)
|
60
|
+
return '--' if filesize.zero?
|
61
|
+
size_human(filesize)
|
62
|
+
end
|
63
|
+
|
64
|
+
def size_human(filesize)
|
65
|
+
filesize >= (1024 * 1024) \
|
66
|
+
? "#{(filesize.to_f / (1024 * 1024)).round 2} mb"
|
67
|
+
: "#{(filesize.to_f / 1024).round 2} kb"
|
68
|
+
end
|
69
|
+
|
70
|
+
def log(message)
|
71
|
+
@log_callbacks.each do |callback|
|
72
|
+
callback.call(message)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def download_dir
|
77
|
+
@options['dir']
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module CloudappExport
|
2
|
+
class Item
|
3
|
+
attr_reader :attributes
|
4
|
+
|
5
|
+
def initialize(attributes)
|
6
|
+
@attributes = attributes
|
7
|
+
end
|
8
|
+
|
9
|
+
def [](key)
|
10
|
+
@attributes[key]
|
11
|
+
end
|
12
|
+
|
13
|
+
def name
|
14
|
+
@attributes['name']
|
15
|
+
end
|
16
|
+
|
17
|
+
def filename
|
18
|
+
ext = @attributes['name'].split('.').last
|
19
|
+
"#{@attributes['slug']}.#{ext}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require "json"
|
2
|
+
|
3
|
+
module CloudappExport
|
4
|
+
class ItemList
|
5
|
+
def initialize(api, options = {})
|
6
|
+
@api = api
|
7
|
+
@items = []
|
8
|
+
@use_cache = !!options['cache']
|
9
|
+
@limit = (options['limit'] || 999_999_999).to_i
|
10
|
+
@offset = (options['offset'] || 0).to_i
|
11
|
+
end
|
12
|
+
|
13
|
+
def data
|
14
|
+
load
|
15
|
+
@items
|
16
|
+
end
|
17
|
+
|
18
|
+
def count
|
19
|
+
load
|
20
|
+
[@items.count, @limit].min
|
21
|
+
end
|
22
|
+
|
23
|
+
def each(&block)
|
24
|
+
load
|
25
|
+
@items[@offset..(@limit - 1)].each(&block)
|
26
|
+
end
|
27
|
+
|
28
|
+
def each_with_index(&block)
|
29
|
+
load
|
30
|
+
@items[@offset..(@limit - 1)].each_with_index(&block)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Restrict items to a subset from 0 to $number
|
34
|
+
# @param number [Integer] Number of items to return
|
35
|
+
# @return Integer
|
36
|
+
attr_writer :limit
|
37
|
+
|
38
|
+
protected
|
39
|
+
|
40
|
+
def load
|
41
|
+
@items = begin
|
42
|
+
if @use_cache && File.exist?(cache_file_path)
|
43
|
+
items = ::JSON.parse(::File.read(cache_file_path))
|
44
|
+
else
|
45
|
+
response = @api.request("items?per_page=100000")
|
46
|
+
items = response.data
|
47
|
+
::File.write(cache_file_path, ::JSON.dump(items))
|
48
|
+
end
|
49
|
+
items.map do |attributes|
|
50
|
+
::CloudappExport::Item.new(attributes)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def cache_file_path
|
56
|
+
"#{ENV['HOME']}/.cloudapp-export-items.json"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
metadata
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cloudapp-export
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Marc Qualie
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-04-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: dotenv
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.2.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.2.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: net-http-digest_auth
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.4.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.4.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.20.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.20.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.16'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.16'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '12.3'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '12.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.54.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.54.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: minitest
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '5.11'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '5.11'
|
111
|
+
description:
|
112
|
+
email:
|
113
|
+
- marc@marcqualie.com
|
114
|
+
executables:
|
115
|
+
- cloudapp-export
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".circleci/config.yml"
|
120
|
+
- ".gitignore"
|
121
|
+
- ".rubocop.yml"
|
122
|
+
- Gemfile
|
123
|
+
- Gemfile.lock
|
124
|
+
- LICENSE
|
125
|
+
- README.md
|
126
|
+
- Rakefile
|
127
|
+
- bin/cloudapp-export
|
128
|
+
- cloudapp-export.gemspec
|
129
|
+
- items/.gitkeep
|
130
|
+
- lib/cloudapp_export.rb
|
131
|
+
- lib/cloudapp_export/api.rb
|
132
|
+
- lib/cloudapp_export/cli.rb
|
133
|
+
- lib/cloudapp_export/exporter.rb
|
134
|
+
- lib/cloudapp_export/item.rb
|
135
|
+
- lib/cloudapp_export/item_list.rb
|
136
|
+
- lib/cloudapp_export/version.rb
|
137
|
+
- lib/tasks/cloudapp_export.rake
|
138
|
+
homepage: https://github.com/marcqualie/cloudapp-export
|
139
|
+
licenses:
|
140
|
+
- MIT
|
141
|
+
metadata: {}
|
142
|
+
post_install_message:
|
143
|
+
rdoc_options: []
|
144
|
+
require_paths:
|
145
|
+
- lib
|
146
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: 2.3.3
|
151
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
requirements: []
|
157
|
+
rubyforge_project:
|
158
|
+
rubygems_version: 2.5.2
|
159
|
+
signing_key:
|
160
|
+
specification_version: 4
|
161
|
+
summary: A quick way to export all the data you have stored in CloudApp
|
162
|
+
test_files: []
|