model_driven_api 3.1.0 → 3.1.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26b117f2b2479f8150174e00a0705473404994be8c6126c2056e48703d9cf614
|
4
|
+
data.tar.gz: 2f37df3cf9859d2fef799d2586dc1ce208861a5a080e13adb1d46c9d5bf365b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 889b74219e8ef6bcb3c0116e8fcd49ef6e2f4ac62463a7bad714ec8c5f52dce25ad2fa527d2bc04061b3fee18eadc2f89e611b500d81c82ed90a6e18126a86d6
|
7
|
+
data.tar.gz: 0b64edfca451ef8756609adcaa5014042c5433312f3fb3c206a21c052bec70a380b162977b15b69423ec771692b2cab8751f8421c171b8ce9b314640fb895ac3
|
@@ -137,9 +137,9 @@ class Api::V2::ApplicationController < ActionController::API
|
|
137
137
|
# The endpoint can be expressed in two wayy:
|
138
138
|
# 1. As a method in the model, with suffix custom_action_<custom_action>
|
139
139
|
# 2. As a module instance method in the model, like Track::Endpoints.inventory
|
140
|
-
if
|
140
|
+
if defined?("Endpoints::#{@model}.#{custom_action}")
|
141
141
|
# Custom endpoint exists and can be called in the sub-modules form
|
142
|
-
body, status = @model
|
142
|
+
body, status = "Endpoints::#{@model}".constantize.send(custom_action, params)
|
143
143
|
elsif @model.respond_to?("custom_action_#{custom_action}")
|
144
144
|
body, status = @model.send("custom_action_#{custom_action}", params)
|
145
145
|
else
|
@@ -1,8 +1,10 @@
|
|
1
|
+
require 'concerns/model_driven_api_application_record'
|
1
2
|
require 'concerns/model_driven_api_user'
|
2
3
|
require 'concerns/model_driven_api_role'
|
3
4
|
|
4
5
|
Rails.application.configure do
|
5
6
|
config.after_initialize do
|
7
|
+
ApplicationRecord.send(:include, ModelDrivenApiApplicationRecord)
|
6
8
|
User.send(:include, ModelDrivenApiUser)
|
7
9
|
Role.send(:include, ModelDrivenApiRole)
|
8
10
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module ModelDrivenApiApplicationRecord
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
def self.ransackable_attributes(auth_object = nil)
|
6
|
+
column_names + _ransackers.keys
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.ransackable_associations(auth_object = nil)
|
10
|
+
reflect_on_all_associations.map { |a| a.name.to_s } + _ransackers.keys
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: model_driven_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thecore_backend_commons
|
@@ -58,28 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '4.1'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '4.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rack-cors
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '2.0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '2.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: deep_merge
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -135,6 +135,7 @@ files:
|
|
135
135
|
- db/migrate/20210519145438_create_used_tokens.rb
|
136
136
|
- db/migrate/20210528111450_rename_valid_to_is_valid_in_used_token.rb
|
137
137
|
- lib/concerns/api_exception_management.rb
|
138
|
+
- lib/concerns/model_driven_api_application_record.rb
|
138
139
|
- lib/concerns/model_driven_api_role.rb
|
139
140
|
- lib/concerns/model_driven_api_user.rb
|
140
141
|
- lib/json_web_token.rb
|
@@ -162,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
163
|
- !ruby/object:Gem::Version
|
163
164
|
version: '0'
|
164
165
|
requirements: []
|
165
|
-
rubygems_version: 3.
|
166
|
+
rubygems_version: 3.5.3
|
166
167
|
signing_key:
|
167
168
|
specification_version: 4
|
168
169
|
summary: Convention based RoR engine which uses DB schema introspection to create
|