-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathexploredata.rb
29 lines (23 loc) · 850 Bytes
/
exploredata.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/ruby
project_id = "dash-wallet-firebase"
key_file = ".deploy/gc-storage-service-account.json"
bucket_name = "dash-wallet-firebase.appspot.com"
file_name = "explore/explore.db"
assets_path = "wallet/assets/"
require "google/cloud/storage"
# Explicitly use service account credentials by specifying the private key
# file.
storage = Google::Cloud::Storage.new project: project_id, keyfile: key_file
# Make an authenticated API request
storage.buckets.each do |bucket|
puts bucket.name
end
bucket = storage.bucket bucket_name, skip_lookup: true
file = bucket.file file_name
timestamp = file.updated_at.strftime("%Q")
target_file_path = "#{assets_path}#{file_name}"
# create output file
# out_file = File.new(target_file_path, "w")
# out_file.close
file.download target_file_path
puts "Downloaded #{file.name} to #{target_file_path}"