main
David Vargas 2022-12-01 15:24:01 +00:00
parent 0f52a74581
commit b6eec80060
4 changed files with 13 additions and 4 deletions

View File

@ -11,7 +11,5 @@ nextcloud = Nextcloud.new(
password: settings["PASSWORD"] password: settings["PASSWORD"]
) )
ocs = nextcloud.ocs
puts "* ocs.webdav.directory: #{ocs.webdav.directory}"
webdav = nextcloud.webdav webdav = nextcloud.webdav
puts "* webdav.directory(@path): #{webdav.directory.instance_variable_get(:@path)}" puts "* webdav.directory(@path): #{webdav.directory.instance_variable_get(:@path)}"

View File

@ -1,9 +1,10 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
require_relative "lib" require_relative "lib"
settings = get_settings()
nextcloud = get_nextcloud_object() nextcloud = get_nextcloud_object()
ocs = nextcloud.ocs ocs = nextcloud.ocs
user = ocs.user.find("dvarrui") user = ocs.user.find(settings["USERNAME"])
tags = %i(enabled id quota email displayname phone address website twitter groups language meta) tags = %i(enabled id quota email displayname phone address website twitter groups language meta)

View File

@ -10,9 +10,14 @@ webdav = nextcloud.webdav
path = webdav.directory.instance_variable_get(:@path) path = webdav.directory.instance_variable_get(:@path)
puts "* webdav.directory(@path): #{path}" puts "* webdav.directory(@path): #{path}"
dir = "files_from_git" dir = "files_from_git"
binding.break
result = webdav.directory.create(dir) result = webdav.directory.create(dir)
puts result puts result
result = webdav.directory.put("lib.rb", File.join(dir, "lib.rb"))
puts result
dir = webdav.directory.find dir = webdav.directory.find
puts dir.contents puts dir.contents

View File

@ -1,8 +1,13 @@
require "dotenv" require "dotenv"
require "nextcloud" require "nextcloud"
require "debug"
def get_settings()
Dotenv.load
end
def get_nextcloud_object def get_nextcloud_object
settings = Dotenv.load settings = get_settings
nextcloud = Nextcloud.new( nextcloud = Nextcloud.new(
url: settings["URL"], url: settings["URL"],
username: settings["USERNAME"], username: settings["USERNAME"],