qodex-rails 0.1.13 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53f423fa70f86f62f2a1a68fd591468b03b62e5f81792539fd012ee4a10bac80
4
- data.tar.gz: 7d1a50e23f1bf56ca65120f66b41871e4de476bfe55359415f528e0931e38a4a
3
+ metadata.gz: 33fdd4101a6afdcb2a1379bcb2a832ca25045132668c5c6c156df5645f3965fb
4
+ data.tar.gz: 9ee4fcd3756c9664006c1c9a628645c0f2197d0e58c85fc165ed63a189ceb08b
5
5
  SHA512:
6
- metadata.gz: 6e7394d3f7afa7297acf0cff2e8cce1b887b3e49e03a9a0df009ea39be41e712858bc34d2ad154f18bc07e3037c1cc1d43aa1dbab618cf929be9bc427461737b
7
- data.tar.gz: f136cf35b976b3aa138dd03f28fc4a93aa463910cdc05cb5444009caf3370a7408315311d6c4ef3e3c7c647ba14055f54f7a2abc19161262bd035a2228ca1d87
6
+ metadata.gz: 39a1a63dcd110356ee18edeae01b7b9642946a3beb5d495cf870e28fe080bbfa08eb73ae0354e4ab082c2d7c19e9febe3f01fe8ffba8626a577af0bb01ffa82c
7
+ data.tar.gz: d50dd079002906880ce5d6344bd28255fc05dece50703ea6bce3c26b79c7a2ffd2f4ea70e973fd7d84e6771d91f2eee5d71b8ef6e459b5f26e330528ed746044
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Qodex
4
4
  module Rails
5
- VERSION = "0.1.13"
5
+ VERSION = "0.1.14"
6
6
  end
7
7
  end
@@ -42,17 +42,31 @@ module QodexRails
42
42
  request.body.rewind
43
43
 
44
44
  status, headers, response = @app.call(env)
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
45
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
 
@@ -1,3 +1,3 @@
1
1
  module QodexRails
2
- VERSION = "0.1.13"
2
+ VERSION = "0.1.14"
3
3
  end
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.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - sid
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-30 00:00:00.000000000 Z
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: