smacks-apricoteatsgorilla 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc ADDED
@@ -0,0 +1,55 @@
1
+ = Apricot eats Gorilla
2
+
3
+ Apricot eats Gorilla converts SOAP response messages to Ruby hashes.
4
+ It's based on CobraVsMongoose but uses Hpricot instead of REXML and it
5
+ also doesn't follow the BadgerFish convention.
6
+
7
+ == Install
8
+
9
+ $ sudo gem sources -a http://gems.github.com
10
+ $ sudo gem install smacks-apricoteatsgorilla hpricot
11
+
12
+ == An example
13
+
14
+ Let's assume you receive the following SOAP response message:
15
+
16
+ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
17
+ <soap:Body>
18
+ <ns2:findCustomerByIdResponse xmlns:ns2="http://v1_0.ws.example.com/">
19
+ <return>
20
+ <empty>false</empty>
21
+ <customer>
22
+ <id>449810</id>
23
+ <title xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
24
+ <name>Jungle Julia</name>
25
+ <email>jj@example.com</email>
26
+ <address />
27
+ </customer>
28
+ </return>
29
+ </ns2:findCustomerByIdResponse>
30
+ </soap:Body>
31
+ </soap:Envelope>
32
+
33
+ Just pass in the raw XML string like this:
34
+
35
+ require 'apricoteatsgorilla'
36
+ hash = ApricotEatsGorilla.soap_response_to_hash(xml)
37
+
38
+ And it gets converted into a nice little hash:
39
+
40
+ "empty" => false,
41
+ "customer" => {
42
+ "address" => nil,
43
+ "name" => "Jungle Julia",
44
+ "title" => nil,
45
+ "id" => "449810",
46
+ "email" => "jj@example.com"
47
+ }
48
+
49
+ == The conclusion
50
+
51
+ * It assumes a root node named "return", but you can pass in an XPath
52
+ expession as the second parameter, to define a different root node.
53
+ * All attributes are ignored and won't be included in the hash.
54
+ * The value of empty element nodes will be nil.
55
+ * Values of "true" or "false" will be converted to boolean objects.
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  require 'hpricot'
3
3
 
4
- # ApricotEatsGorilla converts SOAP response messages to Ruby hashes.
4
+ # Apricot eats Gorilla converts SOAP response messages to Ruby hashes.
5
5
  # It's based on CobraVsMongoose but uses Hpricot instead of REXML and it
6
6
  # also doesn't follow the BadgerFish convention.
7
7
  class ApricotEatsGorilla
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smacks-apricoteatsgorilla
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Harrington
@@ -29,10 +29,9 @@ executables: []
29
29
  extensions: []
30
30
 
31
31
  extra_rdoc_files:
32
- - README.markdown
32
+ - README.rdoc
33
33
  files:
34
- - README.markdown
35
- - VERSION.yml
34
+ - README.rdoc
36
35
  - lib/apricoteatsgorilla.rb
37
36
  has_rdoc: true
38
37
  homepage: http://github.com/smacks/apricoteatsgorilla
data/README.markdown DELETED
File without changes
data/VERSION.yml DELETED
@@ -1,4 +0,0 @@
1
- ---
2
- :minor: 1
3
- :patch: 0
4
- :major: 0