Module: Google::Cloud::Gemserver::GCS
- Defined in:
- lib/google/cloud/gemserver/gcs.rb
Overview
Google Cloud Storage
Interacts with Google Cloud Storage by providing methods that upload and download files to and from Google Cloud Storage.
Class Method Summary collapse
-
.delete_file(file) ⇒ Object
Deletes a given file from Google Cloud Storage.
-
.get_file(file) ⇒ Google::Cloud::Storage::File
Retrieves a file from Google Cloud Storage from a project's corresponding bucket.
-
.upload(file, dest = nil) ⇒ Google::Cloud::Storage::File
Uploads a given file to a project's corresponding bucket on Google Cloud Storage.
Class Method Details
.delete_file(file) ⇒ Object
Deletes a given file from Google Cloud Storage.
90 91 92 93 |
# File 'lib/google/cloud/gemserver/gcs.rb', line 90 def self.delete_file file return unless proj_id get_file(file).delete end |
.get_file(file) ⇒ Google::Cloud::Storage::File
Retrieves a file from Google Cloud Storage from a project's corresponding bucket.
66 67 68 69 |
# File 'lib/google/cloud/gemserver/gcs.rb', line 66 def self.get_file file return unless proj_id bucket.file file end |
.upload(file, dest = nil) ⇒ Google::Cloud::Storage::File
Uploads a given file to a project's corresponding bucket on Google Cloud Storage. A destination path of the file can be provided. By default the path of the file is the same on Google Cloud Storage.
Storage. Optional.
81 82 83 84 |
# File 'lib/google/cloud/gemserver/gcs.rb', line 81 def self.upload file, dest = nil return unless proj_id bucket.create_file file, dest end |