Skip to content

agirorn/curl_wrapper

Repository files navigation

Gem Version

#curl wrapper

curl_wrapper is a ruby wraper for the curl command.

install

  gem install curl_wrapper

use

  curl = CurlWrapper.new do |config|
    config.url 'rubygems.org'
  end
  puts curl.body
  curl = CurlWrapper.new do |config|
    config.ntlm
    config.user 'username/password'
    config.request 'POST'
    config.verbose
    config.url 'http://hard_to_automate.sharepoint.com/resource'
  end

  curl.run
  puts curl.error

CurlWrapper is chanable

  puts CurlWrapper.new.url('rubygems.org').run.body
  curl = CurlWrapper.new do |config|
    config.ntlm
    config.user 'username/password'
    config.request 'POST'
  end

  curl.verbose.url 'http://hard_to_automate.sharepoint.com/resource'

  puts curl.run.error

CurlWrapper is autoruns when you need the output

  puts CurlWrapper.new.url('rubygems.org').body
  curl = CurlWrapper.new do |config|
    config.ntlm
    config.user 'username/password'
    config.request 'POST'
  end

  curl.verbose.url 'http://hard_to_automate.sharepoint.com/resource'

  puts curl.error

CurlWrapper just works so you can have fun exploring HTTP

lets just skip new and body and stil get what we want

  puts CurlWrapper.url('rubygems.org')
  curl = CurlWrapper do |config|
    config.ntlm
    config.user 'username/password'
    config.request 'POST'
  end.verbose.url( 'http://hard_to_automate.sharepoint.com/resource' )

  puts curl