revelry_data 0.1.0 → 0.1.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55c03a14c51d268e7e79e5713cbb0f4e4e2b841e
|
4
|
+
data.tar.gz: 1e1d27d86af47a6a57d0d4cfdce5ad969d130ca7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a01b17b244cc8d92169fe950f04b1657bada082dc0ea5f3d777c1b02da54366a94b325add49acf86cd048b039380d7037c69e8628aade10fde163494947fcfb5
|
7
|
+
data.tar.gz: ec411e645522147c231fc9e136e3ebedc7fef3601175e475d9ce654f5531f421bcacebbbb3701f95042a2b10ef5b6dba1f8101df32a67134693eeb1c2f6d9465
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# This exists because JSON API Resources won't let you route to 'new' or 'edit'
|
2
|
+
# and clobbers the value of the :except param to jsonapi_resources
|
3
|
+
# In order to support new and edit forms we have to patch these routing helpers
|
4
|
+
# for now
|
5
|
+
module ActionDispatch
|
6
|
+
module Routing
|
7
|
+
class Mapper
|
8
|
+
Resources.class_eval do
|
9
|
+
def jsonapi_resource(*resources, &_block)
|
10
|
+
@resource_type = resources.first
|
11
|
+
res = JSONAPI::Resource.resource_for(resource_type_with_module_prefix(@resource_type))
|
12
|
+
|
13
|
+
options = resources.extract_options!.dup
|
14
|
+
options[:controller] ||= @resource_type
|
15
|
+
options.merge!(res.routing_resource_options)
|
16
|
+
options[:path] = format_route(@resource_type)
|
17
|
+
|
18
|
+
resource @resource_type, options do
|
19
|
+
@scope[:jsonapi_resource] = @resource_type
|
20
|
+
|
21
|
+
if block_given?
|
22
|
+
yield
|
23
|
+
else
|
24
|
+
jsonapi_relationships
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def jsonapi_resources(*resources, &_block)
|
30
|
+
@resource_type = resources.first
|
31
|
+
res = JSONAPI::Resource.resource_for(resource_type_with_module_prefix(@resource_type))
|
32
|
+
|
33
|
+
options = resources.extract_options!.dup
|
34
|
+
options[:controller] ||= @resource_type
|
35
|
+
options.merge!(res.routing_resource_options)
|
36
|
+
|
37
|
+
options[:param] = :id
|
38
|
+
|
39
|
+
options[:path] = format_route(@resource_type)
|
40
|
+
|
41
|
+
if res.resource_key_type == :uuid
|
42
|
+
options[:constraints] = {id: /[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}(,[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})*/}
|
43
|
+
end
|
44
|
+
|
45
|
+
resources @resource_type, options do
|
46
|
+
@scope[:jsonapi_resource] = @resource_type
|
47
|
+
|
48
|
+
if block_given?
|
49
|
+
yield
|
50
|
+
else
|
51
|
+
jsonapi_relationships
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/lib/revelry_data/version.rb
CHANGED
data/lib/revelry_data.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: revelry_data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Prehn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -127,8 +127,10 @@ files:
|
|
127
127
|
- lib/revelry_data.rb
|
128
128
|
- lib/revelry_data/engine.rb
|
129
129
|
- lib/revelry_data/jsonapi_resources_patch.rb
|
130
|
+
- lib/revelry_data/jsonapi_resources_routing_patch.rb
|
130
131
|
- lib/revelry_data/resource_controller_concern.rb
|
131
132
|
- lib/revelry_data/version.rb
|
133
|
+
- lib/revelry_data/version.rb.orig
|
132
134
|
- lib/tasks/revelry_data_tasks.rake
|
133
135
|
- spec/dummy/README.rdoc
|
134
136
|
- spec/dummy/Rakefile
|