qodex-rails 0.1.4 → 0.1.5
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/qodex/rails/version.rb +1 -1
- data/lib/qodex-rails/middleware.rb +6 -5
- data/lib/qodex-rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08a5f5d7f43e4d9c091b7519e6744ec092fbffd4aa5bc478b66e0afdc7d0a8ff'
|
4
|
+
data.tar.gz: bc3ef816a36a9b63f15d28ec7a87169b87bfd1414f8a7a37126f0c9b1672843c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf376639be8f8e5be908baff12364ba0963431f34fac18fd2b396c465b01e5e71ecf37c49e92dd1aa2b3695bf14309a5f8b3e1570cf02539dac88414c8abb3d5
|
7
|
+
data.tar.gz: ff94f6372beafce723904933d555d409f7efba485067ea4c307b7cea91b3e41fb84f7d9aa5c9530f9535811964af2e328c93c00e241b2434037fdfd72b619144
|
data/lib/qodex/rails/version.rb
CHANGED
@@ -17,7 +17,7 @@ module QodexRails
|
|
17
17
|
end
|
18
18
|
|
19
19
|
# Print the initializer keys to the output
|
20
|
-
Rails.logger.info "QodexRails Initializer Keys: Collection Name: #{QodexRails.configuration.collection_name}, API Key: #{QodexRails.configuration.api_key}"
|
20
|
+
# Rails.logger.info "QodexRails Initializer Keys: Collection Name: #{QodexRails.configuration.collection_name}, API Key: #{QodexRails.configuration.api_key}"
|
21
21
|
|
22
22
|
start_time = Time.now
|
23
23
|
|
@@ -37,7 +37,8 @@ module QodexRails
|
|
37
37
|
logs = {
|
38
38
|
collection_name: QodexRails.configuration.collection_name,
|
39
39
|
api_key: QodexRails.configuration.api_key,
|
40
|
-
|
40
|
+
api: {
|
41
|
+
time_spent: (end_time - start_time).to_i,
|
41
42
|
body: response_body,
|
42
43
|
body_type: 'none-type',
|
43
44
|
request_type: request.request_method,
|
@@ -46,7 +47,7 @@ module QodexRails
|
|
46
47
|
status: status,
|
47
48
|
headers: extract_headers(headers),
|
48
49
|
params: request.params # Using Rails' parameter filtering
|
49
|
-
}
|
50
|
+
}
|
50
51
|
}
|
51
52
|
|
52
53
|
# Send the logs to the external API
|
@@ -68,7 +69,7 @@ module QodexRails
|
|
68
69
|
end
|
69
70
|
|
70
71
|
def send_to_api(logs)
|
71
|
-
uri = URI("https://api.app.qodex.ai/api/v1/collections/
|
72
|
+
uri = URI("https://api.app.qodex.ai/api/v1/collections/create_sample_data/#{QodexRails.configuration.api_key}")
|
72
73
|
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
|
73
74
|
request.body = JSON.generate(logs)
|
74
75
|
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
|
@@ -76,7 +77,7 @@ module QodexRails
|
|
76
77
|
end
|
77
78
|
|
78
79
|
# Optionally log the response from the external API
|
79
|
-
Rails.logger.info "URI: #{uri}, API Response: #{response.body}" if response
|
80
|
+
# Rails.logger.info "URI: #{uri}, API Response: #{response.body}" if response
|
80
81
|
end
|
81
82
|
end
|
82
83
|
end
|
data/lib/qodex-rails/version.rb
CHANGED