Sha256: 3366ceabf457e9c4925ade13029eee7cb522af5f64d2e1611661a8786f2b0a3c
Contents?: true
Size: 1.49 KB
Versions: 8
Compression:
Stored size: 1.49 KB
Contents
= Apricot eats Gorilla Apricot eats Gorilla is a SOAP communication helper. It translates between SOAP response messages (XML) and Ruby Hashes and may be used to build a SOAP request envelope. It is based on CobraVsMongoose but uses Hpricot instead of REXML and doesn't follow the BadgerFish convention. == Install $ gem install smacks-apricoteatsgorilla -s http://gems.github.com == Dependencies hpricot 0.6.164 (also available for JRuby) == How to use === xml_to_hash(xml, root_node = nil) xml = '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:authenticateResponse xmlns:ns2="http://v1_0.ws.example.com/"> <return> <authValue> <token>secret</token> <client>example</client> </authValue> </return> </ns2:authenticateResponse> </soap:Body> </soap:Envelope>' ApricotEatsGorilla[xml, "//return"] # => { :auth_value => { :token => "secret", :client => "example" } } === hash_to_xml(hash) hash = { :apricot => { :eats => "Gorilla" } } ApricotEatsGorilla[hash] # => "<apricot><eats>Gorilla</eats></apricot>" === soap_envelope(namespaces = {}) ApricotEatsGorilla.soap_envelope { "<authenticate>me</authenticate>" } # => '<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"> # => <env:Body> # => <authenticate>me</authenticate> # => </env:Body> # => </env:Envelope>' == More examples Please take a look at the tests for some more examples.
Version data entries
8 entries across 8 versions & 1 rubygems