activerabbit-ai 0.5.1 → 0.5.2

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: 7ca3568f93b7ec8211e47cf961fdf459f297a2d674fac08fe7c06a4001d09cdc
4
- data.tar.gz: 6b3caffa37d7687c1d9038360c6787f7846e64bd30b722e4694b5d826b149a39
3
+ metadata.gz: d349dcd013eaa9c787d218d695e4e45d779b4c236fc908b84edbda42ac0471b8
4
+ data.tar.gz: 92c559e16a816706558028588f8869212b05e41fb10507d5fc8c40902ca95a62
5
5
  SHA512:
6
- metadata.gz: 7b6eda18a09800a68a7b159c39af0398e1017c5fb97a6dd83bc6956c0b6acbcbe1f424fcbbcc6ab70d79a830e8a15458ba62027f9b3b4fa23d095ffb9cdd0de6
7
- data.tar.gz: 48e942cb18f611f795944be031ad0d4ac1637e103357f33cab5dd2ecc4229bd15476bd91291094a5d0fd8780b78744620b9a28c9f25245e3c71690c1dff6a1a4
6
+ metadata.gz: f26d6cd48e6ba74b87cbdfb5adae1c89dfba13c623c0acfc7418c7061bf3559c66a48061a136a166bdb69a5e06cf1a5d6ee5067c35e20932dd4b98966ad03bcf
7
+ data.tar.gz: daf29ace4927b42c216a8c88df12291f783b599d32a4443e19426854f336c00fb571ae63d2f6003d05707409b150768cc0ed1c42fd12d348e7bb80689a96aabb
data/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.5.2] - 2025-12-22
6
+
7
+ ### Fixed
8
+ - **Batch sending resilience**: `HttpClient#post_batch` is now nil-safe and supports both queued items and raw payloads (prevents `undefined method [] for nil` during flush).
9
+ - **Dedupe resilience**: Deduplication key building is now safe when `context` is nil/non-hash.
10
+
11
+ ### Changed
12
+ - **Default API URL**: Default `api_url` aligned to `https://app.activerabbit.ai` (dashboard + API host).
13
+
5
14
  ## [0.5.0] - 2025-12-12
6
15
 
7
16
  ### Changed
data/README.md CHANGED
@@ -38,7 +38,7 @@ Or install it yourself as:
38
38
  ActiveRabbit::Client.configure do |config|
39
39
  config.api_key = ENV['ACTIVERABBIT_API_KEY']
40
40
  config.project_id = ENV['ACTIVERABBIT_PROJECT_ID']
41
- config.api_url = ENV.fetch('ACTIVERABBIT_API_URL', 'https://api.activerabbit.ai')
41
+ config.api_url = ENV.fetch('ACTIVERABBIT_API_URL', 'https://app.activerabbit.ai')
42
42
  config.environment = Rails.env
43
43
  end
44
44
  ```
@@ -20,7 +20,7 @@ module ActiveRabbit
20
20
  attr_accessor :disable_console_logs
21
21
 
22
22
  def initialize
23
- @api_url = ENV.fetch("ACTIVERABBIT_API_URL", "https://api.activerabbit.ai")
23
+ @api_url = ENV.fetch("ACTIVERABBIT_API_URL", "https://app.activerabbit.ai")
24
24
  @api_key = ENV["ACTIVERABBIT_API_KEY"]
25
25
  @project_id = ENV["ACTIVERABBIT_PROJECT_ID"]
26
26
  @environment = ENV["ACTIVERABBIT_ENVIRONMENT"] || detect_environment
@@ -32,7 +32,16 @@ module ActiveRabbit
32
32
 
33
33
  def build_key(exception, context)
34
34
  top = Array(exception.backtrace).first.to_s
35
- req_id = context[:request]&.[](:request_id) || context[:request_id] || context[:requestId]
35
+ ctx = context.is_a?(Hash) ? context : {}
36
+ req = ctx[:request] || ctx["request"]
37
+ req_hash = req.is_a?(Hash) ? req : {}
38
+
39
+ req_id =
40
+ req_hash[:request_id] || req_hash["request_id"] ||
41
+ req_hash[:requestId] || req_hash["requestId"] ||
42
+ ctx[:request_id] || ctx["request_id"] ||
43
+ ctx[:requestId] || ctx["requestId"]
44
+
36
45
  [exception.class.name, top, req_id].join("|")
37
46
  end
38
47
  end
@@ -77,11 +77,23 @@ module ActiveRabbit
77
77
 
78
78
  def post_batch(batch_data)
79
79
  # Transform batch data into the format the API expects
80
- events = batch_data.map do |event|
81
- {
82
- type: event[:data][:event_type] || event[:event_type] || event[:type],
83
- data: event[:data]
84
- }
80
+ events = Array(batch_data).filter_map do |event|
81
+ next if event.nil?
82
+
83
+ # Support both:
84
+ # - queued items: { method:, path:, data:, timestamp: }
85
+ # - raw payloads: { ...event fields... }
86
+ data =
87
+ (event.is_a?(Hash) ? (event[:data] || event["data"]) : nil) ||
88
+ (event.is_a?(Hash) ? event : nil)
89
+
90
+ next unless data.is_a?(Hash)
91
+
92
+ type =
93
+ data[:event_type] || data["event_type"] ||
94
+ (event.is_a?(Hash) ? (event[:event_type] || event["event_type"] || event[:type] || event["type"]) : nil)
95
+
96
+ { type: type, data: data }
85
97
  end
86
98
 
87
99
  # Send batch to API
@@ -1,5 +1,5 @@
1
1
  module ActiveRabbit
2
2
  module Client
3
- VERSION = "0.5.1"
3
+ VERSION = "0.5.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerabbit-ai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Shapalov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-12-22 00:00:00.000000000 Z
11
+ date: 2025-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby