json_apiable 0.4 → 0.4.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
  SHA256:
3
- metadata.gz: 87003258543205a662a1a5963258ad69746fee6b5813a52a35cb604c7481488a
4
- data.tar.gz: 13bc1aaeb033f6200a165f3b4d2878fd01a6478b0aa8c4348c455ea912929dfc
3
+ metadata.gz: d7f8ca1f3bf0021a5b326f69c09fa891813c63da56824acafb67f5edf22b8cc6
4
+ data.tar.gz: 13c3c4b1e542b688241eaf73be98e35d35c0d712ce552d77243cf958fdce3d34
5
5
  SHA512:
6
- metadata.gz: 6b0a0a5be9cf7c2b43cd4a8cdb3a6cb9b68064cc5c97735c620e215a15cde00655243a8442b35d11a72c63664a3dce7e44d89abf444711e5ec5adf80941eaabb
7
- data.tar.gz: 9968c847fbabe70821f12dc4ab991ae6ff1d3f1a197a9daae016e427a624a39b5e88ff18f15e8906b78e4d408b466c703103afd7de12acb5aa8548c5f92b77a2
6
+ metadata.gz: 941b661ae943c9e6b5344be482740356f78ee75393ed334ddf97516ba5f08bc821252ae34fa3d33d2142366b779095aebe7f8e8600280ffa9ce22acb3eded9a1
7
+ data.tar.gz: 66f37012eb785a178d5dd2c14979f3296f3818c8b86f940c33b1d6269fa8b5350a1dab1de9993e61c366f98251542870afe66f5ed42bcd56569951ecd3c3395c
@@ -65,10 +65,10 @@ GEM
65
65
  tzinfo (~> 1.1)
66
66
  zeitwerk (~> 2.2)
67
67
  builder (3.2.4)
68
- byebug (11.0.1)
68
+ byebug (11.1.1)
69
69
  coderay (1.1.2)
70
- concurrent-ruby (1.1.5)
71
- crass (1.0.5)
70
+ concurrent-ruby (1.1.6)
71
+ crass (1.0.6)
72
72
  diff-lcs (1.3)
73
73
  erubi (1.9.0)
74
74
  factory_bot (5.1.1)
@@ -76,15 +76,15 @@ GEM
76
76
  factory_bot_rails (5.1.1)
77
77
  factory_bot (~> 5.1.0)
78
78
  railties (>= 4.2.0)
79
- faker (2.9.0)
80
- i18n (>= 1.6, < 1.8)
79
+ faker (2.10.2)
80
+ i18n (>= 1.6, < 2)
81
81
  fast_jsonapi (1.5)
82
82
  activesupport (>= 4.2)
83
83
  globalid (0.4.2)
84
84
  activesupport (>= 4.2.0)
85
- i18n (1.7.0)
85
+ i18n (1.8.3)
86
86
  concurrent-ruby (~> 1.0)
87
- loofah (2.4.0)
87
+ loofah (2.6.0)
88
88
  crass (~> 1.0.2)
89
89
  nokogiri (>= 1.5.9)
90
90
  mail (2.7.1)
@@ -92,20 +92,20 @@ GEM
92
92
  marcel (0.3.3)
93
93
  mimemagic (~> 0.3.2)
94
94
  method_source (0.9.2)
95
- mimemagic (0.3.3)
95
+ mimemagic (0.3.5)
96
96
  mini_mime (1.0.2)
97
97
  mini_portile2 (2.4.0)
98
- minitest (5.13.0)
98
+ minitest (5.14.1)
99
99
  nio4r (2.5.2)
100
- nokogiri (1.10.7)
100
+ nokogiri (1.10.9)
101
101
  mini_portile2 (~> 2.4.0)
102
102
  pry (0.12.2)
103
103
  coderay (~> 1.1.0)
104
104
  method_source (~> 0.9.0)
105
- pry-byebug (3.7.0)
105
+ pry-byebug (3.8.0)
106
106
  byebug (~> 11.0)
107
107
  pry (~> 0.10)
108
- rack (2.0.8)
108
+ rack (2.2.3)
109
109
  rack-test (1.1.0)
110
110
  rack (>= 1.0, < 3)
111
111
  rails (6.0.2.1)
@@ -138,13 +138,13 @@ GEM
138
138
  method_source
139
139
  rake (>= 0.8.7)
140
140
  thor (>= 0.20.3, < 2.0)
141
- rake (10.5.0)
142
- rspec-core (3.9.0)
143
- rspec-support (~> 3.9.0)
141
+ rake (13.0.1)
142
+ rspec-core (3.9.1)
143
+ rspec-support (~> 3.9.1)
144
144
  rspec-expectations (3.9.0)
145
145
  diff-lcs (>= 1.2.0, < 2.0)
146
146
  rspec-support (~> 3.9.0)
147
- rspec-mocks (3.9.0)
147
+ rspec-mocks (3.9.1)
148
148
  diff-lcs (>= 1.2.0, < 2.0)
149
149
  rspec-support (~> 3.9.0)
150
150
  rspec-rails (3.9.0)
@@ -155,7 +155,7 @@ GEM
155
155
  rspec-expectations (~> 3.9.0)
156
156
  rspec-mocks (~> 3.9.0)
157
157
  rspec-support (~> 3.9.0)
158
- rspec-support (3.9.0)
158
+ rspec-support (3.9.2)
159
159
  sprockets (4.0.0)
160
160
  concurrent-ruby (~> 1.0)
161
161
  rack (> 1, < 3)
@@ -166,12 +166,12 @@ GEM
166
166
  sqlite3 (1.4.2)
167
167
  thor (1.0.1)
168
168
  thread_safe (0.3.6)
169
- tzinfo (1.2.5)
169
+ tzinfo (1.2.7)
170
170
  thread_safe (~> 0.1)
171
171
  websocket-driver (0.7.1)
172
172
  websocket-extensions (>= 0.1.0)
173
- websocket-extensions (0.1.4)
174
- zeitwerk (2.2.2)
173
+ websocket-extensions (0.1.5)
174
+ zeitwerk (2.3.0)
175
175
 
176
176
  PLATFORMS
177
177
  ruby
@@ -185,7 +185,7 @@ DEPENDENCIES
185
185
  pry-byebug
186
186
  rails
187
187
  rails-controller-testing
188
- rake (~> 10.0)
188
+ rake (~> 13.0)
189
189
  rspec-rails (~> 3.9)
190
190
  sqlite3
191
191
 
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency 'pry-byebug'
36
36
  spec.add_development_dependency 'rails'
37
37
  spec.add_development_dependency 'rails-controller-testing'
38
- spec.add_development_dependency 'rake', '~> 10.0'
38
+ spec.add_development_dependency 'rake', '~> 13.0'
39
39
  spec.add_development_dependency 'rspec-rails', '~> 3.9'
40
40
  spec.add_development_dependency 'sqlite3'
41
41
  end
@@ -72,23 +72,29 @@ module JsonApiable
72
72
  end
73
73
 
74
74
  def jsonapi_assign_params
75
- @jsonapi_assign_params ||= ParamsParser.parse_body_params(request,
76
- jsonapi_build_params,
77
- jsonapi_allowed_attributes,
78
- jsonapi_exclude_attributes,
79
- jsonapi_allowed_relationships,
80
- jsonapi_exclude_relationships)
75
+ return @jsonapi_assign_params if @jsonapi_assign_params.present? && !@invalidate_assign_params
76
+
77
+ @jsonapi_assign_params = ParamsParser.parse_body_params(request,
78
+ jsonapi_build_params,
79
+ jsonapi_allowed_attributes,
80
+ jsonapi_exclude_attributes,
81
+ jsonapi_allowed_relationships,
82
+ jsonapi_exclude_relationships)
83
+ @invalidate_assign_params = false
84
+ @jsonapi_assign_params
81
85
  end
82
86
 
83
87
  def jsonapi_exclude_attribute(attrib_key)
84
88
  @jsonapi_exclude_attributes ||= []
85
89
  @jsonapi_exclude_attributes << attrib_key.to_sym
90
+ @invalidate_assign_params = true
86
91
  jsonapi_build_params.dig(:data, :attributes, attrib_key)
87
92
  end
88
93
 
89
94
  def jsonapi_exclude_relationship(rel_key)
90
95
  @jsonapi_exclude_relationships ||= []
91
96
  @jsonapi_exclude_relationships << rel_key.to_sym
97
+ @invalidate_assign_params = true
92
98
  jsonapi_build_params.dig(:data, :relationships, rel_key)
93
99
  end
94
100
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JsonApiable
4
- VERSION = "0.4"
4
+ VERSION = "0.4.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_apiable
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Polischuk
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-13 00:00:00.000000000 Z
11
+ date: 2020-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '10.0'
159
+ version: '13.0'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '10.0'
166
+ version: '13.0'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rspec-rails
169
169
  requirement: !ruby/object:Gem::Requirement