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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b76a84a36ad7b6899857eb7f6c7e2f2ac5c248ab
4
- data.tar.gz: 54e0ae9e7890eaf578e23f0d2617962dacfbb280
3
+ metadata.gz: c5d34cc170e9bffad92233a68b9bb0b3eb005c9f
4
+ data.tar.gz: 2c401983218c1e3811c7ab0becb1d94917a21bab
5
5
  SHA512:
6
- metadata.gz: 076d981d13ed9d8001e0c9e5d001b86c3fe99e6f72e4be799c8337675a4d6cf4652cc689ac0e0c3bc2a8844e971262015543fa31987b6cf3085b0ca0529ef0d7
7
- data.tar.gz: fa1f1d12ba8cc57a7510bc0f6e862bd3e7c178cc35d8c6057f032be7c26baba9f6f25c81eb342ec2a23e0dfb308e1448125f45a9eb15cd8ced00888e8cde3ba1
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**.
@@ -14,6 +14,9 @@ module EzWadl
14
14
  add_methods(r)
15
15
  add_resources(r)
16
16
  }
17
+
18
+ yield(top_resources) if block_given?
19
+ top_resources
17
20
  end
18
21
 
19
22
  private
@@ -1,3 +1,3 @@
1
1
  module EzWadl
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
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.1
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 00:00:00.000000000 Z
11
+ date: 2017-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri