WebDAV: Connect Ruby to a WebDAV Server

Discussion in 'Ruby' started by Michael Dichtl, Jul 9, 2007.

  1. 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!

    --
    Posted via http://www.ruby-forum.com/.
     
    Michael Dichtl, Jul 9, 2007
    #1
    1. Advertising

  2. On Mon, Jul 09, 2007 at 10:37:54PM +0900, Michael Dichtl wrote:
    > 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
     
    Gregory Seidman, Jul 9, 2007
    #2
    1. Advertising

  3. 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 Seidman wrote:
    > On Mon, Jul 09, 2007 at 10:37:54PM +0900, Michael Dichtl wrote:
    >> 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



    --
    Posted via http://www.ruby-forum.com/.
     
    Michael Dichtl, Jul 9, 2007
    #3
  4. On Mon, Jul 09, 2007 at 11:29:09PM +0900, Michael Dichtl wrote:
    > 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 Seidman wrote:
    > > On Mon, Jul 09, 2007 at 10:37:54PM +0900, Michael Dichtl wrote:
    > >> 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

    >
    >
    > --
    > Posted via http://www.ruby-forum.com/.
    >
    >
     
    Gregory Seidman, Jul 9, 2007
    #4
  5. Okay I'll try!!

    Thnx for help Greg!!!

    Gregory Seidman wrote:
    > On Mon, Jul 09, 2007 at 11:29:09PM +0900, Michael Dichtl wrote:
    >> 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



    --
    Posted via http://www.ruby-forum.com/.
     
    Michael Dichtl, Jul 9, 2007
    #5
  6. Re: Programming habit

    On Jul 9, 2007, at 10:35 AM, Peter Versteegen wrote:

    > 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
     
    Rob Biedenharn, Jul 9, 2007
    #6
  7. Re: Programming habit

    On Jul 9, 2007, at 9:53 AM, Rob Biedenharn wrote:

    >
    > On Jul 9, 2007, at 10:35 AM, Peter Versteegen wrote:
    >
    >> 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 don't need the gems require line here.

    James Edward Gray II
     
    James Edward Gray II, Jul 9, 2007
    #7
  8. Re: Programming habit

    On Jul 9, 2007, at 12:06 PM, Peter Versteegen wrote:
    > 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

    > On Jul 9, 2007, at 10:53 AM, Rob Biedenharn wrote:
    >
    >>
    >> On Jul 9, 2007, at 10:35 AM, Peter Versteegen wrote:
    >>
    >>> 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
    >>
    >>
    >>
    >>
    >>

    >


    Rob Biedenharn http://agileconsultingllc.com

    +1 513-295-4739
    Skype: rob.biedenharn
     
    Rob Biedenharn, Jul 9, 2007
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Otis Mukinfus
    Replies:
    3
    Views:
    961
    Juan T. Llibre
    Jul 8, 2005
  2. Replies:
    3
    Views:
    40,681
    Roedy Green
    Nov 16, 2005
  3. Replies:
    2
    Views:
    330
  4. Mohsen Pahlevanzadeh

    Qt connect and first connect or unicode

    Mohsen Pahlevanzadeh, Sep 17, 2013, in forum: Python
    Replies:
    3
    Views:
    178
    Mohsen Pahlevanzadeh
    Sep 18, 2013
  5. Mohsen Pahlevanzadeh

    Re: Qt connect and first connect or unicode

    Mohsen Pahlevanzadeh, Sep 17, 2013, in forum: Python
    Replies:
    0
    Views:
    140
    Mohsen Pahlevanzadeh
    Sep 17, 2013
Loading...

Share This Page