class CartBinaryUploader::GoogleCloudStorage

Attributes

credentials_file_path[RW]
project_id[RW]

Public Class Methods

new(project_id, credentials_file, bucket_name, framework_name, framework_version) click to toggle source
Calls superclass method
# File lib/storage/google_cloud_storage.rb, line 13
def initialize(project_id,
               credentials_file,
               bucket_name,
               framework_name,
               framework_version)
  @credentials_file_path = credentials_file
  @project_id = project_id
  super(bucket_name, framework_name, framework_version)
end

Public Instance Methods

create_bucket() click to toggle source
# File lib/storage/google_cloud_storage.rb, line 28
def create_bucket
  @bucket = @storage.bucket @bucket_name
end
create_storage() click to toggle source
# File lib/storage/google_cloud_storage.rb, line 23
def create_storage
  @storage = Google::Cloud::Storage.new(project_id: @project_id,
                                        credentials: @credentials_file_path)
end
download_config_json_file(from_file) click to toggle source
# File lib/storage/google_cloud_storage.rb, line 42
def download_config_json_file(from_file)
  json_file = @bucket.file from_file
  json_file.download from_file
  json_file
end
file_on_storage_cloud(file) click to toggle source
# File lib/storage/google_cloud_storage.rb, line 37
def file_on_storage_cloud(file)
  bucket_file = bucket.file file
  !bucket_file.nil?
end
upload_file(file_path) click to toggle source
# File lib/storage/google_cloud_storage.rb, line 32
def upload_file(file_path)
  @bucket_object = @bucket.upload_file(file_path, file_path)
  @bucket_object.signed_url(method: 'GET', expires: 3.154e+8)
end