Compare commits

..

No commits in common. "b6eec80060bb80c2bcda1c22c890baad06831c64" and "71a283513cacfc3383020e9b450b3515ba28908f" have entirely different histories.

9 changed files with 37 additions and 15 deletions

View File

@ -1 +1 @@
3.1.2 3.0.4

View File

@ -3,5 +3,9 @@
source "https://rubygems.org" source "https://rubygems.org"
gem "colorize" gem "colorize"
# frozen_string_literal: true
source "https://rubygems.org"
gem "dotenv" gem "dotenv"
gem "nextcloud" gem "nextcloud"

View File

@ -2,5 +2,4 @@
require "dotenv" require "dotenv"
settings = Dotenv.load settings = Dotenv.load
puts "Comprobando el fichero de configuración:"
puts settings puts settings

View File

@ -11,5 +11,7 @@ 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)}"

22
bin/nextcloud/03-user-info.rb Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env ruby
require "debug"
require "dotenv"
require "nextcloud"
settings = Dotenv.load
nextcloud = Nextcloud.new(
url: settings["URL"],
username: settings["USERNAME"],
password: settings["PASSWORD"]
)
ocs = nextcloud.ocs
user = ocs.user.find("dvarrui")
tags = %i(enabled id quota email displayname phone address website twitter groups language meta)
tags.each do |tag|
label = "user.#{tag}"
puts "#{label.rjust(16)} = #{user.send(tag)}"
end

View File

@ -1,10 +1,9 @@
#!/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(settings["USERNAME"]) user = ocs.user.find("dvarrui")
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,14 +10,9 @@ 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

6
bin/nextcloud/Gemfile Normal file
View File

@ -0,0 +1,6 @@
# frozen_string_literal: true
source "https://rubygems.org"
gem "dotenv"
gem "nextcloud"

View File

@ -1,13 +1,8 @@
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 = get_settings settings = Dotenv.load
nextcloud = Nextcloud.new( nextcloud = Nextcloud.new(
url: settings["URL"], url: settings["URL"],
username: settings["USERNAME"], username: settings["USERNAME"],