qodex-rails 0.1.12 → 0.1.14
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/README.md +1 -0
- data/lib/qodex/rails/version.rb +1 -1
- data/lib/qodex-rails/configuration.rb +2 -1
- data/lib/qodex-rails/middleware.rb +22 -7
- data/lib/qodex-rails/version.rb +1 -1
- data/qodex-rails-0.1.12.gem +0 -0
- metadata +7 -15
- data/qodex-rails-0.1.0.gem +0 -0
- data/qodex-rails-0.1.1.gem +0 -0
- data/qodex-rails-0.1.10.gem +0 -0
- data/qodex-rails-0.1.2.gem +0 -0
- data/qodex-rails-0.1.3.gem +0 -0
- data/qodex-rails-0.1.4.gem +0 -0
- data/qodex-rails-0.1.5.gem +0 -0
- data/qodex-rails-0.1.8.gem +0 -0
- data/qodex-rails-0.1.9.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33fdd4101a6afdcb2a1379bcb2a832ca25045132668c5c6c156df5645f3965fb
|
4
|
+
data.tar.gz: 9ee4fcd3756c9664006c1c9a628645c0f2197d0e58c85fc165ed63a189ceb08b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39a1a63dcd110356ee18edeae01b7b9642946a3beb5d495cf870e28fe080bbfa08eb73ae0354e4ab082c2d7c19e9febe3f01fe8ffba8626a577af0bb01ffa82c
|
7
|
+
data.tar.gz: d50dd079002906880ce5d6344bd28255fc05dece50703ea6bce3c26b79c7a2ffd2f4ea70e973fd7d84e6771d91f2eee5d71b8ef6e459b5f26e330528ed746044
|
data/README.md
CHANGED
@@ -23,6 +23,7 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
23
23
|
project_name = Rails.application.class.module_parent_name rescue 'qodex'
|
24
24
|
config.collection_name = "#{project_name}-#{Rails.env}" # Name of the collection where logs will be stored
|
25
25
|
config.allowed_environments = ['staging', 'production'] # Default value is staging if not set. Add production to enable in production
|
26
|
+
config.frequency = 'high' #default value is medium. to control the speed of the logs processing
|
26
27
|
config.api_key = 'Your API Key'
|
27
28
|
end
|
28
29
|
|
data/lib/qodex/rails/version.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
module QodexRails
|
2
2
|
class Configuration
|
3
|
-
attr_accessor :collection_name, :api_key, :allowed_environments, :frequency
|
3
|
+
attr_accessor :collection_name, :api_key, :allowed_environments, :frequency, :api_host
|
4
4
|
|
5
5
|
def initialize
|
6
6
|
@collection_name = nil
|
7
7
|
@api_key = nil
|
8
8
|
@allowed_environments = ['staging']
|
9
9
|
@frequency = 'medium'
|
10
|
+
@api_host = nil
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|
@@ -12,7 +12,7 @@ module QodexRails
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def call(env)
|
15
|
-
|
15
|
+
|
16
16
|
# Check if the current environment is allowed
|
17
17
|
return @app.call(env) unless @allowed_environments.include?(Rails.env)
|
18
18
|
|
@@ -35,24 +35,38 @@ module QodexRails
|
|
35
35
|
# Rails.logger.info "QodexRails Initializer Keys: Collection Name: #{QodexRails.configuration.collection_name}, API Key: #{QodexRails.configuration.api_key}"
|
36
36
|
|
37
37
|
start_time = Time.now
|
38
|
-
|
38
|
+
|
39
39
|
# Capture the request details
|
40
40
|
request = Rack::Request.new(env)
|
41
41
|
request_body = request.body.read
|
42
42
|
request.body.rewind
|
43
|
-
|
43
|
+
|
44
44
|
status, headers, response = @app.call(env)
|
45
|
-
|
45
|
+
response_content_type = response.instance_eval('@response').headers['content-type']
|
46
|
+
if response_content_type.present? && !(response_content_type.include?('application/json'))
|
47
|
+
return [status, headers, response]
|
48
|
+
end
|
49
|
+
|
46
50
|
end_time = Time.now
|
47
51
|
|
48
52
|
# Capture the response details
|
49
53
|
response_body = extract_body(response)
|
50
|
-
|
54
|
+
|
55
|
+
routes = Rails.application.routes
|
56
|
+
parsed_route_info = routes.recognize_path(request.url, {method: request.request_method}) rescue nil
|
57
|
+
return [status, headers, response] if parsed_route_info.blank?
|
58
|
+
|
59
|
+
controller_name = parsed_route_info[:controller]
|
60
|
+
action_name = parsed_route_info[:action]
|
61
|
+
additional_info = parsed_route_info.except(:controller, :action)
|
62
|
+
|
51
63
|
# Construct the logs
|
52
64
|
logs = {
|
53
65
|
collection_name: QodexRails.configuration.collection_name,
|
54
66
|
api_key: QodexRails.configuration.api_key,
|
55
67
|
api: {
|
68
|
+
controller_name: controller_name,
|
69
|
+
action_name: action_name,
|
56
70
|
time_spent: (end_time - start_time).to_i,
|
57
71
|
body: request_body,
|
58
72
|
response_body: response_body,
|
@@ -63,7 +77,7 @@ module QodexRails
|
|
63
77
|
status: status,
|
64
78
|
headers: extract_request_headers(env),
|
65
79
|
response_headers: extract_headers(headers),
|
66
|
-
params: request.params # Using Rails' parameter filtering
|
80
|
+
params: request.params.merge(additional_info) # Using Rails' parameter filtering
|
67
81
|
}
|
68
82
|
}
|
69
83
|
|
@@ -93,7 +107,8 @@ module QodexRails
|
|
93
107
|
end
|
94
108
|
|
95
109
|
def send_to_api(logs)
|
96
|
-
|
110
|
+
api_host = QodexRails.configuration.api_host || 'https://api.app.qodex.ai'
|
111
|
+
uri = URI("#{api_host}/api/v1/collections/create_sample_data/#{QodexRails.configuration.api_key}")
|
97
112
|
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
|
98
113
|
request.body = JSON.generate(logs)
|
99
114
|
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
|
data/lib/qodex-rails/version.rb
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qodex-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sid
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Intercept your rails application to power Qodex.ai AI copilot.
|
14
14
|
email:
|
@@ -30,15 +30,7 @@ files:
|
|
30
30
|
- lib/qodex-rails/version.rb
|
31
31
|
- lib/qodex/rails.rb
|
32
32
|
- lib/qodex/rails/version.rb
|
33
|
-
- qodex-rails-0.1.
|
34
|
-
- qodex-rails-0.1.1.gem
|
35
|
-
- qodex-rails-0.1.10.gem
|
36
|
-
- qodex-rails-0.1.2.gem
|
37
|
-
- qodex-rails-0.1.3.gem
|
38
|
-
- qodex-rails-0.1.4.gem
|
39
|
-
- qodex-rails-0.1.5.gem
|
40
|
-
- qodex-rails-0.1.8.gem
|
41
|
-
- qodex-rails-0.1.9.gem
|
33
|
+
- qodex-rails-0.1.12.gem
|
42
34
|
- sig/qodex/rails.rbs
|
43
35
|
homepage: https://qodex.ai
|
44
36
|
licenses:
|
@@ -48,7 +40,7 @@ metadata:
|
|
48
40
|
homepage_uri: https://qodex.ai
|
49
41
|
source_code_uri: https://github.com/qodex-ai/qodex-rails
|
50
42
|
changelog_uri: https://github.com/qodex-ai/qodex-rails
|
51
|
-
post_install_message:
|
43
|
+
post_install_message:
|
52
44
|
rdoc_options: []
|
53
45
|
require_paths:
|
54
46
|
- lib
|
@@ -63,8 +55,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
55
|
- !ruby/object:Gem::Version
|
64
56
|
version: '0'
|
65
57
|
requirements: []
|
66
|
-
rubygems_version: 3.
|
67
|
-
signing_key:
|
58
|
+
rubygems_version: 3.5.3
|
59
|
+
signing_key:
|
68
60
|
specification_version: 4
|
69
61
|
summary: Intercept your rails application to power Qodex.ai AI copilot.
|
70
62
|
test_files: []
|
data/qodex-rails-0.1.0.gem
DELETED
Binary file
|
data/qodex-rails-0.1.1.gem
DELETED
Binary file
|
data/qodex-rails-0.1.10.gem
DELETED
Binary file
|
data/qodex-rails-0.1.2.gem
DELETED
Binary file
|
data/qodex-rails-0.1.3.gem
DELETED
Binary file
|
data/qodex-rails-0.1.4.gem
DELETED
Binary file
|
data/qodex-rails-0.1.5.gem
DELETED
Binary file
|
data/qodex-rails-0.1.8.gem
DELETED
Binary file
|
data/qodex-rails-0.1.9.gem
DELETED
Binary file
|