deep_unrest 0.1.5 → 0.1.6

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: 0cbcad9bd5ad113da59e1f8590695631ca23b6b4
4
- data.tar.gz: b3b7d09394d01662f09bddb26be968624de2b4fc
3
+ metadata.gz: 06c3e91ce0d55f72657cbbc336204ee4e9892d55
4
+ data.tar.gz: 94d86685379dd5dd778234d59d0d46973e774b6d
5
5
  SHA512:
6
- metadata.gz: 122f06b02cb3267e0750a25c8e02c5630bd5357544636d86a685d2a35644027c6222e9e6fbc7f92aaa8ffebd902c24d1cc0244c27541fea16e79a1132abf4863
7
- data.tar.gz: 8b9e2e3aff5ac8f76078a5312d28cbcbbecb4ed1bcef1ea4160e0a118cf64e6c71a5cebf0d2ceb60d148b26f200a92ab47fbe49d1d817fa51c2795c8adede97a
6
+ metadata.gz: 240d5d75be4343f354d1255ecc8eb1a0f3a5218b5162c433e2260677c44d7407bc62309e0f7b2a3b5469a2ea27a3834758eef6a31c88f6cc2b9f3c90fe1b0ee0
7
+ data.tar.gz: e50e934116f6095b25b8dea4f3139bc4c203c4f3999b1b622fb329bab0df0c234ceca63fe5050523133b7e518ecb5d73fc78beb213f05a6fdae3113ceae7d6d2
@@ -1,7 +1,6 @@
1
1
  module DeepUnrest
2
- class ApplicationController < ActionController::Base
2
+ class ApplicationController < ActionController::API
3
3
  include DeepUnrest.authentication_concern
4
- protect_from_forgery with: :null_session
5
4
 
6
5
  def context
7
6
  { current_user: current_user }
data/lib/deep_unrest.rb CHANGED
@@ -46,7 +46,7 @@ module DeepUnrest
46
46
 
47
47
  def self.get_scope_type(id, last, destroy)
48
48
  case id
49
- when /^\[\w+\]$/
49
+ when /^\[[\w+\-]+\]$/
50
50
  :create
51
51
  when /^\.\w+$/
52
52
  if last
@@ -74,7 +74,7 @@ module DeepUnrest
74
74
  end
75
75
 
76
76
  def self.temp_id?(str)
77
- /^\[\w+\]$/.match(str)
77
+ /^\[[\w+\-]+\]$/.match(str)
78
78
  end
79
79
 
80
80
  def self.plural?(s)
@@ -117,7 +117,7 @@ module DeepUnrest
117
117
  end
118
118
 
119
119
  def self.parse_path(path)
120
- rx = /(?<type>\w+)(?<id>(?:\[|\.)[\w+\*\]]+)/
120
+ rx = /(?<type>\w+)(?<id>(?:\[|\.)[\w+\-\*\]]+)/
121
121
  result = path.scan(rx)
122
122
  unless result.map { |res| res.join('') }.join('.') == path
123
123
  raise InvalidPath, "Invalid path: #{path}"
@@ -341,7 +341,7 @@ module DeepUnrest
341
341
  end
342
342
 
343
343
  def self.parse_error_path(key)
344
- rx = /(((^|\.)(?<type>[^\.\[]+)(?:\[(?<idx>\d+)\])\.)?(?<field>[\w\.]+)$)/
344
+ rx = /(((^|\.)(?<type>[^\.\[]+)(?:\[(?<idx>\d+)\])\.)?(?<field>[\w\-\.]+)$)/
345
345
  rx.match(key)
346
346
  end
347
347
 
@@ -422,4 +422,3 @@ module DeepUnrest
422
422
  raise Conflict, formatted_errors.to_json unless formatted_errors.empty?
423
423
  end
424
424
  end
425
-
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeepUnrest
4
- VERSION = '0.1.5'
4
+ VERSION = '0.1.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deep_unrest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lynn Hurley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-24 00:00:00.000000000 Z
11
+ date: 2017-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails