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: 941b631f89ccb04d292163dd7fc343f30b4d1c26
4
- data.tar.gz: 0cd2218849f1704da95160d678c246168c287a4f
3
+ metadata.gz: 55c03a14c51d268e7e79e5713cbb0f4e4e2b841e
4
+ data.tar.gz: 1e1d27d86af47a6a57d0d4cfdce5ad969d130ca7
5
5
  SHA512:
6
- metadata.gz: 02747c0200c3a7f0989768a819390f2d7b38a2bb396a0af4e801f2a519aaf2bc44e90174cf8c3808558f6eca30bb69961125c5ede1ee5753d5e262b83ab4a547
7
- data.tar.gz: a867a944244f160f78c1bec9fc7a18f3acd6db77fafdb84003dc3cf73e97233cbafa82522413db2f98be6f101188f2d249572407537021c80780242c758b841d
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
@@ -1,3 +1,3 @@
1
1
  module RevelryData
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -0,0 +1,7 @@
1
+ module RevelryData
2
+ <<<<<<< HEAD
3
+ VERSION = "0.1.0"
4
+ =======
5
+ VERSION = "0.0.10"
6
+ >>>>>>> v0.0.10
7
+ end
data/lib/revelry_data.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "revelry_core"
2
2
  require "jsonapi-resources"
3
3
  require "revelry_data/jsonapi_resources_patch"
4
+ require "revelry_data/jsonapi_resources_routing_patch"
4
5
  require "revelry_data/resource_controller_concern"
5
6
  require "revelry_data/engine"
6
7
 
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.0
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-13 00:00:00.000000000 Z
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