grape-hypertext_application_language 0.1.1 → 0.1.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.
- checksums.yaml +4 -4
- data/.gitignore +5 -0
- data/Gemfile.lock +2 -2
- data/grape-hypertext_application_language.gemspec +1 -1
- data/lib/grape/formatter/hal/json.rb +5 -3
- 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: 0a2d086d0dfd63bb07696c1a7cdb4ca7f7a59a02
|
|
4
|
+
data.tar.gz: 5c0ff4939cac33e3b30280e2fb3a10dd216dcf97
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0902df0e5337c4de29cd437909cd24ab2be0d3b1be14c4ae0363dfa64cbe0923c7e060219d8f9ce93c6ecbdfcb1e08daa93cf956309c802396b5e8bdd3512c74
|
|
7
|
+
data.tar.gz: d281a8e7d306cbff3f4bef2ab83e98dd8cfdac0b409f9937a2946e997ca9064e18b0d94c27c549c1fb62b74201d05c655969a27047fd34bc9e6f47332fcd3445
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
grape-hypertext_application_language (0.1.
|
|
4
|
+
grape-hypertext_application_language (0.1.2)
|
|
5
5
|
addressable
|
|
6
6
|
grape
|
|
7
7
|
hypertext_application_language
|
|
@@ -42,7 +42,7 @@ GEM
|
|
|
42
42
|
ice_nine (0.11.1)
|
|
43
43
|
json (1.8.3)
|
|
44
44
|
json (1.8.3-java)
|
|
45
|
-
minitest (5.8.
|
|
45
|
+
minitest (5.8.3)
|
|
46
46
|
multi_json (1.11.2)
|
|
47
47
|
multi_xml (0.5.5)
|
|
48
48
|
rack (1.6.4)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |spec|
|
|
2
2
|
spec.name = 'grape-hypertext_application_language'
|
|
3
|
-
spec.version = '0.1.
|
|
3
|
+
spec.version = '0.1.2'
|
|
4
4
|
spec.summary = %q{Grape extensions for Hypertext Application Language}
|
|
5
5
|
spec.description = %q{}
|
|
6
6
|
spec.homepage = 'http://stateless.co/hal_specification.html'
|
|
@@ -28,16 +28,18 @@ module Grape::Formatter::Hal
|
|
|
28
28
|
# representation conforming to a HAL collection where the collection
|
|
29
29
|
# representation includes links to the elements in the collection as well as
|
|
30
30
|
# embedding the nested resources. Uses the request path for the self link;
|
|
31
|
-
# and uses the
|
|
31
|
+
# and uses the last element of the path as the relation. Uses duck typing to
|
|
32
|
+
# determine if the body is an array or not. If the body responds to +each+
|
|
33
|
+
# then it assumes that the response is some kind of enumeration.
|
|
32
34
|
def self.call(body, env)
|
|
33
35
|
unless body.is_a?(HypertextApplicationLanguage::Representation)
|
|
34
|
-
if body.respond_to?(:
|
|
36
|
+
if body.respond_to?(:each)
|
|
35
37
|
representation = HypertextApplicationLanguage::Representation.new
|
|
36
38
|
|
|
37
|
-
rel = env['PATH_INFO'][1..-1]
|
|
38
39
|
href = env['REQUEST_PATH']
|
|
39
40
|
representation.with_link(HypertextApplicationLanguage::Link::SELF_REL, href)
|
|
40
41
|
|
|
42
|
+
rel = env['PATH_INFO'].split('/').last
|
|
41
43
|
body.each do |resource|
|
|
42
44
|
continue unless resource.respond_to?(:to_hal)
|
|
43
45
|
resource_representation = resource.to_hal(env: env)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: grape-hypertext_application_language
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Roy Ratcliffe
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-11-
|
|
11
|
+
date: 2015-11-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: grape
|