insights-api-common 4.0.1 → 4.0.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a38805baee23f75e802e915bc9bfff80b758d424248a9a0a859d72a28b7d96c
|
4
|
+
data.tar.gz: 6e23b3830ae021373b9849a80425b84b3c9b61af0c46812f25827366b39cc745
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0adc64a561b7539930ede0a335c9e499e763f041bfb517691a5ba8d827d73ee308157a2ec304fceade1b8f4daeb6721d77b9fbfc252e3da819085a5a043b6bb9
|
7
|
+
data.tar.gz: '0915bedf1ab6c791d8d9ec5aebb634935826ef0269a76ffbd2e74ac7f83d76b2c4a52dafecc464e59287bd82c6c2ac3bdf4d15a10d948d209e4576ea516338bd'
|
@@ -48,6 +48,7 @@ module Insights
|
|
48
48
|
ENV['APP_NAME'] = app_name
|
49
49
|
ENV['PATH_PREFIX'] = app_prefix
|
50
50
|
Rails.application.reload_routes!
|
51
|
+
@operation_id_hash = {}
|
51
52
|
end
|
52
53
|
|
53
54
|
def server_base_path
|
@@ -117,8 +118,8 @@ module Insights
|
|
117
118
|
"type" => "object",
|
118
119
|
"properties" => {
|
119
120
|
"status" => {
|
120
|
-
"type" => "
|
121
|
-
"example" => 404
|
121
|
+
"type" => "string",
|
122
|
+
"example" => "404"
|
122
123
|
},
|
123
124
|
"detail" => {
|
124
125
|
"type" => "string",
|
@@ -200,7 +201,7 @@ module Insights
|
|
200
201
|
sub_collection = (primary_collection != klass_name)
|
201
202
|
{
|
202
203
|
"summary" => "List #{klass_name.pluralize}#{" for #{primary_collection}" if sub_collection}",
|
203
|
-
"operationId" =>
|
204
|
+
"operationId" => operation_id(klass_name, primary_collection, sub_collection),
|
204
205
|
"description" => "Returns an array of #{klass_name} objects",
|
205
206
|
"parameters" => [
|
206
207
|
{ "$ref" => "##{PARAMETERS_PATH}/QueryLimit" },
|
@@ -562,6 +563,24 @@ module Insights
|
|
562
563
|
def schema_overrides
|
563
564
|
{}
|
564
565
|
end
|
566
|
+
|
567
|
+
def validate_operation_id(name, klass_name)
|
568
|
+
if @operation_id_hash.key?(name)
|
569
|
+
raise ArgumentError, "operation id cannot be duplicates, #{name} in class #{klass_name} has already been used in class #{@operation_id_hash[name]}"
|
570
|
+
end
|
571
|
+
@operation_id_hash[name] = klass_name
|
572
|
+
end
|
573
|
+
|
574
|
+
def operation_id(klass_name, primary_collection, sub_collection)
|
575
|
+
klass = klass_name.constantize
|
576
|
+
name = if klass.respond_to?(:list_operation_id)
|
577
|
+
klass.send(:list_operation_id)
|
578
|
+
else
|
579
|
+
"list#{primary_collection if sub_collection}#{klass_name.pluralize}"
|
580
|
+
end
|
581
|
+
validate_operation_id(name, klass_name)
|
582
|
+
name
|
583
|
+
end
|
565
584
|
end
|
566
585
|
end
|
567
586
|
end
|
@@ -25,6 +25,14 @@ module Insights
|
|
25
25
|
Thread.current[:current_request]
|
26
26
|
end
|
27
27
|
|
28
|
+
def self.current_request_id
|
29
|
+
Thread.current[:request_id]
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.current_request_id=(id)
|
33
|
+
Thread.current[:request_id] = id
|
34
|
+
end
|
35
|
+
|
28
36
|
def self.current!
|
29
37
|
current || raise(RequestNotSet)
|
30
38
|
end
|
@@ -45,10 +53,13 @@ module Insights
|
|
45
53
|
|
46
54
|
def self.with_request(request)
|
47
55
|
saved = current
|
56
|
+
saved_request_id = current&.request_id
|
48
57
|
self.current = request
|
58
|
+
self.current_request_id = current&.request_id
|
49
59
|
yield current
|
50
60
|
ensure
|
51
61
|
self.current = saved
|
62
|
+
self.current_request_id = saved_request_id
|
52
63
|
end
|
53
64
|
|
54
65
|
def self.current_forwardable
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: insights-api-common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Insights Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: acts_as_tenant
|
@@ -142,6 +142,20 @@ dependencies:
|
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: 0.10.0
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: insights-rbac-api-client
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - "~>"
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '1.0'
|
152
|
+
type: :runtime
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - "~>"
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '1.0'
|
145
159
|
- !ruby/object:Gem::Dependency
|
146
160
|
name: graphql
|
147
161
|
requirement: !ruby/object:Gem::Requirement
|
@@ -399,7 +413,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
399
413
|
- !ruby/object:Gem::Version
|
400
414
|
version: '0'
|
401
415
|
requirements: []
|
402
|
-
rubygems_version: 3.0.
|
416
|
+
rubygems_version: 3.0.8
|
403
417
|
signing_key:
|
404
418
|
specification_version: 4
|
405
419
|
summary: Common Utilites for Insights microservices
|