decent_exposure 2.3.1 → 2.3.2

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: 9722fc0ed5a4c4b217a0b10579f7164768046372
4
- data.tar.gz: 55f47a182884af1156416dd6747de0d3dec0b139
3
+ metadata.gz: 59daad26b040429c39340077d68a9753fefc543a
4
+ data.tar.gz: ce543a6c78985aec63845da5cd738873937ffe72
5
5
  SHA512:
6
- metadata.gz: c92c4720690ef3d66fdf7084f7abedf2edda56fddc90e5c6232089a7ea06affb612ed2ebc3be125b1c70ef7d63cbe9183589e6a5b9314bc908797ecab5471991
7
- data.tar.gz: b5aec6de47e0733e094d8c35272fdc9066c344bd4bda227f20d0ce0dc0b6c22a9fac8321da1fd50355bd6fdab7f334b139f7bd613b812809fcebf3d57ce09f34
6
+ metadata.gz: 95fe5b72308c242c0fa01f43ff5b4fd28589d4a43ba5f9c92c76167eece5b4f191241982e2fe349fb141b825a0fadcfd0914e6b483015e2f5fc81690abba3b19
7
+ data.tar.gz: 0764cc518b2dbe9b0f66a6438194e5aac0cce7ff263ce2380cde437a38d329d2e7d23ec9eabd45a6c53b549951b0cbb7859d95df196afd18d582b1154ca08307
@@ -4,7 +4,7 @@ require 'active_support/core_ext/module/delegation'
4
4
  module DecentExposure
5
5
  class ActiveRecordStrategy < Strategy
6
6
  delegate :plural?, :parameter, :to => :inflector
7
- delegate :get?, :delete?, :to => :request
7
+ delegate :get?, :delete?, :post?, :put?, :patch?, :to => :request
8
8
 
9
9
  def singular?
10
10
  !plural?
@@ -48,11 +48,11 @@ module DecentExposure
48
48
  end
49
49
 
50
50
  def id
51
- params[parameter] || params[finder_parameter]
52
- end
53
-
54
- def finder_parameter
55
- options[:finder_parameter] || :id
51
+ if finder_parameter = options[:finder_parameter]
52
+ params[finder_parameter]
53
+ else
54
+ params[parameter] || params[:id]
55
+ end
56
56
  end
57
57
 
58
58
  def singular_resource
@@ -7,7 +7,7 @@ module DecentExposure
7
7
  end
8
8
 
9
9
  def assign_attributes?
10
- singular? && !get? && !delete? && attributes.present?
10
+ singular? && (post? || put? || patch?) && attributes.present?
11
11
  end
12
12
 
13
13
  def resource
@@ -7,7 +7,7 @@ module DecentExposure
7
7
 
8
8
  def assign_attributes?
9
9
  return false unless attributes && singular?
10
- (!get? && !delete?) || new_record?
10
+ post? || put? || patch? || new_record?
11
11
  end
12
12
 
13
13
  def new_record?
@@ -1,3 +1,3 @@
1
1
  module DecentExposure #:nodoc
2
- VERSION = "2.3.1"
2
+ VERSION = "2.3.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decent_exposure
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Caudill
@@ -10,62 +10,62 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-01-30 00:00:00.000000000 Z
13
+ date: 2014-05-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ~>
19
+ - - "~>"
20
20
  - !ruby/object:Gem::Version
21
21
  version: '2.11'
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - ~>
26
+ - - "~>"
27
27
  - !ruby/object:Gem::Version
28
28
  version: '2.11'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rspec-rails
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ~>
33
+ - - "~>"
34
34
  - !ruby/object:Gem::Version
35
35
  version: '2.11'
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ~>
40
+ - - "~>"
41
41
  - !ruby/object:Gem::Version
42
42
  version: '2.11'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: actionpack
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: 3.1.0
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - '>='
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  version: 3.1.0
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: activesupport
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - '>='
61
+ - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: 3.1.0
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - '>='
68
+ - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: 3.1.0
71
71
  description: "\n DecentExposure helps you program to an interface, rather than
@@ -79,6 +79,8 @@ executables: []
79
79
  extensions: []
80
80
  extra_rdoc_files: []
81
81
  files:
82
+ - README.md
83
+ - lib/decent_exposure.rb
82
84
  - lib/decent_exposure/active_record_strategy.rb
83
85
  - lib/decent_exposure/active_record_with_eager_attributes_strategy.rb
84
86
  - lib/decent_exposure/configuration.rb
@@ -93,30 +95,28 @@ files:
93
95
  - lib/decent_exposure/strategy.rb
94
96
  - lib/decent_exposure/strong_parameters_strategy.rb
95
97
  - lib/decent_exposure/version.rb
96
- - lib/decent_exposure.rb
97
- - README.md
98
98
  homepage: http://github.com/voxdolo/decent_exposure
99
99
  licenses:
100
100
  - WTFPL
101
101
  metadata: {}
102
102
  post_install_message:
103
103
  rdoc_options:
104
- - --charset=UTF-8
104
+ - "--charset=UTF-8"
105
105
  require_paths:
106
106
  - lib
107
107
  required_ruby_version: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - '>='
109
+ - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
112
  required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - '>='
114
+ - - ">="
115
115
  - !ruby/object:Gem::Version
116
116
  version: 1.3.6
117
117
  requirements: []
118
118
  rubyforge_project:
119
- rubygems_version: 2.0.3
119
+ rubygems_version: 2.2.2
120
120
  signing_key:
121
121
  specification_version: 4
122
122
  summary: A helper for creating declarative interfaces in controllers