ezwadl 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +44 -0
- data/lib/ezwadl/parser.rb +3 -0
- data/lib/ezwadl/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5d34cc170e9bffad92233a68b9bb0b3eb005c9f
|
4
|
+
data.tar.gz: 2c401983218c1e3811c7ab0becb1d94917a21bab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bb5f2efde3e09907ea200c7f77cf06cd36e3952706e8c94f1e9c122faf9128e4d4c4a748746942d11f62a047f92b716b37728e927d878e2ce2cd28edfb52d6f
|
7
|
+
data.tar.gz: 908f9b1de2feec8314bd36edb6e3c3b37590159301f485edb3b4bbbf9ad9a302f38b33e48a1f5c0c561594bc9a56bccce866955c6dfcdb98f4728a87e54c4885
|
data/README.md
CHANGED
@@ -14,6 +14,16 @@ Example:
|
|
14
14
|
resources = EzWadl::Parser.parse('path_to_wadl_file')
|
15
15
|
```
|
16
16
|
|
17
|
+
You can also pass a block to modify the returned resources.
|
18
|
+
|
19
|
+
Example:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
EzWadl::Parser.parse('path_to_wadl_file') do |rs|
|
23
|
+
rs.first.path = 'https://mycustompath.com'
|
24
|
+
end
|
25
|
+
```
|
26
|
+
|
17
27
|
### Accessing a Specific URI
|
18
28
|
|
19
29
|
EzWadl::Resource provides a handful of useful instance methods to help you navigate to the desired URI.
|
@@ -23,6 +33,40 @@ EzWadl::Resource provides a handful of useful instance methods to help you navig
|
|
23
33
|
* path: Returns a String of the path segment for this resource
|
24
34
|
* paths: Returns an Array containing an Array for each child resource consisting of the URI String of the child resource as well as the Symbol for the function that returns the EzWadl::Resource for the child resource.
|
25
35
|
|
36
|
+
Example:
|
37
|
+
|
38
|
+
test.wadl ([source](http://www.nurkiewicz.com/2012/01/gentle-introduction-to-wadl-in-java.html))
|
39
|
+
```xml
|
40
|
+
<application xmlns="http://wadl.dev.java.net/2009/02">
|
41
|
+
<resources base="http://example.com/api">
|
42
|
+
<resource path="books">
|
43
|
+
<method name="GET"/>
|
44
|
+
<resource path="{bookId}">
|
45
|
+
<param required="true" style="template" name="bookId"/>
|
46
|
+
<method name="GET"/>
|
47
|
+
</resource>
|
48
|
+
</resource>
|
49
|
+
</resources>
|
50
|
+
</application>
|
51
|
+
```
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
# Parse the WADL file
|
55
|
+
resources = EzWadl::Parser.parse('test.wadl')
|
56
|
+
|
57
|
+
# See what paths/resources are available
|
58
|
+
resources.first.paths # [["books", :books]]
|
59
|
+
|
60
|
+
# Access the "books" resource
|
61
|
+
resources.first.books
|
62
|
+
|
63
|
+
# See what nested paths/resources are available from "books"
|
64
|
+
resources.first.books.paths # [["{bookId}", :bookId]]
|
65
|
+
|
66
|
+
# Access the nested "bookId" resource
|
67
|
+
resources.first.books.bookId
|
68
|
+
```
|
69
|
+
|
26
70
|
### Performing Actions Against a URI
|
27
71
|
|
28
72
|
Once you have the EzWadl::Resource for the URI you want to use, call the function named after the desired HTTP verb, ie. resource.get. **NOTE: Only GET requests have been tested**.
|
data/lib/ezwadl/parser.rb
CHANGED
data/lib/ezwadl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ezwadl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Clement
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|