soaspec 0.2.20 → 0.2.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,65 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>XML Exchange extractors</title>
5
- <meta name="viewport" content="width=device-width, initial-scale=1">
6
- <link rel="stylesheet" href="css/bootstrap.css" type="text/css" charset="utf-8" />
7
- <link rel="stylesheet" href="css/bootstrap-theme.css" type="text/css" charset="utf-8" />
8
- <script src="js/angular.min.js"></script>
9
- <style>
10
- .highlighted {
11
- background: yellow;
12
- }
13
- </style>
14
- </head>
15
- <body>
16
- <div class="container-fluid">
17
- <h1>Extract value(s) from XML response body</h1>
18
- <p>
19
- Demonstrating how to extract information out of a XML response body from an Exchange object
20
- </p>
21
- <div ng-app="codeDemo" ng-controller="extract">
22
- <h2>Sample JSON response body</h2>
23
- <code ng-repeat="item in sampleData | filter:myData[index].highlight"
24
- ng-bind-html="item | highlight:myData[index].highlight">
25
- </code>
26
- <dl>
27
- <dt>Method:</dt>
28
- <dd>
29
- <select ng-model="index">
30
- <option ng-repeat="option in myData" value="{{$index}}">{{option.desc}}
31
- </option>
32
- </select>
33
- </dd>
34
- </dl>
35
- <div>
36
- <dl>
37
- <dt>Code:</dt>
38
- <dd><kbd>{{ myData[index].method }}</kbd></dd>
39
- </dl>
40
- <dl>
41
- <dt>Result:</dt>
42
- <dd><code>{{ myData[index].result }}</code></dd>
43
- </dl>
44
- </div>
45
- </div>
46
- </div>
47
- <script>
48
- var app = angular.module('codeDemo', []);
49
- app.controller('extract', function($scope, $http) {
50
- $http.get("xml_extract.json").then(function(response) {
51
- $scope.myData = response.data.methods;
52
- $scope.sampleData = response.data.sampleData;
53
- });
54
- })
55
- .filter('highlight', function($sce) {
56
- return function(text, phrase) {
57
- if (phrase) text = text.replace(new RegExp('('+phrase+')', 'gi'),
58
- '<span class="highlighted">$1</span>')
59
-
60
- return $sce.trustAsHtml(text)
61
- }
62
- });
63
- </script>
64
- </body>
65
- </html>
@@ -1,46 +0,0 @@
1
- {
2
- "sampleData":
3
- ["&lt;root&gt;\n &lt;parent1&gt;\n &lt;child1&gt;5&lt;/child1&gt;\n&lt;child2&gt;parent1 word&lt;/child2&gt;\n &lt;/parent1&gt;\n &lt;parent2&gt;\n &lt;uniq attr=\"test_atr\"&gt;val&lt;/uniq&gt;\n &lt;child2&gt;word2&lt;/child2&gt;\n &lt;/parent2&gt;\n&lt;/root&gt;" ],
4
- "methods": [
5
- {
6
- "desc": "Get response object",
7
- "method": "@exchange.response",
8
- "result": "# RestClient::Response or Savon::Response object"
9
- },
10
- {
11
- "desc": "Value from unique element",
12
- "method": "@exchange['uniq']",
13
- "result": "'val' # String",
14
- "highlight": "&lt;uniq "
15
- },
16
- {
17
- "desc": "Value via XPath",
18
- "method": "@exchange['//parent1/child2']",
19
- "result": "'parent1 word' # String",
20
- "highlight": "\n&lt;child2&gt;"
21
- },
22
- {
23
- "desc": "Value via first matching XPath",
24
- "method": "@exchange['//parent1/uniq|//parent2/uniq']",
25
- "result": "'val' # String. (First XPath didn't find anything so second was used)",
26
- "highlight": "&lt;uniq "
27
- },
28
- {
29
- "desc": "List of values matching XPath",
30
- "method": "@exchange.values_from_path('//child2')",
31
- "result": "['parent1 word', 'word2'] # Array",
32
- "highlight": "&lt;child2&gt;"
33
- },
34
- {
35
- "desc": "Convert response into hash",
36
- "method": "@exchange.to_hash",
37
- "result": "{\"root\"=>{\"parent1\"=>{\"child1\"=>\"5\", \"child2\"=>\"parent1 word\"}, \"parent2\"=>{\"uniq\"=>\"val\", \"child2\"=>\"word2\"}}} # Hash"
38
- },
39
- {
40
- "desc": "Extract attribute from hash",
41
- "method": "@exchange.to_hash.dig(:root, :parent2, :uniq).attributes['attr']",
42
- "result": "'test_atr' # String",
43
- "highlight": "attr"
44
- }
45
- ]
46
- }
Binary file
@@ -1,22 +0,0 @@
1
- {
2
- "glossary": {
3
- "title": "example glossary",
4
- "GlossDiv": {
5
- "title": "<%= test_values[:gloss_title] || 'Gloss' %>",
6
- "GlossList": {
7
- "GlossEntry": {
8
- "ID": "SGML",
9
- "SortAs": "SGML",
10
- "GlossTerm": "Standard Generalized Markup Language",
11
- "Acronym": "SGML",
12
- "Abbrev": "ISO 8879:1986",
13
- "GlossDef": {
14
- "para": "A meta-markup language, used to create markup languages such as DocBook.",
15
- "GlossSeeAlso": ["GML", "XML"]
16
- },
17
- "GlossSee": "markup"
18
- }
19
- }
20
- }
21
- }
22
- }
@@ -1,7 +0,0 @@
1
- <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://thomas-bayer.com/blz/" xmlns:env="http://www.w3.org/2003/05/soap-envelope">
2
- <env:Body>
3
- <tns:getBank>
4
- <tns:blz><%= test_values[:blz] || '70070010' %></tns:blz>
5
- </tns:getBank>
6
- </env:Body>
7
- </env:Envelope>