WebDAV: Connect Ruby to a WebDAV Server

M

Michael Dichtl

Hello to all!

Is there a possibility to connect ruby to a webDAV server?
I have a webDAV server with some files which I want to use in ruby.
Does anyone know how to do such a connection?

I've read about RailsDAV, but it seems to be a webDAV server an not a
method to connect to a webDAV server.

Hoping for help! Thnx a lot!
Have a nice day, Michael!
 
G

Gregory Seidman

Hello to all!

Is there a possibility to connect ruby to a webDAV server?
I have a webDAV server with some files which I want to use in ruby.
Does anyone know how to do such a connection?
[...]

WebDAV is dead simple. It is, roughly speaking, a RESTful HTTP interface to
a file store. You can interact with it using Net::HTTP or similar. If you
just want to retrieve files, it is no more complicated than an HTTP GET
request. If you want to do more with the files (e.g. create, update, lock,
etc.) then you'll need to use other HTTP verbs. Read the WebDAV spec (or
various explanations thereof), easily findable on the web, for more
information.
Hoping for help! Thnx a lot!
Have a nice day, Michael!
--Greg
 
M

Michael Dichtl

Hi!

Thnx for your answer!
It seems I've an blackout... i don't know how to establish the
connection.

require 'net/http'
NET:HTTP.start('http://myWebDAV.com')


end

i have no idea to do in ruby what you mean.
(logically i can understand it, but how can i do it in ruby?)

thnx!!


Gregory said:
Hello to all!

Is there a possibility to connect ruby to a webDAV server?
I have a webDAV server with some files which I want to use in ruby.
Does anyone know how to do such a connection?
[...]

WebDAV is dead simple. It is, roughly speaking, a RESTful HTTP interface
to
a file store. You can interact with it using Net::HTTP or similar. If
you
just want to retrieve files, it is no more complicated than an HTTP GET
request. If you want to do more with the files (e.g. create, update,
lock,
etc.) then you'll need to use other HTTP verbs. Read the WebDAV spec (or
various explanations thereof), easily findable on the web, for more
information.
Hoping for help! Thnx a lot!
Have a nice day, Michael!
--Greg
 
G

Gregory Seidman

Hi!

Thnx for your answer!
It seems I've an blackout... i don't know how to establish the
connection.

require 'net/http'
NET:HTTP.start('http://myWebDAV.com')


end

i have no idea to do in ruby what you mean.
(logically i can understand it, but how can i do it in ruby?)

At this point you need to go read the documentation. You may find it
instructive to search for sample code. I've pointed you in the right
direction, but I don't have time to do much more, sorry.
thnx!! --Greg

Gregory said:
Hello to all!

Is there a possibility to connect ruby to a webDAV server?
I have a webDAV server with some files which I want to use in ruby.
Does anyone know how to do such a connection?
[...]

WebDAV is dead simple. It is, roughly speaking, a RESTful HTTP interface
to
a file store. You can interact with it using Net::HTTP or similar. If
you
just want to retrieve files, it is no more complicated than an HTTP GET
request. If you want to do more with the files (e.g. create, update,
lock,
etc.) then you'll need to use other HTTP verbs. Read the WebDAV spec (or
various explanations thereof), easily findable on the web, for more
information.
Hoping for help! Thnx a lot!
Have a nice day, Michael!
--Greg
 
M

Michael Dichtl

Okay I'll try!!

Thnx for help Greg!!!

Gregory said:
At this point you need to go read the documentation. You may find it
instructive to search for sample code. I've pointed you in the right
direction, but I don't have time to do much more, sorry.

--Greg
 
R

Rob Biedenharn

Hi,

I'm relatively new to Ruby and haven't programmed in a while and am
trying to get back into a good programming habit.

In the reference: http://www.caliban.org/ruby/rubyguide.shtml#ri

it states that, in irb, if you do 42.<Tab> you get a list of all
the methods that pertain to the class 42, a very useful function,
except that it doesn't work on my system (Mac OS 10.4.10, and ruby
1.8.6 and irb 0.9.5(05/04/13) -- Note the date on irb!)

Also, when I do ri I get a list that ends with (END). I can't find
a clean exit from it (ctrl z seems to be the only thing that
works), but it leaves, using ps, a suspended process.

How can I cleanup all of this?

Thanks.

Pete Versteegen

Put these lines into a file .irbrc in your home directory

require 'rubygems'
require 'irb/completion'

You could also just type them into your irb session to try them out.

The "END" in ri's output is actually a prompt from the pager
"less" (in all likelihood if you've not changed it). You should be
able to get out with 'q'. See `man less` or type 'h' instead of
'q'. You can also tell ri to send output directly rather than
through a pager like less with a '-T' option, for example: ri -T
File.exist?

-Rob

Rob Biedenharn http://agileconsultingllc.com
(e-mail address removed)
 
J

James Edward Gray II

Put these lines into a file .irbrc in your home directory

require 'rubygems'
require 'irb/completion'

You don't need the gems require line here.

James Edward Gray II
 
R

Rob Biedenharn

Thanks for the prompt answer.

I added the require statements and tried with and without the gems
requirement but it still did not give me the expected out put for
42.<Tab>, using Tab as a word or as the key stroke. I put a puts
statement in the .irbc file to show that Irb reads that file.

I get the ?> prompt asking for some other input.

Any other ideas?

The q worked just fine.

Thanks.


Pete

The first TAB key press beeps at me, then I get:

irb(main):004:0> 42.
42.gcd
42.numerator 42.succ
42.__id__ 42.gcdlcm
42.object_id 42.taguri
42.__send__ 42.gem
42.power! 42.taguri=
42.abs 42.hash
42.prec 42.taint
42.between? 42.id
42.prec_f 42.tainted?
42.ceil 42.id2name
42.prec_i 42.times
42.chr 42.inspect
42.private_methods 42.to_a
42.class 42.instance_eval
42.protected_methods 42.to_bn
42.clone 42.instance_of?
42.public_methods 42.to_f
42.coerce 42.instance_variable_get
42.quo 42.to_i
42.denominator 42.instance_variable_set
42.rdiv 42.to_int
42.display 42.instance_variables
42.remainder 42.to_r
42.div 42.integer?
42.require 42.to_s
42.divmod 42.is_a?
42.require_gem 42.to_sym
42.downto 42.kind_of?
42.respond_to? 42.to_yaml
42.dup 42.lcm
42.round 42.to_yaml_properties
42.eql? 42.method
42.rpower 42.to_yaml_style
42.equal? 42.methods
42.send 42.truncate
42.extend 42.modulo
42.singleton_method_added 42.type
42.floor 42.next
42.singleton_methods 42.untaint
42.freeze 42.nil?
42.size 42.upto
42.frozen? 42.nonzero?
42.step 42.zero?
irb(main):004:0> 42.

I suspect that the confusion comes from the fact that 42._ might be
the start of a Float (note the first blank entry at the top of the
first column), but in any case, the completion only happens
immediately (no bell or list) if the completion is unambiguous. Try
typing 42.tiTAB and you should get 42.times_ (at least I do).

Mac OS X 10.4.10
$ ruby -v
ruby 1.8.5 (2006-08-25) [i686-darwin8.8.1]
$ irb --version
irb 0.9.5(05/04/13)

-Rob

Rob Biedenharn http://agileconsultingllc.com
(e-mail address removed)
+1 513-295-4739
Skype: rob.biedenharn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top