Sha256: f1c1f7c469a709870bed2cb4184b90e486384dc57012a380dcc1bccbe2749236

Contents?: true

Size: 1.49 KB

Versions: 2

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

2 entries across 2 versions & 1 rubygems

Version Path
smacks-apricoteatsgorilla-0.3.3 README.rdoc
smacks-apricoteatsgorilla-0.3.31 README.rdoc