introspective_grape 0.5.2 → 0.5.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
  SHA256:
3
- metadata.gz: 1221cfb7bde9b3896a0c11c595c685198a10a88120cb7ad0711baca8b954e7a0
4
- data.tar.gz: 18ef790d77cc390818ea413f04c3ffe0f87a60350a5a7157bb73e66ab9693360
3
+ metadata.gz: 241e7c16a1bb6c575a8dcf5af51190a9c02057e8a425d3b9df0c7004bd336263
4
+ data.tar.gz: bdb1de6b44a6be36418df88f3e1211969a8a0827a1f0bbc37e82b2b401899b2f
5
5
  SHA512:
6
- metadata.gz: fdc88a2e154ab024c70c978e553533d79d67b31194ae47e1fa6b923ffa83df585b317aabc2c5159ff9ef63881d235df0ca2cbd9ce28d303213029f6284f8288c
7
- data.tar.gz: f95cddc2dfe36efb3cf54f572d977c10573d658410a876dcf2adba43fb82ea066c1eea53582fa659079ff3211a638edcb0682b156abf040f8a4469bdd330bf87
6
+ metadata.gz: d97473f518ec0abc2dcb61fa9bfa733d988b930ea99f2fd032dade1f0e6d4b50624f9aba110e14ea17598a3a949b47fa9d88f5adc7cb344b0e4e391c09582036
7
+ data.tar.gz: 7a03151630d57796582eef585fe6ed767eb51c0eccd05fd470812c905add8017980552523c78f623844838b32af11f503caf75f94156c88b694c9d715caf01a8
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.0
1
+ 2.7.3
data/CHANGELOG.md CHANGED
@@ -1,4 +1,20 @@
1
1
 
2
+ 0.5.6 03/09/2022
3
+ ================
4
+
5
+ On the DELETE endpoint the primary key with its type was undeclared, creating conflicts with user-defined delete endpoints.
6
+
7
+ 0.5.5 02/24/2022
8
+ ================
9
+
10
+ Update the local ruby in the gem to 2.7.3 to clear security warning cruft.
11
+
12
+ Sanitize some sql.
13
+
14
+ Target the still-supported 'kt-paperclip' in the gemspec (many pardons while we're planning the switch over to activestorage support).
15
+
16
+ Fix bug from looking for the ActiveRecord columns_hash on non-ActiveRecord objects.
17
+
2
18
  0.5.2 02/07/2022
3
19
  ================
4
20
 
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.files = `git ls-files`.split("\n").sort
23
23
  s.test_files = `git ls-files -- spec/*`.split("\n")
24
24
 
25
- s.required_ruby_version = '>= 2.5'
25
+ s.required_ruby_version = '> 2.5'
26
26
 
27
27
  s.add_runtime_dependency 'rails', '~> 5.2'
28
28
  s.add_runtime_dependency 'schema_validations'
@@ -57,7 +57,7 @@ Gem::Specification.new do |s|
57
57
  s.add_development_dependency 'machinist_redux'
58
58
 
59
59
  # dummy app dependencies
60
- s.add_development_dependency 'paperclip'
60
+ s.add_development_dependency 'kt-paperclip'
61
61
  s.add_development_dependency 'rufus-mnemo'
62
62
  s.add_development_dependency 'devise'
63
63
  end
@@ -99,13 +99,15 @@ module IntrospectiveGrape
99
99
  # As routes are nested keep track of the routes, we are preventing siblings from
100
100
  # appending to the routes array here:
101
101
  routes = build_routes(routes, model)
102
- define_routes(routes, whitelist)
103
102
 
104
103
  # Top level declaration of the Grape::API namespace for the resource:
105
104
  resource routes.first.name.pluralize do
106
- # yield to append additional routes under the root namespace
105
+ # yield to prepend user-defined routes under the root namespace first,
107
106
  yield if block_given?
108
107
  end
108
+
109
+ # Then define IntrospectiveGrape's routes:
110
+ define_routes(routes, whitelist)
109
111
  end
110
112
 
111
113
  def define_routes(routes, api_params)
@@ -209,12 +211,15 @@ module IntrospectiveGrape
209
211
  end
210
212
 
211
213
  # rubocop:enable Metrics/AbcSize
212
- def define_destroy(dsl, routes, _model, _api_params)
214
+ def define_destroy(dsl, routes, model, _api_params)
213
215
  klass = routes.first.klass
214
- name = routes.last.name.singularize
216
+ name = routes.last.name.singularize
215
217
  dsl.desc "destroy a #{name}" do
216
218
  detail klass.destroy_documentation(name)
217
219
  end
220
+ dsl.params do
221
+ requires routes.last.swagger_key, type: klass.param_type(model, model.primary_key)
222
+ end
218
223
  dsl.delete ":#{routes.last.swagger_key}" do
219
224
  authorize @model, :destroy?
220
225
  present status: (klass.find_leaf(routes, @model, params).destroy ? true : false)
@@ -403,7 +408,7 @@ module IntrospectiveGrape
403
408
  def param_type(model, field)
404
409
  # Translate from the AR type to the GrapeParam types
405
410
  field = field.to_s
406
- db_type = (model&.columns_hash || {})[field]&.type
411
+ db_type = (model&.try(:columns_hash) || {})[field]&.type
407
412
 
408
413
  # Check if it's a file attachment, look for an override class from the model,
409
414
  # check PG2RUBY, use the database type, or fail over to a String:
@@ -91,7 +91,7 @@ module IntrospectiveGrape
91
91
 
92
92
  if timestamp_filter(klass, model, field)
93
93
  op = field.ends_with?('_start') ? '>=' : '<='
94
- records.where("#{timestamp_filter(klass, model, field)} #{op} ?", Time.zone.parse(params[field]))
94
+ records.where(ActiveRecord::Base.sanitize_sql_array(["#{timestamp_filter(klass, model, field)} #{op} ?", Time.zone.parse(params[field])]))
95
95
  elsif model.respond_to?("#{field}=")
96
96
  records.send("#{field}=", params[field])
97
97
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IntrospectiveGrape
4
- VERSION = '0.5.2'
4
+ VERSION = '0.5.6'
5
5
  end
data/spec/dummy/Gemfile CHANGED
@@ -1,19 +1,19 @@
1
1
  source 'https://rubygems.org'
2
- gem 'rails', '5.2.6'
2
+ gem 'rails', '5.2.6.2'
3
3
 
4
4
  gem 'byebug'
5
5
  gem 'camel_snake_keys'
6
6
 
7
7
  gem 'devise'
8
8
  gem 'delayed_paperclip'
9
- #gem 'devise-async'
9
+ gem 'kt-paperclip'
10
10
 
11
11
  gem 'grape'
12
12
  gem 'grape-entity'
13
13
  gem 'grape-kaminari'
14
14
  gem 'grape-swagger'
15
15
  gem 'grape-swagger-entity'
16
- gem 'introspective_grape', path: '~/Dropbox/contrib/introspective_grape'
16
+ gem 'introspective_grape' #, path: '~/Dropbox/contrib/introspective_grape'
17
17
 
18
18
  gem 'paperclip'
19
19
  gem 'pundit'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: introspective_grape
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Buermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-08 00:00:00.000000000 Z
11
+ date: 2022-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -291,7 +291,7 @@ dependencies:
291
291
  - !ruby/object:Gem::Version
292
292
  version: '0'
293
293
  - !ruby/object:Gem::Dependency
294
- name: paperclip
294
+ name: kt-paperclip
295
295
  requirement: !ruby/object:Gem::Requirement
296
296
  requirements:
297
297
  - - ">="
@@ -531,7 +531,7 @@ require_paths:
531
531
  - lib
532
532
  required_ruby_version: !ruby/object:Gem::Requirement
533
533
  requirements:
534
- - - ">="
534
+ - - ">"
535
535
  - !ruby/object:Gem::Version
536
536
  version: '2.5'
537
537
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -540,8 +540,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
540
540
  - !ruby/object:Gem::Version
541
541
  version: '0'
542
542
  requirements: []
543
- rubyforge_project:
544
- rubygems_version: 2.7.3
543
+ rubygems_version: 3.1.6
545
544
  signing_key:
546
545
  specification_version: 4
547
546
  summary: Quickly configure Grape APIs around your database schema and models.