rocket_shorts 0.0.1 → 0.0.2
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.
- data/README.md +3 -3
- data/lib/rocket_shorts/routing_constraints.rb +5 -7
- data/lib/rocket_shorts/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# RocketShorts
|
|
2
2
|
|
|
3
|
-
This is an extension or set of overrides that
|
|
3
|
+
This is an extension or set of overrides that sits on top of [RocketPants](https://github.com/filtersquad/rocket_pants). This is not an elegant extension by any means, but rather a set of modules that leverage the RocketPants load order to monkey-patch functionality.
|
|
4
4
|
|
|
5
5
|
## Why RocketShorts over RocketPants?
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ There are a few differentiators: (neither is the 'right way', its personal prefe
|
|
|
11
11
|
1. Version control is done through the `Accept` HTTP Header instead of a `:version` parameter.
|
|
12
12
|
2. Support for a default version. Making HTTP testing possible for a single version.
|
|
13
13
|
3. Pagination should use the `link` HTTP Header and not the content body.
|
|
14
|
-
4. Clean up the payload body to avoid nesting under a `
|
|
14
|
+
4. Clean up the payload body to avoid nesting under a `response` JSON key.
|
|
15
15
|
|
|
16
16
|
## Installation
|
|
17
17
|
|
|
@@ -36,7 +36,7 @@ your API should look for.
|
|
|
36
36
|
|
|
37
37
|
```ruby
|
|
38
38
|
# config/initializers/rocket_shorts.rb
|
|
39
|
-
require '
|
|
39
|
+
require 'rocket_shorts'
|
|
40
40
|
|
|
41
41
|
RocketShorts.header_format = /application\/vnd\.yourcompany\.v/
|
|
42
42
|
```
|
|
@@ -7,13 +7,11 @@ module RocketShorts
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def matches?(req)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
# @default || req.headers['Accept'].match(/#{RocketShorts.header_format}#{@version}/)
|
|
16
|
-
# end
|
|
10
|
+
if @versions.present?
|
|
11
|
+
@default || req.headers['Accept'].match(/#{RocketShorts.header_format}#{@versions}/)
|
|
12
|
+
else
|
|
13
|
+
@default || req.headers['Accept'].match(/#{RocketShorts.header_format}#{@version}/)
|
|
14
|
+
end
|
|
17
15
|
end
|
|
18
16
|
end
|
|
19
17
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rocket_shorts
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -111,7 +111,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
111
111
|
version: '0'
|
|
112
112
|
segments:
|
|
113
113
|
- 0
|
|
114
|
-
hash:
|
|
114
|
+
hash: 2961342983602430356
|
|
115
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
116
|
none: false
|
|
117
117
|
requirements:
|
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
120
120
|
version: '0'
|
|
121
121
|
segments:
|
|
122
122
|
- 0
|
|
123
|
-
hash:
|
|
123
|
+
hash: 2961342983602430356
|
|
124
124
|
requirements: []
|
|
125
125
|
rubyforge_project:
|
|
126
126
|
rubygems_version: 1.8.23
|