Skip to content

Instantly share code, notes, and snippets.

@rubiii
rubiii / interfax_example05.rb
Created April 5, 2011 10:10
Savon InterFAX example: Chunked upload to fax
# more examples at:
# https://gist.github.com/903337
require "rubygems"
require "base64"
require "date"
# $ gem install savon (works with v0.9.1 and higher)
require "savon"

sources

app-js/**/*.js.coffee -> public/javascripts/compiled/

rsync -a --filter=P spec --filter=P *.js.map --filter=P *.js --delete -v app-js/ public/javascripts/compiled/

specs

@rubiii
rubiii / tldr.md
Last active December 17, 2015 22:59
Savon 3.0 TL;DR

Savon 3.0 TL;DR

  • It requires Ruby 1.9 or higher.
  • It is based on the all-new Wasabi 4.0 which is the driving factor behind this version. This means, that we now require a WSDL! There's a TL;DR for Wasabi 4.0 as well and you should read it.
  • HTTP caused a lot of problems and questions which this project should not have to deal with at all, so I'm replacing HTTPI with a simple adapter you can overwrite for authentication, cookies, etc. Added benefit: you can also easily swap it out in your tests.
  • Thanks to the new parser, Savon can now create example requests and show you the types to use.
@rubiii
rubiii / tldr.md
Last active December 17, 2015 22:59
Wasabi 4.0 TL;DR

Wasabi 4.0 TL;DR

  • It requires Ruby 1.9 or higher.
  • It is based on specifications and validates against real world WSDL documents.
  • It is way faster than ever before, while now parsing all elements.
  • It properly separates operations by service and port.
  • It supports WSDL and XML Schema imports.
  • It knows the input, output and fault message types.
  • It knows about Arrays of elements.
@rubiii
rubiii / gist:5579521
Created May 14, 2013 21:01
Generating nice graphs with ruby-prof
brew install graphviz
gem install ruby-prof
ruby-prof --mode=wall --printer=dot --file=output.dot fibonacci.rb 25
dot -T pdf -o output.pdf output.dot
open output.pdf
@rubiii
rubiii / 01. before
Last active December 16, 2015 19:19
wasabi down to 0.780356 seconds (real time) for economic
ruby-2.0.0-p0 ~/work/wasabi ‹master*› $ r spec/wasabi/document/economic_spec.rb
MethodProfiler results for: Wasabi::Parser
+------------------------+--------------+--------------+--------------+--------------+-------------+
| Method | Min Time | Max Time | Average Time | Total Time | Total Calls |
+------------------------+--------------+--------------+--------------+--------------+-------------+
| #parse | 34266.854 ms | 34266.854 ms | 34266.854 ms | 34266.854 ms | 1 |
| #parse_operations | 31511.302 ms | 31511.302 ms | 31511.302 ms | 31511.302 ms | 1 |
| #parse_types | 2753.060 ms | 2753.060 ms | 2753.060 ms | 2753.060 ms | 1 |
| #input_for | 8.110 ms | 72.536 ms | 10.037 ms | 30331.155 ms | 3022 |
| #at_xpath | 0.079 ms | 66.416 ms | 1.552 ms | 30851.576 ms | 19882 |
@rubiii
rubiii / smartmover_example.rb
Last active December 15, 2015 11:29
simple example for communicating with the smartmover soap service using savon
# how to:
#
# 1. find the wsdl file (usually available at #{soap_endpoint + '?wsdl'}) like this:
# https://smartmover.melissadata.net/V2b/Smartmover.asmx?wsdl
#
# 2. throw the wsdl at soapUI (get it, it's free: http://www.soapui.org) and create
# a sample request for the 'DoSmartMover' operation.
#
# 3. use the xml type names from the sample request to create a message hash with the
# hash keys matching the xml tag names.
class Class
def to_proc
Proc.new { |string| self.new string }
end
end
%w[a b c].map &String
@rubiii
rubiii / gist:3664985
Created September 7, 2012 10:32
wsdl for savon #315
<wsdl:definitions xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding" xmlns:tns="http://3e.pl/ADInterface" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" targetNamespace="http://3e.pl/ADInterface">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://3e.pl/ADInterface" elementFormDefault="qualified" targetNamespace="http://3e.pl/ADInterface">
<xsd:element name="Window" type="tns:Window"/>
<xsd:complexType name="Window">
<xsd:sequence>
<xsd:element name="Description" type="xsd:string"/>
<xsd:element name="Help" type="xsd:string"/>
<xsd:element name="Tabs" type="tns:TabList"/>
</xsd:sequence>
@rubiii
rubiii / readme.md
Created July 24, 2012 09:15 — forked from phoet/readme.md
Señor Developer Competition at eurucamp 2012

Ever seen these T-Shirts?

Señor Developer T-Shirt

Want one?

Get one for free at eurucamp!

If you are an attendee of eurucamp 2012, you get the chance to win a FREE Señor Developer t-shirt.