shapeable 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/shapeable.rb +3 -2
- data/lib/shapeable/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: d6bf89f4b033d1bad264640bad6be1eea9177632
|
4
|
+
data.tar.gz: d937e75bd1809bd54fd5cebc50a369dd5742dbb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6277596c7f1b4d7e14a2657090e5294545f4b84d219f77b2b5f74bc1cdb0c370d3ed504393c84aeb20cf600f128ec7aba924bb2aae05aef68359301d95c831f2
|
7
|
+
data.tar.gz: 9399faab9a860b95bc83cf8b048a11590db088630630a35dfed0d4287c827d85fccacf4a9833e6610566b6678b515dbe119c7f1e845badf57ddfe40cdb68f575
|
data/lib/shapeable.rb
CHANGED
@@ -17,12 +17,13 @@ module Shapeable
|
|
17
17
|
raise ArgumentError, "specify a path" unless path
|
18
18
|
resource = path.name.split('::').last.constantize
|
19
19
|
if request.accept
|
20
|
-
|
20
|
+
version_str = request.accept[/version\s?=\s?(\d+)/, 1]
|
21
|
+
version = version_str.nil? ? default_version : version_str.to_i
|
21
22
|
shape = request.accept[/shape\s?=\s?(\w+)/, 1] || default_shape
|
22
23
|
begin
|
23
24
|
serializer = path.const_get("V#{version}").const_get("#{resource}#{shape.camelize}Serializer")
|
24
25
|
rescue NameError
|
25
|
-
raise InvalidShapeError,
|
26
|
+
raise InvalidShapeError, "Invalid shape. Tried to find version #{version} with shape #{shape}"
|
26
27
|
end
|
27
28
|
end
|
28
29
|
serializer
|
data/lib/shapeable/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shapeable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shawn O'Mara
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-04-
|
12
|
+
date: 2016-04-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|