jungle_path 0.0.38 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/jungle_path/api/helpers/standard_apis.rb +7 -7
- data/lib/jungle_path/api/template.erb +5 -5
- data/lib/jungle_path/app/controllers/controller.rb +2 -2
- data/lib/jungle_path/app/controllers/generated.rb +2 -2
- data/lib/jungle_path/controller/authentication.rb +4 -4
- data/lib/jungle_path/controller/base.rb +4 -3
- data/lib/jungle_path/controller/helpers.rb +4 -4
- data/lib/jungle_path/controller/template.erb +2 -2
- data/lib/jungle_path/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5762beb8c823dfad35574fb5e808ab0c0d1161d6
|
4
|
+
data.tar.gz: ac57b10dd79f9e3a0f1b93bb4aea8dc16d1bbece
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3604a75a339d754ec26f66b958d9192b005583749980e6acd076186f343054e2a9639f8bd9511fd9f4540e0e648b35959589e81e7b77edc639432b00e15d0b76
|
7
|
+
data.tar.gz: 9de2a60330ee58e7a7d33cb03d7b7f6f3d74f1a8a6bd60790433a011d32bd4b83ec4e8d188c96856437ca3c9a8cfe0409ec0e055d2bc7131032d82e9b38795ed
|
@@ -197,7 +197,7 @@ module JunglePath
|
|
197
197
|
if user_id == current_user.id
|
198
198
|
halt 403, "Self deletion not allowed."
|
199
199
|
end
|
200
|
-
handle_result(Controller::User.new(
|
200
|
+
handle_result(Controller::User.new(current_identity, params, db).delete)
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
@@ -212,7 +212,7 @@ module JunglePath
|
|
212
212
|
if key_id == current_key.id
|
213
213
|
halt 403, "Self deletion of key not allowed."
|
214
214
|
end
|
215
|
-
handle_result(Controller::Key.new(
|
215
|
+
handle_result(Controller::Key.new(current_identity, params, db).delete)
|
216
216
|
end
|
217
217
|
|
218
218
|
begin # authorization
|
@@ -248,27 +248,27 @@ module JunglePath
|
|
248
248
|
begin # api_keys gets
|
249
249
|
get '/keys/:key' do
|
250
250
|
pass if params['key'].match(/^\d+$/) # if key is an integer goto route /api_keys/:id
|
251
|
-
handle_result(Controller::Key.new(
|
251
|
+
handle_result(Controller::Key.new(current_identity, params, db).select_by_key)
|
252
252
|
end
|
253
253
|
|
254
254
|
get '/keys/user/:user_id' do
|
255
255
|
# get the api keys for this user.
|
256
|
-
handle_result(Controller::Key.new(
|
256
|
+
handle_result(Controller::Key.new(current_identity, params, db).select_by_user)
|
257
257
|
end
|
258
258
|
|
259
259
|
get '/keys/user/:user_id/default' do
|
260
260
|
# get the default api keys for this user.
|
261
|
-
handle_result(Controller::Key.new(
|
261
|
+
handle_result(Controller::Key.new(current_identity, params, db).select_default_by_user)
|
262
262
|
end
|
263
263
|
|
264
264
|
get '/keys/user/:user_id/application/:application_id' do
|
265
265
|
# get the api keys for this user for this application.
|
266
|
-
handle_result(Controller::Key.new(
|
266
|
+
handle_result(Controller::Key.new(current_identity, params, db).select_by_user)
|
267
267
|
end
|
268
268
|
|
269
269
|
get '/keys/user/:user_id/application/:application_id/default' do
|
270
270
|
# get the default api keys for this user for this application.
|
271
|
-
result = Controller::Key.new(
|
271
|
+
result = Controller::Key.new(current_identity, params, db).select_default_by_user
|
272
272
|
#puts "result: #{result}."
|
273
273
|
handle_result(result)
|
274
274
|
end
|
@@ -11,23 +11,23 @@ module <%= name_space %>
|
|
11
11
|
<% for table in tables %>
|
12
12
|
begin # <%= table.plural_table_name %>
|
13
13
|
get '/<%= table.plural_table_name %>' do
|
14
|
-
handle_result(<%= controller_name_space %>::<%= table.name.split('::').last %>.new(
|
14
|
+
handle_result(<%= controller_name_space %>::<%= table.name.split('::').last %>.new(current_identity, params, db).select)
|
15
15
|
end
|
16
16
|
|
17
17
|
get '/<%= table.plural_table_name %><%= table.template_pk_url %>' do
|
18
|
-
handle_result(<%= controller_name_space %>::<%= table.name.split('::').last %>.new(
|
18
|
+
handle_result(<%= controller_name_space %>::<%= table.name.split('::').last %>.new(current_identity, params, db).select)
|
19
19
|
end
|
20
20
|
|
21
21
|
post '/<%= table.plural_table_name %>' do
|
22
|
-
handle_result(<%= controller_name_space %>::<%= table.name.split('::').last %>.new(
|
22
|
+
handle_result(<%= controller_name_space %>::<%= table.name.split('::').last %>.new(current_identity, params, db).insert)
|
23
23
|
end
|
24
24
|
|
25
25
|
put '/<%= table.plural_table_name %><%= table.template_pk_url %>' do
|
26
|
-
handle_result(<%= controller_name_space %>::<%= table.name.split('::').last %>.new(
|
26
|
+
handle_result(<%= controller_name_space %>::<%= table.name.split('::').last %>.new(current_identity, params, db).update)
|
27
27
|
end
|
28
28
|
|
29
29
|
delete '/<%= table.plural_table_name %><%= table.template_pk_url %>' do
|
30
|
-
handle_result(<%= controller_name_space %>::<%= table.name.split('::').last %>.new(
|
30
|
+
handle_result(<%= controller_name_space %>::<%= table.name.split('::').last %>.new(current_identity, params, db).delete)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
<% end %>
|
@@ -11,8 +11,8 @@ require_relative 'generated'
|
|
11
11
|
|
12
12
|
module Controller
|
13
13
|
class User < JunglePath::Controller::Base
|
14
|
-
def initialize(
|
15
|
-
super(
|
14
|
+
def initialize(current_identity, params, db)
|
15
|
+
super(current_identity, params, db, Schema::User)
|
16
16
|
end
|
17
17
|
|
18
18
|
def insert(include_secure_columns: false)
|
@@ -5,8 +5,8 @@ require_relative '../schemas/schema'
|
|
5
5
|
module Controller
|
6
6
|
|
7
7
|
class Answer < JunglePath::Controller::Base
|
8
|
-
def initialize(
|
9
|
-
super(
|
8
|
+
def initialize(current_identity, params, db)
|
9
|
+
super(current_identity, params, db, Schema::Answer)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -9,8 +9,8 @@ require 'jungle_path/sql'
|
|
9
9
|
module JunglePath
|
10
10
|
module Controller
|
11
11
|
class User < Base
|
12
|
-
def initialize(
|
13
|
-
super(
|
12
|
+
def initialize(current_identity, params, db)
|
13
|
+
super(current_identity, params, db, JunglePath::Schema::User)
|
14
14
|
end
|
15
15
|
|
16
16
|
def insert(include_secure_columns: false)
|
@@ -78,8 +78,8 @@ module JunglePath
|
|
78
78
|
end
|
79
79
|
|
80
80
|
class Key < Base
|
81
|
-
def initialize(
|
82
|
-
super(
|
81
|
+
def initialize(current_identity, params, db)
|
82
|
+
super(current_identity, params, db, JunglePath::Schema::Key)
|
83
83
|
end
|
84
84
|
|
85
85
|
def select_by_key(include_secure_columns: false)
|
@@ -6,9 +6,10 @@ module JunglePath
|
|
6
6
|
module Controller
|
7
7
|
class Base
|
8
8
|
attr_reader :table_class
|
9
|
-
def initialize(
|
10
|
-
@
|
11
|
-
@
|
9
|
+
def initialize(current_identity, params, db, table_class)
|
10
|
+
@current_identity = current_identity
|
11
|
+
@current_user = current_identity and current_identity.user
|
12
|
+
@current_key = current_identity and current_identity.key
|
12
13
|
@db = db
|
13
14
|
@table_class = table_class
|
14
15
|
@params = self.class.transform(params.to_h, table_class.columns)
|
@@ -2,8 +2,8 @@ module JunglePath
|
|
2
2
|
module Controller
|
3
3
|
module Helpers
|
4
4
|
module User
|
5
|
-
def initialize(
|
6
|
-
super(
|
5
|
+
def initialize(current_identity, params, db, model_class)
|
6
|
+
super(current_identity, params, db, model_class)
|
7
7
|
end
|
8
8
|
|
9
9
|
def insert(include_secure_columns: false)
|
@@ -25,8 +25,8 @@ module JunglePath
|
|
25
25
|
end
|
26
26
|
|
27
27
|
module Key
|
28
|
-
def initialize(
|
29
|
-
super(
|
28
|
+
def initialize(current_identity, params, db, model_class)
|
29
|
+
super(current_identity, params, db, model_class)
|
30
30
|
end
|
31
31
|
|
32
32
|
def insert(include_secure_columns: false)
|
@@ -9,8 +9,8 @@ module <%= controller_name_space %>
|
|
9
9
|
def self.table_class
|
10
10
|
<%= table.name.to_s %>
|
11
11
|
end
|
12
|
-
def initialize(
|
13
|
-
super(
|
12
|
+
def initialize(current_identity, params, db)
|
13
|
+
super(current_identity, params, db, <%= table.name.to_s %>)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
<% end %>
|
data/lib/jungle_path/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jungle_path
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael VanZant
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|