Skip to content

Instantly share code, notes, and snippets.

@rubiii
rubiii / savon_instantiation.rb
Created June 6, 2010 19:47
Savon - Instantiating a Savon::Client
# rubygems.org/gems/savon by examples
# overview of examples at: http://gist.github.com/gists/427837
require "savon"
# = Instantiation without a WSDL
#
# Retrieving and parsing the WSDL is a pretty slow operation. And even though it's cached after the first time,
# it's still a pretty slow operation.
#
# When working without a WSDL you have to set the SOAP namespace and endpoint manually. Also Savon does not know
# rubygems.org/gems/savon by examples
# overview of examples at: http://gist.github.com/gists/427837
require "savon"
# HTTP basic authentication
client = Savon::Client.new do
wsdl.location = "http://users.example.com?wsdl"
request.basic_auth "username", "password"
end
@rubiii
rubiii / savon_soap_request.rb
Created June 6, 2010 21:05
Savon - Executing a SOAP request
# rubygems.org/gems/savon by examples
# overview of examples at: http://gist.github.com/gists/427837
require "savon"
todo ...
# rubygems.org/gems/savon by examples
# overview of examples at: http://gist.github.com/gists/427837
require "savon"
# = Instantiation
#
# Savon is based on the Savon::Client object. So the first thing you want to do, is to create a new
# Savon::Client instance. A few examples on using the Savon::Client with or without a WSDL are at:
# http://gist.github.com/427832
client = Savon::Client.new do
# rubygems.org/gems/savon by examples
# overview of examples at: http://gist.github.com/gists/427837
require "savon"
todo ...
GIT/SVN:
add all new files (recursively):
git: svn add .
svn: svn status | grep "^\?" | awk '{print $2}' | xargs svn add
remove all deleted files (recursively):
git: svn add -u
class Symbol
def self.method_added(method)
raise caller.to_s if method == :%
end
end
class Symbol
def %(arg)
self
end
# a cute key/value (web-)store using git and sinatra
# inspiration: "gittin down to the plumbing" by scott chacon
# http://video2010.scottishrubyconference.com/show_video/11/0
get "/:key" do
value = retrieve params[:key]
halt 404 unless $?.success?
value
end
ruby-1.8.7-p302@rails3 ~/work/ruby/savon ‹http_backend*› $ rake --trace
(in /Users/rubiii/work/ruby/savon)
** Invoke default (first_time)
** Invoke spec (first_time)
** Execute spec
/Users/rubiii/.rvm/rubies/ruby-1.8.7-p302/bin/ruby -S /Users/rubiii/.rvm/rubies/ruby-1.8.7-p302/bin/ruby -Ilib -Ispec "./spec/savon/client_spec.rb" "./spec/savon/core_ext/array_spec.rb" "./spec/savon/core_ext/datetime_spec.rb" "./spec/savon/core_ext/hash_spec.rb" "./spec/savon/core_ext/net_http_spec.rb" "./spec/savon/core_ext/object_spec.rb" "./spec/savon/core_ext/string_spec.rb" "./spec/savon/core_ext/symbol_spec.rb" "./spec/savon/core_ext/uri_spec.rb" "./spec/savon/soap/response_spec.rb" "./spec/savon/soap/xml_spec.rb" "./spec/savon/wsdl/document_spec.rb" "./spec/savon/wsse_spec.rb" -fd -c
/Users/rubiii/.rvm/rubies/ruby-1.8.7-p302/bin/ruby:1: Invalid char `\317' in expression
/Users/rubiii/.rvm/rubies/ruby-1.8.7-p302/bin/ruby:1: Invalid char `\372' in expression
/Users/rubiii/.rvm/rubies/ruby-1.8.7-p302/bin/ruby:1: Invalid cha