restless_router 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b158567792444695560c83c1ebd680047f66872
4
- data.tar.gz: 217a7dff2df135f57c262f26c3cfd6cce35c79f6
3
+ metadata.gz: 5c69fdf41094206bf9aec0551d1cf5fc43e6efe0
4
+ data.tar.gz: 2b6a00897095a22bc9985f179823601af3961c06
5
5
  SHA512:
6
- metadata.gz: 4a742b73a6a25d58eff22511873d0437ece518fd4204e17cd71f9645bad6d1316414c633466bd187df886e6fdda176a2c7c64b2553252854820634b2bd6de4d0
7
- data.tar.gz: 46876075c9750215b33f0b983987c6efbe895c8b68918b4db1f3d0fbe63fc8d80a0809882433a28c54b82f0bf44523e34bdd1cf9ae045b51f91529cf8d444b93
6
+ metadata.gz: 03e5200821d86bbd039df53d3d46696e0ece67b4d000afe0a9ddfe8a25d25108c470adaf1f4cd794b8420920e9aa98b61e2651db2a94c1690a9c267fe24fed1c
7
+ data.tar.gz: 3dbf01e4c68c3fc2428fe58890eb2f036b02b79b1719d90d9319f7bceadaf5786c38d5bb8a031048167c6cec9c4b6823f0b739318a0754ebe110bff928d18381
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # RestlessRouter
2
2
 
3
- [![Build Status](https://travis-ci.org/nateklaiber/restless_router.svg?branch=v0.0.1)](https://travis-ci.org/nateklaiber/restless_router)
3
+ [![Build Status](https://travis-ci.org/nateklaiber/restless_router.svg?branch=master)](https://travis-ci.org/nateklaiber/restless_router)
4
4
 
5
5
  This helps fill the gap where web services only provide their routing
6
6
  via external documentation. In order to prevent URL building scattered
@@ -93,6 +93,10 @@ directory_request = Faraday.get(directory_url)
93
93
  Some APIs may provide hypermedia envelopes and you should use those where
94
94
  available.
95
95
 
96
+ ## Examples
97
+
98
+ I used this in the [`automatic-client`](https://rubygems.org/gems/automatic-client) Gem to handle the small set of available routes. These are defined in the [`Automatic::Client`](https://github.com/nateklaiber/automatic-client/blob/ef58709f93c8abcdaadb16be1eed8ec33989c05f/lib/automatic/client.rb) and available via the `routes` class method.
99
+
96
100
  ## Contributing
97
101
 
98
102
  1. Fork it ( http://github.com/<my-github-username>/restless_router/fork )
@@ -19,7 +19,7 @@ module RestlessRouter
19
19
  #
20
20
  # # With a templated route
21
21
  # route = RestlessRouter::Route.new('search', 'http://example.com/search{?q}', templated: true)
22
- #
22
+ #
23
23
  # route.name
24
24
  # # => 'search'
25
25
  #
@@ -47,6 +47,14 @@ module RestlessRouter
47
47
  @name
48
48
  end
49
49
 
50
+ # Return the specified path of the Route. This
51
+ # is either a fully qualified URL or a URI Template.
52
+ #
53
+ # @return [String] Path of the route
54
+ def path
55
+ @path
56
+ end
57
+
50
58
  # Returns the URL for the route. If it's templated,
51
59
  # then we utilize the provided options hash to expand
52
60
  # the route. Otherwise we return the `path`
@@ -1,3 +1,3 @@
1
1
  module RestlessRouter
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -14,6 +14,10 @@ describe RestlessRouter::Route do
14
14
  expect(subject.name).to eq('home')
15
15
  end
16
16
 
17
+ it "returns the #path" do
18
+ expect(subject.path).to eq('http://www.example.com')
19
+ end
20
+
17
21
  it "returns the #url_for" do
18
22
  expect(subject.url_for).to eq('http://www.example.com')
19
23
  end
@@ -27,7 +31,11 @@ describe RestlessRouter::Route do
27
31
  it "returns the expanded #url_for" do
28
32
  expect(subject.url_for(q: 'search-term')).to eq('http://www.example.com/search?q=search-term')
29
33
  end
30
-
34
+
35
+ it "returns the raw #path" do
36
+ expect(subject.path).to eq('http://www.example.com/search{?q}')
37
+ end
38
+
31
39
  it "returns the expanded #url_for with no expansions" do
32
40
  expect(subject.url_for).to eq('http://www.example.com/search')
33
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restless_router
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nate Klaiber