Sha256: c5211e9277097f4f5027809165686dae69ac10749f98ee6a5f9173af10ff894e

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require "globus_client"

GlobusClient.configure(
  client_id: ENV["GLOBUS_CLIENT_ID"],
  client_secret: ENV["GLOBUS_CLIENT_SECRET"],
  uploads_directory: ENV["GLOBUS_UPLOADS_DIRECTORY"],
  transfer_endpoint_id: ENV["GLOBUS_ENDPOINT"]
)

user_id, path = *ARGV

# Test public API methods here.
GlobusClient.mkdir(user_id:, path:)

user_exists = GlobusClient.user_exists?(user_id)

# Not part of the public API but this allows us to test access changes
before_permissions = GlobusClient::Endpoint.new(GlobusClient.config, user_id:, path:).send(:access_rule)["permissions"]

files_count = GlobusClient.file_count(user_id:, path:)

total_size = GlobusClient.total_size(user_id:, path:)

GlobusClient.disallow_writes(user_id:, path:)

files_list = GlobusClient.get_filenames(user_id:, path:)

# Not part of the public API but this allows us to test access changes
after_permissions = GlobusClient::Endpoint.new(GlobusClient.config, user_id:, path:).send(:access_rule)["permissions"]

puts "User #{user_id} exists: #{user_exists}"
puts "Initial directory permissions: #{before_permissions}"
puts "Number of files in directory: #{files_count}"
puts "Total size of files in directory: #{total_size}"
puts "List of files in directory: #{files_list}"
puts "Final directory permissions: #{after_permissions}"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
globus_client-0.6.0 api_test.rb